Created
July 8, 2013 16:09
-
-
Save cgrymala/5950168 to your computer and use it in GitHub Desktop.
New method of retrieving latitude and longitude from a Google Maps marker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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