我正在尝试将谷歌地理编码服务与开放层地图一起使用。这应该毫无问题地工作......不是吗?我正在使用的代码就像 googles geocode api doc 上的示例:
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);
}
}); }
出于某种原因,我没有得到 Geocoder 对象。永远不会执行带有地址的警报。
期待一些提示