我正在嘗試使用谷歌地理編碼服務與地形圖。這個工作沒有問題......應該不是嗎? 我正在使用的代碼就像上谷歌的地理編碼例如API文檔:openlayers和谷歌地理編碼器
function geoCode(){
var adresse = $("observation_location_text").getValue();
var geoCoder = new google.maps.Geocoder();
alert(adresse);
geoCoder.geocode({ 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
marker.moveTo(results[0].geometry.location);
marker.display(true);
} else {
alert("Geocode was not successful for the following reason: " + status);
}
}); }
由於某種原因,我不明白的地理編碼對象。地址警報從不執行。
期待一些提示 月
哦BTW地圖和標記變量來自openlayers,因此可能無法使用。創建新的Geocoder對象的調用不會返回。 – Jan 2011-02-08 09:23:44
您需要知道,谷歌地理編碼器的服務條款不幸地規定您使用座標映射到谷歌地圖上。 「注意:地理編碼API只能與Google地圖一起使用,禁止在地圖上顯示地理編碼結果,有關允許使用的完整詳細信息,請參閱Maps API服務條款許可限制。 – 2012-04-17 17:37:53