Created
June 19, 2020 07:27
-
-
Save vspruyt-sol/6d16af5a61a4c334ac989ac001c200d8 to your computer and use it in GitHub Desktop.
Google coordinates tot Lambert 72
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double lat = 50.3803887; | |
double lng = 4.9853501; | |
double LongRef = 0.076042943; | |
double bLamb = 6378388 * (1 - (1 / 297)); | |
double aCarre = Math.pow(double.valueOf(6378388.0), double.valueOf(2.0)); | |
double eCarre = (aCarre - Math.Pow(bLamb, double.valueOf(2.0))) / aCarre; | |
double KLamb = 11565915.812935; | |
double nLamb = 0.7716421928; | |
double eLamb = Math.Sqrt(eCarre); | |
double eSur2 = eLamb / 2; | |
lat = (Math.PI / 180) * lat; | |
lng = (Math.PI / 180) * lng; | |
double eSinLatitude = eLamb * Math.Sin(lat); | |
double TanZDemi = (Math.Tan((Math.PI / 4) - (lat / 2))) * (Math.Pow(((1 + (eSinLatitude)) / (1 - (eSinLatitude))), (eSur2))); | |
double RLamb = KLamb * (Math.Pow((TanZDemi), nLamb)); | |
double Teta = nLamb * (lng - LongRef); | |
decimal x = 0; | |
decimal y = 0; | |
x = 150000 + 0.01256 + RLamb * Math.Sin(Teta - 0.000142043); | |
y = 5400000 + 88.4378 - RLamb * Math.Cos(Teta - 0.000142043); | |
System.debug(String.format('http://bdes.spw.wallonie.be/portal/#BBOX={0},{0},{1},{1}', new List<String>{String.valueOf(x), String.valueOf(y)})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment