页面统一调用:
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=Xbq3g4meudxD5Q0MB9osTLpg"></script>
百度密钥:Xbq3g4meudxD5Q0MB9osTLpg
JS调用:
//百度定位获取现在的位置
var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r){
if(this.getStatus() == BMAP_STATUS_SUCCESS){
mylat = r.point.lat
mylng = r.point.lng;
gas_obj.load_gas(mylat,mylng);
//alert('您的位置:'+r.point.lng+','+r.point.lat);
}else{
alert('failed'+this.getStatus());
}
},{enableHighAccuracy: true});