R/layers_grid-cell-layer.R
add_grid_cell_layer.Rd
The GridCellLayer
can render a grid-based heatmap.
It is a variation of the ColumnLayer
. It takes the constant width / height of all cells and top-left coordinate of each cell.
The grid cells can be given a height using the getElevation
accessor.
add_grid_cell_layer(
deckgl,
data = NULL,
properties = list(),
...,
id = "grid-cell-layer"
)
A deckgl widget object.
The url to fetch data from or a data object.
A named list of properties with names corresponding to the properties defined
in the deckgl-api-reference
for the given layer class. The properties
parameter can also be an empty list. In this case
all props must be passed as named arguments.
Named arguments that will be added to the properties
object. Identical parameters
are overwritten.
The unique id of the layer.
hexagon_centroids <- system.file("sample-data/centroids.csv", package = "deckgl") %>%
read.csv()
deck <- deckgl(zoom = 11, pitch = 35) %>%
add_grid_cell_layer(
data = hexagon_centroids,
getPosition = ~lng + lat,
getElevation = ~value,
getFillColor = "@=[48, 128, value * 255, 255]",
elevationScale = 5000,
cellSize = 250,
extruded = TRUE,
tooltip = "{{value}}"
) %>%
add_mapbox_basemap()
if (interactive()) deck