标签:apc type 删除 com etl ddc get function api
<!-- 百度地图js api --> <script type="text/JavaScript" src="http://api.map.baidu.com/api?v=1.3"></script> <script type="text/javascript"> //加载百度地图 function setPoint(obj, level) { var map = new BMap.Map("container"); // 创建地图实例,参数为对应 div 的 id var point2; if(obj == ‘‘) { point2 = new BMap.Point(120.136625,30.265952); // 创建点坐标 }else{ point2 = obj; } if (level == ‘‘) { level = 13; } map.centerAndZoom(point2, level); // 初始化地图,设置中心点坐标和地图级别 map.addControl(new BMap.NavigationControl()); map.addControl(new BMap.NavigationControl()); map.addControl(new BMap.ScaleControl()); map.addControl(new BMap.OverviewMapControl()); map.addControl(new BMap.MapTypeControl()); //启用滚轮放大缩小,默认禁用 map.enableScrollWheelZoom(); //启用地图惯性拖拽,默认禁用 map.enableContinuousZoom(); map.setDefaultCursor("auto"); var marker = new BMap.Marker(point2); // 创建标注 map.addOverlay(marker); //可以拖拽 marker.enableDragging(); //标注拖拽后的位置 marker.addEventListener("dragend", function(e) { getAddress(e.point.lng, e.point.lat); }); //点击的位置 var _marker = marker; map.addEventListener("click", function(e) { //删除具体标注 map.removeOverlay(_marker); var pointClick = new BMap.Point(e.point.lng, e.point.lat); //创建新标注 var marker1 = new BMap.Marker(pointClick); map.addOverlay(marker1); //可以拖拽 marker1.enableDragging(); //标注拖拽后的位置 marker1.addEventListener("dragend", function(e) { getAddress(e.point.lng, e.point.lat); }); _marker = marker1; getAddress(e.point.lng, e.point.lat); //标注跳动 //marker.setAnimation(BMAP_ANIMATION_BOUNCE); //setPoint(pointClick, map.getZoom()); // var map1 = new BMap.Map("allmap"); // var point = new BMap.Point(e.point.lng,e.point.lat); // var gc = new BMap.Geocoder(); // gc.getLocation(point, function(rs) { // alert(rs.sematic_description); // var addComp = rs.addressComponents; // var mapAddress = addComp.province+addComp.city + addComp.district // + addComp.street + addComp.streetNumber; // }); }); getAddress(120.136625, 30.265952); } function getAddress(a,b){ var map = new BMap.Map("allmap"); var point = new BMap.Point(a,b); var gc = new BMap.Geocoder(); gc.getLocation(point, function(rs){ var addComp = rs.addressComponents; alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber); }); } </script>
标签:apc type 删除 com etl ddc get function api
原文地址:http://www.cnblogs.com/007sx/p/6792789.html