【问题标题】:GoogleMaps geocoder error: ZERO_RESULTSGoogleMaps 地理编码器错误:ZERO_RESULTS
【发布时间】:2012-12-19 16:19:22
【问题描述】:

这是我获取地址的 lon 和 lat 的 JS 代码。

在 99% 的情况下它都可以正常工作....但有时我会得到 ZERO_RESULTS 状态...

if (geocoder) {
    geocoder.geocode({'address': address, 'language':'it'}, function (results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            $('#frm_company_lat').val(results[0].geometry.location.lat());
            $('#frm_company_lon').val(results[0].geometry.location.lng());

            can_submit = true;
            $('#company_frm').trigger("submit");
        } else{
            top.console.debug(address);
            top.console.debug(status);
            alert("Cannot get lon in lat: "+ address);
            //can_submit = true;
            //$('#company_frm').trigger("submit");
        }
    });
}

地址没什么特别的,如果我直接在谷歌地图中查找,它会显示...

如果我尝试直接获取 JSON(通过直接 url),我会得到相同的结果!

http://maps.googleapis.com/maps/api/geocode/xml?address=Via%20Selo%2010a,%2047122%20Forli,%20Italia&sensor=false

请告知

【问题讨论】:

    标签: google-maps google-geocoder street-address


    【解决方案1】:

    看起来有时最好从地址查询中删除邮政编号/zip...

    所以在特定情况下,如果我删除 47122 它可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-09-15
      • 2018-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-31
      • 1970-01-01
      相关资源
      最近更新 更多