Comments (4)
rdeck
doesn't support interleaving deck.gl layers with basemap layers; all of the layers you add to an rdeck map are deck.gl layers and will be rendered on top of the basemap as an overlay. The mvt_layer
is the deck.gl MVTLayer which renders tile data as a GeoJsonLayer.
You could also just use the layer_selector
and toggle layers off when you need to see the basemap, unobstructed by data: rdeck(layer_selector = TRUE)
. Assuming that your data is more important than the basemap context the majority of the time, this should work well -- my team does this.
If you need to put basemap labels on top of your data, you can achieve that by re-drawing the labels on top of other deck.gl layers with another mvt_layer (or text_layer if the data is local).
PS: I don't intend to support deck.gl and mapbox-gl interleaving via MapboxLayer.
from rdeck.
All right, thanks for the quick answer!
Just tried with local data and add_text_layer
, works fine! To avoid the addition of a layer, there's a column in my MVT with the labels of my polygons. I saw the get_text
argument in the Usage part of the add_mvt_layer
documentation, but couldn't make it work the same way I did with add_text_layer
! Labels don't appear. Here's a reprex if you'd like to take a look:
shinyApp(
ui = fillPage(
rdeckOutput("map", height = "100%"),
),
server = function(input, output) {
output$map <- renderRdeck(
rdeck(theme = "mapbox://styles/mapbox/streets-v11",
initial_view_state = view_state(center = c(-73.58, 45.53),
zoom = 10.1)) |>
add_mvt_layer(id = "test",
data = mvt_url("maxbdb.borough_7"),
pickable = TRUE, tooltip = TRUE,
get_text = rlang::sym("name"),
get_fill_color = "#FE7D6AFF")
)
}
)
from rdeck.
mvt_layer
can draw text for point features via point_type = "text"
(or "circle+text", "icon+text" etc). That tileset doesn't appear to have any point features though.
Unrelated note, changing the basemap is done via map_style
; theme
("kepler" or "light") is for css -- and appears to be not validated.
library(rdeck)
library(shiny)
shinyApp(
ui = fillPage(
rdeckOutput("map", height = "100%"),
),
server = function(input, output) {
output$map <- renderRdeck(
rdeck(map_style = "mapbox://styles/mapbox/streets-v11",
initial_view_state = view_state(center = c(-73.58, 45.53),
zoom = 10.1)) |>
add_mvt_layer(id = "test",
data = mvt_url("maxbdb.borough_7"),
pickable = TRUE, tooltip = TRUE,
get_text = rlang::sym("name"),
get_fill_color = "#FE7D6AFF",
point_type = "text")
)
}
)
from rdeck.
That fixes the issue. Thanks a lot!
from rdeck.
Related Issues (20)
- Deprecate `lazy_load`
- Arc Layer : Dynamic changes on Click event HOT 4
- Vignette: automating rdeck in javascript HOT 1
- Drop rstudio web viewer support
- MVTs not showing on deployed website HOT 7
- `tile_json()` for mapbox tilesets returns insecure urls
- Diverging scales
- Configurable `n_ticks` for discrete scales (excluding category)
- Font Awesome + Other Icon Library Support
- Map snapshots crop basemap or deck overlay when device pixels != 1
- Reveal.js stretches maps, making them blurred
- Reveal.js styles override rdeck styles for tooltip table
- `update_mvt_layer` fails when missing point_type argument HOT 1
- `get_view_state` gets triggered twice on v0.5.0 HOT 1
- Layers priority HOT 1
- Interleaved rendering mode
- Can't see stroked outlines on polygon layers HOT 6
- Change default radius/size/width units to "pixels"
- Enabling editor breaks map
- Tiles cannot be read using `tile_json` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rdeck.