GoogleMaps地理编码器错误:ZERO_RESULTS [英] GoogleMaps geocoder error: ZERO_RESULTS
本文介绍了GoogleMaps地理编码器错误:ZERO_RESULTS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的JS代码,用于获取地址的长度和经度。在99%的工作时间内,
确定....但有时我会得到ZERO_RESULTS状态......
pre $
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(无法在lat:中获取lon:+ address);
// can_submit = true;
//$('#company_frm').trigger(\"submit) ;
}
});
}
地址没什么特别的,如果我直接在谷歌地图中查找它,它显示...
如果我尝试直接获取JSON(通过直接url),我会得到相同的结果!
请告知
解决方案
从地址查询中删除邮政编号/邮政地址 ...
这样在具体的情况下,如果我删除了47122, p>
This is my JS code to get lon and lat of an address.
in 99% of the time it works OK.... but sometimes I get ZERO_RESULTS status...
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");
}
});
}
The address is nothing special and if I look for it in google maps directly, it shows...
If I try to fetc JSON directly (via direct url) I get the same result!
PLEASE ADVISE
解决方案
It looks like sometimes is better to remove the postal number/zip out of the address query...
so in the specific case if I remove 47122 it works OK.
这篇关于GoogleMaps地理编码器错误:ZERO_RESULTS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文