154
rated 0 times
[
160]
[
6]
/ answers: 1 / hits: 33621
/ 12 Years ago, tue, january 29, 2013, 12:00:00
I am struggling to clear all polylines from my map, i only clear the newest.
var polylines;
// add map polylines
function addPolyline(polyArray, colour) {
polylines = L.polyline(polyArray, {color: colour});
polylines.addTo(map);
}
// clear polylines
function clearPolylines() {
map.removeLayer(polylines);
}
where addPolylines is called multiple times and clear Polylines is called once. How can i clear all polylines on the map?
More From » leaflet