js用地点得到谷歌坐标

window.g = {};

function fetchPoint_gg(city,address,kind2name){
if (GBrowserIsCompatible()) {//判断浏览器是否支持谷歌地图
g.geocoder = new GClientGeocoder();
g.geocoder.getLatLng(
address,
function (point) {
if (point) {

alert(point.lat());//x坐标

alert(point.lng());//y坐标

}
else {
alert("无法解析: " + address);
}
}
)


}
else {
alert('不支持的浏览器');
}
}

posted on 2014-12-09 10:54  elen-  阅读(160)  评论(0编辑  收藏  举报

导航