trafficonese / leaflet.extras

Extra functionality for leaflet R package.
https://trafficonese.github.io/leaflet.extras/
GNU General Public License v3.0
213 stars 74 forks source link

Controlling the Z index of a heatmap (addHeatmap) #163

Closed yanirmor closed 5 years ago

yanirmor commented 5 years ago

Hello and thanks for the great package.

I'm trying to draw a heatmap on top of polygons, but can't get the polygons be "under" the heatmap. Is there a way to do that?

Things that don't work:

Minimal Example

library(leaflet)
library(leaflet.extras)

leaflet() %>%
  addPolygons(lng = c(10, 20, 20, 10), lat = c(10, 10, 20, 20), fillOpacity = 0.75) %>%
  addHeatmap(lng = c(14, 15, 15, 16), lat = c(10, 10, 12, 10))

image

Thanks!

yanirmor commented 5 years ago

Was solved using addMapPane (see here). Anyway if it's possible to add an options argument to addHeatmap I think it might be useful.