Reputation: 47947
I have country and address. How can I retrieve latitude
and longitude
from Google Maps V3?
I will use this to load the map.
EDIT
This is my actual code, but seems that Google API return this error : W[B].bindTo=function(a,b,c,d){var c=c|...R[p](this,wf,a);this.Pb&&this.Pb(a)};
SOLUTION remove center: location,
Upvotes: 0
Views: 4644
Reputation: 34855
You need to access geocoding.
http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding
http://code.google.com/apis/maps/documentation/geocoding/index.html
Upvotes: 1
Reputation: 23088
You can retreive this with Geocoding Requests.
You can see my last project that I used this here. See function AddMarker
in gmaps3.js
for a working real world example. Basically I fetch addresses from database (using AJAX) and then convert them to lat/lon to make markers on the map.
Upvotes: 2
Reputation: 3176
You can use their ReST-API.
http://maps.google.com/maps/api/geocode/json?address=Berlin+Germany&sensor=false
The documentation is in The Google Geocoding API. You will have to do a http request e.g. $.get
in jQuery to perform the query and then parse the JSON. Other output formats include XML. There's a JavaScript geocoder on their site as well.
Upvotes: 1