I'm trying to selectively remove a source in mapbox gl js, I'm using map.removeSource('<SOURCE_ID>')
but nothing happens. The layers still remain on the map. I've created an example in Codepen.
Removing a source in mapbox gl js doesn't remove its layers
Asked Answered
You've got to remove the source and the layer. Call removeLayer first (since it depends on the source) and then remove the source next.
I believe I have removed the layer already, but the source seems to be in use still. Is there any way to see what layer is using a source by chance? –
Copier
how to call removeLayer –
Interurban
Is there any progress? I'm still confronted with the same problem. Even after removing the Layer it says
Source '<source layer name>' is in use, cannot remove
–
Illuminant © 2022 - 2024 — McMap. All rights reserved.