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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top