SymbolixAU / mapdeck

R interface to Deck.gl and Mapbox
https://symbolixau.github.io/mapdeck/articles/mapdeck.html
362 stars 40 forks source link

Allow layering of base tiles and other map layers with different z-indices (if possible with deck.gl) #389

Open kmcd39 opened 2 months ago

kmcd39 commented 2 months ago

I'm making plans to switch from leaflet to either deck.gl or maplibre gl js for a lot of my interactive mapping / shiny development work.

Using R/leaflet, I made a practice of initializing maps with different layers: one w/o labels and another with labels separate, and I put the data between them by setting z-indices.

For example, in leaflet, I had:

leaflet() %>%
    addMapPane("tileLabels", # place name labels
               zIndex = 599) %>%
    addProviderTiles(providers$CartoDB.PositronNoLabels) %>%
    addProviderTiles(providers$CartoDB.PositronOnlyLabels,
                     group = 'Place names',
                     options =
                       providerTileOptions(
                         pane = "tileLabels",
                       )) 

And then I could also add map panes for the data with a z-index between the NoLabel layer and the OnlyLabel layer, and give user ability to toggle labels on/off, and have labels appear above the data by default.

I don't see a way to layer provider tiles or basemaps in deck.gl using mapdeck! I'd be very interested in this feature for this package. I'm planning to check if this would be workable using the rdeck package as well / instead of mapdeck.

dcooley commented 2 months ago

I'm not that familiar with leaflet or what you're trying to achieve, but given your other comment in #365 perhaps mapdeck::update_style() is useful for you?