leaflet-geoman
leaflet-geoman copied to clipboard
A way to destroy/un-initialize geoman
I have found that when destroying the map instance then recreating it, geoman does not get destroyed with it, so when it is re-initialized you get Maximum call stack size exceeded.
errors.
Is there a clean way to destroy geoman? or should it get destroyed when the map instance is destroyed.
Can you pls share your code with us? A jsfiddle would be nice.
This is working without problems:
function initMap(){
var map = L.map('example2');
map.on('load move unload',(e)=>console.log(e))
map.setView([18.74469, 72.1258], 8);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
map.pm.addControls();
return map;
}
var map = initMap();
map.remove();
map = initMap();
Closing because of no response