New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_clearPath() leaves line on the map #31
Comments
Hi Brendan, |
I'm sure I looked through old issues before asking... Yes that worked for me! I danced around it for so long yesterday. The solution for me is to use terrainProfile.addTo(theMap);
terrainProfile.load(geoJsonData);
...stuff happens....
terrainProfile.layer.remove() //removes line from map
terrainProfile.remove(); //removes graph Thanks! |
Ok, good to know, var chart = L.control.elevation();
var layer = L.geoJson( jsonData, {
onEachFeature: chart.addData.bind( chart ) // populate graph with elevation data
});
...
chart.addTo(map); // add graph to map
layer.addTo(map); // add line to map
...
layer.remove() // remove line from map
chart.remove(); // remove graph from map Source code: leaflet-elevation/leaflet-elevation.js Line 297 in 447201b
Have a nice day, |
When I call
.clear()
on my terrain profiler, the graph clears out but the line get's left on the map. I can see where_clearPath()
goes and removes class names from the<path>
element, but this doesn't appear to affect the line on the map at all. So I'm unsure what the objective is.I would expect the polyline that's drawn when I load in data to disappear (if not remove the
g->svg->path
elements altogether).If this is expected behavior, I'd like to remove the line when I clear the profile data in preparation to display a new profile and line. I found that I can remove the graph from the map entirely with
.remove()
, but the line persists.The text was updated successfully, but these errors were encountered: