- I am running a small web project using Open Street Map using leaflet.
- Since OSM doesn’t take earth’s curvature into account. It drew a simple straight polyline.
- I found leaflet.greatCircle.js on the internet and applied to my twilight overlays and measurement functions
- However the layers are not removed properly causing them to keep stacking up each other
- I asked gpt to find out what the problem is, and I am replied to modify removing and redrawing layers. I followed its suggestions however the issue persists.
changed the handling of removing and redrawing functions after chatgpt solutions
remove: function () {
if (this._polygon) this._polygon.remove();
if (this._circle) this._circle.remove();
if (typeof this._circles !== "undefined") {
if (this._circles.length > 0) {
for (var i in this._circles) {
this._circles[i].remove();
}
}
this._circles = undefined;
}
this._addedToMap = false;
},