从多个点中删除指定点

html, body, #container {

height: 100%;

width: 100%;

}

.amap-icon img {

width: 25px;

height: 34px;

}

删除指定点

var map = new AMap.Map("container", {

resizeEnable: true,

center: [116.397428, 39.90923],

zoom: 13

});

// 清除指定点

function clearMarker() {

markers[0].setMap(null);

markers[2].setMap(null);

}

var markers = [];

var positions = [[116.405467, 39.907761], [116.415467, 39.907761], [116.415467, 39.917761], [116.425467,

39.907761], [116.385467, 39.907761]];

for (var i = 0, marker; i < positions.length; i++) {

marker = new AMap.Marker({

map: map,

icon: '//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-' + (i + 1) + '.png',

position: positions[i]

});

markers.push(marker);

}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐