How to get `latitude` and `longitude` for an address? Google Maps
I'm using http://gmap.nurtext.de/documentation.html library to display the map for my address field (mysql table)
How I can get the latitude
and longitude
for each address, for example:
I have this address: 'McLester road'
Note:
my visitor (user)开发者_StackOverflow中文版 who added the address (into Mysql table)Enter the desired address into Google Maps.
Now, enter this into the address bar:
javascript:void(prompt('',gApplication.getMap().getCenter()))
This will return the longitude and latitude for you. Simply copy and paste these numbers into your code.
EDIT
Since this question is still getting some attention I'd like to say that nowadays most browsers will search for the text you put into the address bar, so instead it may be better to open up your browser's console and just enter a portion of the above code:
prompt('',gApplication.getMap().getCenter())
Also, if you just want the just the javascript object returned, just call:
gApplication.getMap().getCenter()
That way, you can do things programatically as well.
Google's geocoding sevice can convert address to coordinates.
There is a javascript api, but geocoding is available as a webservice too.
精彩评论