Search code examples
google-mapsgoogle-maps-api-3google-maps-static-api

Coordinate Differences between Google maps and Google Static Maps


I'm writing an application where user can point a position in a Google Maps map (using Google Maps API). I grab the position by:

google.maps.event.addListener( my_map, 'click', function(mouseEvent){

     var position = mouseEvent.latLng;
     //position = 41.57187486787156, 0.609094047546364
});

Then, in an another page, I display an image with all marked positions using Google Static Maps using the coordinates grabbed from user marked points:

<img alt="map image" src="http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=550x380&markers=label:A|41.57187486787156, 0.609094047546364">

Google Static Map displays the marker a little to the south.


Solution

  • Static Maps has a precision-limit of 6 decimals for locations, the marker-position will be rounded and set to 41.571875,0.609094

    You'll need to round the values inside the dynamic map too to get the same marker-location on both maps.