开发者

Get Address String/Lat Lang of tapped location on google maps. API

I am looking for a spc api/method to get the address/Lat Lang of a tapped point in google maps. 开发者_如何学PythonBasically the need is to allow user to choose location from tapping into the google map. Once the user taps into a particular location on map, some event should get generated to get the location string as well as lat lang of that tapped place.

Any help/suggestions would be great.

Thanks


What you are after is reverse geocoding. You pass your latitude/longitude from your click event to the geocoder javascript object and you will get back the address. So in your click event:

geocoder.geocode({'latLng': latlng}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
      if (results[0]) {
          // render the address
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜