Question

I want to dynamically (for example, when a button is clicked) add a layer below a GeoJSON layer in mapbox. How do I do that?

Thank you.

Edit: The layer to be added below a GeoJSON layer is a heat map layer: https://github.com/Leaflet/Leaflet.heat. Problem hasn't been solved. Can anybody help me?

Was it helpful?

Solution

Depends on the type of layer you're adding, but the general concept is z-index, which tells Leaflet how to sort its layers: setZIndex() is a start for tile layers, and zIndexOffset for markers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top