【问题标题】:How to get city from lat/lng with Google Maps V3?如何使用 Google Maps V3 从 lat/lng 获取城市?
【发布时间】:2012-04-04 14:55:54
【问题描述】:

这是what 我已经完成了:

var geocoder = new google.maps.Geocoder();
var location = new google.maps.LatLng(45.930976,10.639744);

geocoder.geocode({ 'latLng': location  }, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        alert(results[1].address_components[0].long_name);
    }
}); 

但我不想使用 address_components[i] 哪个参数,因为每个请求可能会有所不同。获取城市的参数如何? (或位置,或国家,等等......)。

【问题讨论】:

  • 你有没有得到这个工作?我很想知道解决方案是什么。

标签: google-maps google-maps-api-3 geolocation


【解决方案1】:

不确定我是否正确阅读 API (Geocoding API doc),但它看起来可能是 'types:locality'

【讨论】:

  • 你解决过这个问题吗?我很想知道如果你这样做了。
猜你喜欢
  • 1970-01-01
  • 2011-04-03
  • 1970-01-01
  • 2018-07-25
  • 2017-09-15
  • 2011-10-31
  • 1970-01-01
  • 2018-06-30
  • 1970-01-01
相关资源
最近更新 更多