dictionarynutiteq

How To Convert Nutiteq lib's Coordinates into GPS Coordinates


hello mates hope you having a nice day, its been a long time i am trying to convert back the coordinates that the nutiteq map creates from the location to the lat/long .

the coordinates are created using this method :

public MapPos fromWgs84(double lon, double lat)
 {
double x = lon * 111319.49079327358D;
double y = Math.log(Math.max(0.0D, Math.tan(lat * 0.008726646259971648D +  0.7853981633974483D))) * 6378137.0000000009D;
 return new MapPos(x, y);
 }

outPut =  some thing like this >>  x : 5734816.645344431  y : 4273005.026162199

is there any one who can help me how can i convert these coordinates back to lat/long , since i am not good at math methods and cant revert these :/ thanks alot


Solution

  • Nutiteq lib has class EPSG3857 and this has methods for both fromWgs84() and toWgs84:

    Projection proj = new EPSG3857(); 
    MapPos mercator = proj.fromWgs84(new MapPos(13.38933, 52.51704);
    
    MapPos wgs = proj.toWgs84(mercator); // should return 13.38933, 52.51704