谷歌地图API找不到一个特定的地址 [英] google maps api can't find one specific address
问题描述
我使用的是Google Maps API,它适用于除一个特定地址以外的所有地址。这是99p商店19-20市场Wisbech PE13 1DZ。当使用谷歌地图时,我可以找到它,但使用js api它表示'零结果'。
I am using google maps api and it works for all but one specific address. It's "99p Stores 19-20 Market Place Wisbech PE13 1DZ". When using google maps I can find it, but using js api it says 'zero results'.
我的代码:
My code:
function mapsSetMark(map, address) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode({'address': address}, function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
map.setZoom(13);
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
console.log('Geocode was not successful for the following reason: ' + status);
}
});
}
推荐答案
99p Stores 19-20 Market Place Wisbech PE13 1DZ是一个不是邮寄地址的地方。 Geocoder专门用于邮政地址
"99p Stores 19-20 Market Place Wisbech PE13 1DZ" is a place not a postal address. The Geocoder is specifically for postal addresses
可以找到19-20 Market Place Wisbech PE13 1DZ
It can find "19-20 Market Place Wisbech PE13 1DZ"
寻找99p Stores 19-20 Market Place Wisbech PE13 1DZ使用 Places API Library
To find "99p Stores 19-20 Market Place Wisbech PE13 1DZ" use the Places API Library
这篇关于谷歌地图API找不到一个特定的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!