Google Maps API地理编码器(V3),如何在google.maps.GeocoderResult上设置语言

时间:2011-07-08 09:11:45

标签: google-maps-api-3

我可以在Google地图地理编码器(V3)中使用任何属性来动态设置结果(google.maps.GeocoderResult)中的语言吗?不使用html标头脚本标记<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&amp;language=vi-VN"></script>

例如

var G = new google.maps.Geocoder(); // google geocoder
G.geocode({'location': ll/*, 'language':'vi-VN'*/}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
    if (results[0]) {                   
        me.set({'locate':results[0].address_components});
        me.set({'address':results[0].formatted_address});
    } else {
        alert("No results found");
    }
} else {
    alert("Geocoder failed due to: " + status);
}

原因我想构建一个连接点的区域树具有相同的区域

        us
      /     \ 
   new york  ...
    /  \
   p1   p2 

如图所示,p1和p2位于同一区域'new-york'

谢谢

1 个答案:

答案 0 :(得分:0)

我相信以前可以在v2中执行此操作,但在第3版中,选项是浏览器首选项,通过API脚本URL中的参数进行语言本地化,以及通过API脚本URL中的参数进行区域本地化。

如果您想要分享有关您的用例的更多信息,可以提出解决方案/解决方法。