var geoLocat=new BMap.Geolocation(); var gc=new BMap.Geocoder();
geoLocat.getCurrentPosition(function(r){ if(geoLocat.getStatus()==0){ //console.log(r.point.lat)
var mypoint=new BMap.Point(116.40387397,39.91488908);//r.point.lng,r.point.lat);
gc.getLocation(mypoint,function(x){ //正确的是地址逆解析成功后设置元素内容为详细地址,
//但是这里解析错误x为null 不清楚什么原因,
//但之前是好的 不知道怎么回事百度API就报错了
//有人遇到过百度经常报错时好时坏的吗?
console.log(x)
$("#map_objective").html(x.address);
})
}else{
alert(geoLocat.getStatus());
}
})
添加回答
举报
0/150
提交
取消