map.getUserLocation(function(state,point){
if (0 == state) {
pcenter = new plus.maps.Point(point.longitude, point.latitude);
map.centerAndZoom(pcenter,18);
alert(point.longitude+","+point.latitude);
plus.maps.Map.reverseGeocode(point,{},function(event){
var address = event.address; // 转换后的地理位置
$('.titye').val(address);//记录上传地址
$('.longitude_and_latitude').val(point.longitude+","+point.latitude);//记录上传经纬度
$('.prompt').text("位置信息:"+address);
alert(JSON.stringify(event));
});
plus.nativeUI.closeWaiting();
} else {
map.centerAndZoom(new plus.maps.Point(116.3977, 39.906016), 12); //指定默认地址
plus.nativeUI.alert('获取定位位置信息失败,请重新定位!');//定位异常
plus.nativeUI.closeWaiting();
titye = '';//根据经纬度得到地址
longitude_and_latitude = '';//记录的经纬度
$('.div_css').css('display','block');//显示地图加载失败提示
}
});
0 个回复