Also this time I reply to a comment with a post, given the general interest. Armando asked me if it was possible, using Google Maps, Latitude and Longitude obtained from a city name or street. The answer is yes! Using the Google Maps API geocoding service you can ask Google directly from reprocessing our textual information (state, city, etc.) in geographic coordinates. You can try an online example of documementazione Google directly on the site.
The main purpose behind this procedure is GClientGeocoder . . Using the method getLatLng() you can convert a string into an object address GLatLng .
NOTE: remember to include the need to request a free Google API key: see How to put Google Maps in your web on how to get the API key. This will be used for inclusion of the script, in the form:
1 |
Where is 'ABCDEFG', should be replaced with the key that Google releases free: Get key Google .
The use of this object is very simple, like most of the APIs provided by Google:
1 2 3 4 5 6 7 8 9 10 11 12 13 | / / Create the object GClientGeocoder new GClientGeocoder ( ) ; var geocoder = new GClientGeocoder (); / / The address is just a text, it could be just a city 'via salaria, roma, italia' ; var address = 'Via Salaria, Rome, Italy'; address , geocoder. getLatLng (address, point ) { function (point) { ! point ) { if (point) { address + ' non trovato' ) ; alert (address + 'not found'); { Else {} 'Latitudine = ' + point. lat ( ) + ' Longitudine = ' + point. lng ( ) ) ; alert ('Latitude =' + points. lat () + 'Longitude =' + points. lng ()); } } ); |
For completeness, also shows how to perform the reverse process, at this point. Adding an event to our map, in fact, it is possible to know which are the values of Latitude and Longitude:
1 2 3 4 5 6 | map , "click" , GEvent. AddListener (map, "click" overlay , point ) { function (overlay, point) { "Latitudine = " + point. lat ( ) + " Longitudine = " + point. lng ( ) ; myHtml var = "Latitude =" + points. lat () + "Longitude =" + points. lng (); point , myHtml ) ; map. openInfoWindow (point, myHtml); } ); |











Complete by [...] [...]
Great, thanks!
goods!
pour ceux here Developpe en local, vous pouvez utiliser http://localhost pour la demande de cle google
Thank you for your help.
Even more simple and completely automatic:
http://mygeoposition.com
Thanks I was looking for this
[...] For example, you can use the service provided by Google Geocoding in Google Maps and discussed: how to get Latitude and Longitude from an address. Apple iPhone or iPad, however, you can overcome this obstacle by using so [...]
I state that I am a principainte.
Mysite I'm trying to insert into the google map, getting latitude and longitude with the object GClientGeocoder.
But I have not figured out how to do ....
And 'possible to have a complete example starting from
and ending at
THANK YOU for the help!
Thanks for the article.
It was just what I was looking for.
I was able to fully integrate this functionality into my site.