百度地图找到已经标记点位置的经纬度,
利用ip去定位所在地方
//创建地图Map实例
var map = new BMap.Map("addMap");
//中心点设置
map.centerAndZoom( new BMap.Point(116.331398,39.897445), 11);
map.enableScrollWheelZoom( true);
map.enableContinuousZoom();
//根据IP得到当前城市, 并定位
var point = new BMap.Point(116.331398,39.897445);
map.centerAndZoom(point,12);
function myFun(result){
var cityName = result.name;
map.setCenter(cityName);
console.log("当前定位城市:"+cityName);
var lngLat = result.center;
console.log( "target lngLat", lngLat);
$("#addSubmit").click(function( event, wlngLat) {
console.log("this listen lngLat", wlngLat);//undefined
console.log( "This is addSubmit params", params);
addSubmit( params, wlngLat);
});
return lngLat;
}
var myCity = new BMap.LocalCity();
myCity.get(myFun);
console.log( myCity.get( myFun));
而后 我想得到已经定位了经纬度 用到其他的函数,该怎么处理呢?
或者 该去怎么找到这个 已经定位好了的标记点的经纬度呢?
相关分类