0
我最近開發了一個帶有Google Maps V3 Js API的經銷商地理位置平臺,但是我意識到當用戶輸入郵政編碼時,地理位置很差。Google Maps JS APIv3 - 地理編碼返回INSEE代碼的位置而不是郵政編碼
例如,如果用戶搜索13001(馬賽第一區),地理定位是在普羅旺斯艾克斯(其INSEE代碼爲13001)上完成的。 同上13007(馬賽第七區),返回距離馬賽20公里的Auriol。
看來,這是下面的代碼段返回錯誤的座標:
function GoogleGeocode(){
geocoder = new google.maps.Geocoder();
this.geocode = function(address, callbackFunction) {
geocoder.geocode({ 'address': address}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
var result = {};
result.latitude = results[0].geometry.location.lat();
result.longitude = results[0].geometry.location.lng();
callbackFunction(result);
} else {
if (settings.geocodeErrorAlert != "") {
alert(settings.geocodeErrorAlert + status);
}
callbackFunction(null);
}
});
};
}
你有一個解釋和解決這一問題的解決方案?
謝謝大家