In OpenLayer3 Map I'm getting lat/lang from nominatim and the map is in "EPSG:900913" projection and then transforming it to "EPSG:4326" projection .

if lat = 12.9791198 and lang = 77.5912997 then i am transforming like this,

var point = new ol.geom.Point([lan,lat]);

After transformation lat/lang should be [8643375.747091185,1460888.081802196] but i am getting [8637423.97259228,-13864431.524951909].

  • have you tried the "official" code EPSG:3857 ? Also note that you source and destination are unclear; Your example is FROM WGS84 TO mercator, but your text and your point.transform are FROM mercator TO WGS84. Could you please edit your post to clarify ?
    – radouxju
    Commented Sep 10, 2015 at 6:53
  • I am getting different right coordinates gdaltransform -s_srs epsg:4326 -t_srs epsg:3857 77.5912997 12.9791198 8637423.97259228 1457346.85837884
    – user30184
    Commented Sep 10, 2015 at 6:55
  • @radouxju i have edited. Commented Sep 10, 2015 at 7:14
  • @radouxju its not working with point.transform("EPSG:4326","EPSG:3857") Commented Sep 10, 2015 at 7:16
  • Are you sure the coordinates you're expected are good? because point.transform("EPSG:4326","EPSG:3857") give the same as gdaltransform does. So the problem can be how did you get your lat/lon values.
    – oterral
    Commented Sep 21, 2015 at 7:46

1 Answer 1


While creating the point instance

var point = new ol.geom.Point([lon,lat]);

lon and lat value should be in numeric format previously they were in string format hence it was converting into wrong lat and long.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.