I’m using the following code to get the coordinates of my Google maps marker as it’s position is changed
google.maps.event.addListener(marker, 'drag', function() {
lat = Math.round(marker.position.Ma * 1000) / 1000;
lng = Math.round(marker.position.Na * 1000) / 1000;
[.. using lat and long]
});
This code used to work fine. From time to time, Google changed the position variables name Ma and Na (not sure why they do so).
So I’m using the right variables to get the lat and long, or is there another way of doing it?
Try this:
It sounds like you’re using their private variables instead of accessor methods.