135
rated 0 times
[
139]
[
4]
/ answers: 1 / hits: 124662
/ 12 Years ago, thu, june 14, 2012, 12:00:00
I'm using Google Maps API. And I'm using the code below to get the coordinates of the marker.
var lat = homeMarker.getPosition().$a;
var lng = homeMarker.getPosition().ab;
Everything is working fine with the app that I built using Google Maps.
But I tested it today and I got problems getting the correct coordinates. Only to discover that the code above is getting undefined. After I console.log(homeMarker.getPosition()) I discovered that this is now the variables that they used for the coordinates.
var lat = homeMarker.getPosition().ab;
var lng = homeMarker.getPosition().cb;
I won't ask why Google Maps acts this way but you can also include it in your answer. My question is that how do I properly get the coordinates without changing my code everytime google maps changes the variables that they're using.
More From » google-maps