function clearMap() {
    // remove the controls for the wms layer then remove it from the map
    controlsObj.removeLayer(layerObj);
    mapObj.removeLayer(layerObj);
    // now do it for all the geojson layers
    for (let i = 0; i < geojsons.length; i++) {
        controlsObj.removeLayer(geojsons[i][0]);
        mapObj.removeLayer(geojsons[i][0]);
    }
    // now delete the controls object
    mapObj.removeControl(controlsObj);
}
// you need to remove layers when you make changes so duplicates dont persist and accumulate
you need to remove layers when you make changes so duplicates dont persist and accumulate
you need to remove layers when you make changes so duplicates dont persist and accumulate
function clearMap() {
    controlsObj.removeLayer(layerObj);
    mapObj.removeLayer(layerObj);
    for (let i = 0; i < geojsons.length; i++) {
        controlsObj.removeLayer(geojsons[i][0]);
        mapObj.removeLayer(geojsons[i][0]);
    }
    mapObj.removeControl(controlsObj);
}
function clearMap ( ) { controlsObj . removeLayer ( layerObj ) ; mapObj . removeLayer ( layerObj ) ; for ( let i = 0 ; i < geojsons . length ; i ++ ) { controlsObj . removeLayer ( geojsons [ i ] [ 0 ] ) ; mapObj . removeLayer ( geojsons [ i ] [ 0 ] ) ; } mapObj . removeControl ( controlsObj ) ; }
you need to remove layers when you make changes so duplicates dont persist and accumulate
you need to remove layers when you make changes so duplicates dont persist and accumulate
// remove the controls for the wms layer then remove it from the map // now do it for all the geojson layers // now delete the controls object