inst/examples/deckgl-api-reference/geojson-layer.R

geojson <- paste0(
  "https://raw.githubusercontent.com/",
  "uber-common/deck.gl-data/",
  "master/website/bart.geo.json"
)

deck <- deckgl(zoom = 10, pickingRadius = 5) %>%
  add_geojson_layer(
    data = geojson,
    filled = TRUE,
    extruded = TRUE,
    getRadius = 100,
    lineWidthScale = 20,
    lineWidthMinPixels = 2,
    getLineWidth = 1,
    getLineColor = "@=properties.color || 'green'",
    getFillColor = c(160, 160, 180, 200),
    getElevation = 30,
    tooltip = JS("object => object.properties.name || object.properties.station")
  ) %>%
  add_basemap()

if (interactive()) deck

Try the deckgl package in your browser

Any scripts or data that you put into this service are public.

deckgl documentation built on March 7, 2023, 5:37 p.m.