【问题标题】:Is it possible to geocode via googles geocoder via city/state/address rather than just address?是否可以通过谷歌地理编码器通过城市/州/地址进行地理编码,而不仅仅是地址?
【发布时间】:2012-12-29 14:53:13
【问题描述】:

我创建了很多使用 Google Maps Api V3 的应用程序。我刚刚遇到一个实例,我有一个城市、州、地址,我需要对所有这三个部分进行地理编码。我在代码中看到和当前使用的每个示例都特别偏离了地址。我在地理编码中看到的和看到的与我在此处粘贴的 Google 的主要示例非常相似。 :

function codeAddress() {
    var address = document.getElementById("address").value;
    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
        });
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
    });
  }

正如您所看到的,它只是在地址之外,我无法为我的应用程序执行此操作,因为我的一些地址非常模糊,并且会返回大量结果,只是想知道是否有人想出了如何执行此操作?

我搜索了这里的论坛,发现了一些类似的问题,但没有真正的答案。非常感谢任何 cmets/建议。

【问题讨论】:

    标签: .net google-maps-api-3 google-geocoder


    【解决方案1】:

    好的,完全误解了此地址字段的工作方式。您可以在地址字段的末尾添加城市状态。

    http://www.jasonfulps.com/node/288

    【讨论】:

      猜你喜欢
      • 2013-09-28
      • 1970-01-01
      • 2017-04-19
      • 2017-06-17
      • 1970-01-01
      • 2012-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多