开发者

How to get dynamically latitude and longitude on google maps?

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)};

SOLUTI开发者_开发知识库ON remove center: location,


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜