Monday, 9 September 2013

Leaflet latLng not compatibile with Google Maps latLng?

Leaflet latLng not compatibile with Google Maps latLng?

I'm using Leaflet to locate something on the map and I get a latLng with
14 decimals. But that doesn't seem to work with Google Maps. It says "We
could not find...".
So I removed some of the decimals using .toFixed(5), because Google maps
seems to use only 5 decimals for latLng, but the map location is not where
it should be :(
Am I missing something here? Do I need to do some kind of conversion?
This is how I'm building the google maps link:
var link = 'https://maps.google.com/maps?z='
+ map.getZoom() + '&q='
+ mark.getLatLng().lat.toFixed(5)
+ '+'
+ mark.getLatLng().lng.toFixed(5);
window.location = link;
The map variable is a Leaflet map, and mark is a Leaflet marker..

No comments:

Post a Comment