add_grid_layer {deckgl} | R Documentation |
Add a grid layer to the deckgl widget
Description
The GridLayer
renders a grid heatmap based on an array of points. It takes the constant size all each cell, projects points into cells.
The color and height of the cell is scaled by number of points it contains.
Usage
add_grid_layer(
deckgl,
data = NULL,
properties = list(),
...,
id = "grid-layer"
)
Arguments
deckgl |
A deckgl widget object. |
data |
The url to fetch data from or a data object. |
properties |
A named list of properties with names corresponding to the properties defined
in the deckgl-api-reference
for the given layer class. The |
... |
Named arguments that will be added to the |
id |
The unique id of the layer. |
See Also
https://deck.gl/#/documentation/deckgl-api-reference/layers/grid-layer
Examples
data("sf_bike_parking")
properties <- list(
filter = "spaces > 4",
visible = TRUE,
extruded = TRUE,
cellSize = 200,
elevationScale = 4,
getPosition = "@=[lng, lat]", #~lng + lat,
colorRange = RColorBrewer::brewer.pal(6, "YlOrRd"),
tooltip = "{{position.0}}, {{position.1}}<br/>Count: {{count}}"
)
deck <- deckgl(zoom = 11, pitch = 45, bearing = 35, element_id = "grid-layer") %>%
add_source("sf-bike-parking", sf_bike_parking) %>%
add_grid_layer(
source = "sf-bike-parking",
properties = properties
) %>%
add_control("Grid Layer") %>%
add_basemap() %>%
add_json_editor(wrap = 50, maxLines = 23)
if (interactive()) deck
[Package deckgl version 0.3.0 Index]