如何使用Google Maps V3 API在客户端进行反向地理编码?从地址到LatLng的前向地理编码是直接的(下面的代码),但是如何对反向地理编码做同样的事情呢?
普通地理编码:
geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
1 回答
这个过程完全相同,只有一点不同,就是提供一个LatLng对象而不是向地理编码功能提供一个地址对象
反向地理编码:
Example directly from Google
希望有所帮助 .