【发布时间】:2020-10-05 10:06:30
【问题描述】:
我的地图定位器可以工作,但我不确定如何重置标记,以便在用户进行地理定位时重置位置。目前,我的代码如下所示:
//map locator
map.locate({setView: true, maxZoom: 16});
function onLocationFound(e) {
var radius = e.accuracy;
L.marker(e.latlng).addTo(map)
.bindPopup("Vous êtes ici").openPopup();
L.circle(e.latlng, radius).addTo(map);
}
map.on('locationfound', onLocationFound);
function onLocationError(e) {
alert(e.message);
}
map.on('locationerror', onLocationError);
// end of geolocator with marker
【问题讨论】:
标签: javascript leaflet location reset