4

The map tiles in the Google Maps are in Spherical Mercator projection (srid 900913), but in the API the methods report coordinates in Lat/Lon WGS84, e.g. map.getCenter().

Is there a way to return the Lat/Lon's in the native Spherical Mercator projection coordinates within the API?

For example, if I centered the map in London and the getCenter() returns 51.5, 0.0, is there a way the API can actually return it in Mercator meters? 6710219.08322, 0.0

(without having write an external algorithm to convert it)

  • Yes See maptiler.org/google-maps-coordinates-tile-bounds-projection click on a tile for Spherical Mercator coordinates see the source code for the maths. – Mapperz Dec 12 '14 at 16:40
  • That still requires doing your own calculation. I thought something like this might do it:- var myPoint = new google.maps.Point(); myPoint = map.getProjection().fromLatLngToPoint(map.getCenter()); console.log("myPt="+myPoint.toString()); ...but annoyingly that just gives the same lat/lon that you pass into the "fromLatLngToPoint" – Jason Dec 14 '14 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.