谷歌地图 - 状态代码 - GeocoderStatus

时间:2014-10-23 18:13:27

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

我遇到了geocoderStatus的麻烦,基本上我总是得到" google.maps.GeocoderStatus.OK" 当我发送请求时,即使地址无效或结果为零,

这是我的代码

    if (status == google.maps.GeocoderStatus.OK) {
        var lat = results[0].geometry.location.lat();
        var lon = results[0].geometry.location.lng();
        searchStores(lat, lon);
    } else {
        $addressErrorP.removeClass('hide');
    }

例如: 如果我发送此地址" 1525 COLD SPRINGS RD,CA"我明白了:

  

纬度= 38.746431&经度= -120.86995890000003,没关系

如果我将此作为地址发送"#$ ^%#$ ^%#%#%#%#$%"我明白了:

  

33.778175& longitude = 76.57617140000002这是无处可去的   !https://www.google.co.cr/maps/place/33%C2%B046' 41.4%22N + 76%C2%B034' 34.2%22W / @ 33.778175,-76.5761714,17z /数据= 3M1 4B14平方米3M1 1s0x0:为0x0 HL =!!?烯

所以我需要知道什么时候没有结果显示错误信息而没有重新加载没有位置的页面,但我从来没有得到其他东西那个状态好

这是https://developers.google.com/maps/documentation/javascript/geocoding中的文档:

状态代码

状态代码可能会返回以下值之一:

google.maps.GeocoderStatus.OK表示地理编码成功。 google.maps.GeocoderStatus.ZERO_RESULTS表示地理编码成功但未返回任何结果。如果地理编码在远程位置传递了不存在的地址或latng,则可能会发生这种情况。 google.maps.GeocoderStatus.OVER_QUERY_LIMIT表示您已超过配额。有关详细信息,请参阅Google Maps API for Work文档中的超出使用限制的文章,该文章也适用于非商业用户。 google.maps.GeocoderStatus.REQUEST_DENIED表示您的请求因某些原因被拒绝。 google.maps.GeocoderStatus.INVALID_REQUEST通常表示缺少查询(地址或latLng)。

0 个答案:

没有答案