Skip to content
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

Properly removing layer from map #68

Closed
do-me opened this issue Feb 8, 2021 · 1 comment
Closed

Properly removing layer from map #68

do-me opened this issue Feb 8, 2021 · 1 comment

Comments

@do-me
Copy link

do-me commented Feb 8, 2021

Whats the preferred way to remove the hexbinlayer from the map?
When I call

map.removeLayer(hexLayer);

or

hexLayer.remove()

the hexbins of the current zoom level freeze and remain as an artifact on the map canvas.

I can simply remove it on one zoom level only with d3.selectAll("g").remove() but is this really the 'proper' way?
I run into problems as I'm using geoman to draw polygons. It also uses g elements so everytime I call the above function I remove the polygon as well.
You can try with the standard hexbins jsfiddle.

I managed to access the parent element with $( ".hexbin" ).parent( "g" ).remove() so it behaves the way I want but still it doesn't seem elegant to me.

Additionally I noticed that after adding the layer to leaflet layer control the layer can't be turned off and behaves in the same way.

@jlondonobo jlondonobo mentioned this issue Nov 27, 2021
@reblace
Copy link
Contributor

reblace commented Feb 18, 2022

This is fixed now in v4.4.1. Sorry it took FOREVER to get around to fixing it.

@reblace reblace closed this as completed Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants