Skip to content

Instantly share code, notes, and snippets.

@cgrymala
Created July 8, 2013 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgrymala/5950168 to your computer and use it in GitHub Desktop.
Save cgrymala/5950168 to your computer and use it in GitHub Desktop.
New method of retrieving latitude and longitude from a Google Maps marker
// Retrieve the latitude and longitude of the search result
lat = Math.round( lat * 100000 ) / 100000;
long = Math.round( long * 100000 ) / 100000;
for ( var i = 0; i < limit; i++ ) {
// Retrieve a new LatLng object for the marker
var markLatLng = markers[i].getPosition();
// Retrieve the latitude and longitude of the marker, separately
var markLat = Math.round( markLatLng.lat() * 100000 ) / 100000;
var markLong = Math.round( markLatLng.lng() * 100000 ) / 100000;
if ( markLat == lat && markLong == long ) {
markers[i].setMap(umw_map);
google.maps.event.trigger( markers[i], 'click' );
centerPoint = new google.maps.LatLng( markLat, markLong );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment