百度地图创建删除单个坐标

// 百度地图API功能

var map = new BMap.Map('map');

var poi = new BMap.Point(113.3253,22.81608);
map.centerAndZoom(poi, 14);
map.enableScrollWheelZoom();

addPoint(113.3253,22.81608);

//添加坐标点
function addPoint(x,y){

  //自定义坐标点样式
  var changeIcon = new BMap.Icon("zb.png",new BMap.Size(30,30),{anchor: new BMap.Size(15, 30)}); 
  var point = new BMap.Point(x, y);
  var marker = new BMap.Marker(point,{icon:changeIcon});
  map.addOverlay(marker);
}

删除坐标点

function delPoint(marker){

  map.removeOverlay(marker);

}

 

posted @ 2020-03-16 15:27  析草的残梦  阅读(457)  评论(0编辑  收藏  举报