您好,没有太理解您说的更新接口是什么意思。
不过看您代码使用的是L.marker.addTo方法对地图中添加了bindpopup气泡,如果您是想把这些气泡图标都删除掉的话。
建议您在添加maker时专门创建图层来控制,需要删除时,直接对您的这个图层。
Layer.clearLayers();
给您写了个demo,您可以参考一下
<!--********************************************************************
* Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_measureDistance"></title>
<script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : "
https://iserver.supermap.io";
var map, resultLayer, url = host + "/iserver/services/map-world/rest/maps/World";
map = L.map('map', {
preferCanvas: true,
crs: L.CRS.EPSG4326,
center: [34, 108],
maxZoom: 18,
zoom: 3
});
test();
function test() {
new L.supermap.TiledMapLayer(url).addTo(map);
makerLayer = L.featureGroup().addTo(map);
var polyLine = L.polyline([[25, 102], [40, 116]], {color: "red"});
var marker1 = L.marker([25, 102]), marker2 = L.marker([40, 116]);
makerLayer.addLayer(polyLine);
makerLayer.addLayer(marker1);
makerLayer.addLayer(marker2);
//清空该图层内要素
//makerLayer.clearLayers();
}
</script>
</body>
</html>
希望可以帮助到您。