View source: R/layers_h3-cluster-layer.R
add_h3_cluster_layer | R Documentation |
Add a h3 cluster layer to the deckgl widget
add_h3_cluster_layer( deckgl, data = NULL, properties = list(), ..., id = "h3-cluster-layer" )
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. |
https://deck.gl/#/documentation/deckgl-api-reference/layers/h3-cluster-layer
## @knitr h3-cluster-layer data_url <- paste0( "https://raw.githubusercontent.com/uber-common/deck.gl-data/", "master/website/sf.h3clusters.json" ) # sample_data <- jsonlite::fromJSON(data_url, simplifyDataFrame = FALSE) sample_data <- data_url properties <- list( stroked = TRUE, filled = TRUE, extruded = FALSE, getHexagons = ~hexIds, getFillColor = JS("d => [255, (1 - d.mean / 500) * 255, 0]"), getLineColor = c(255, 255, 255), lineWidthMinPixels = 2, getTooltip = ~mean ) deck <- deckgl(zoom = 10.5, pitch = 20) %>% add_h3_cluster_layer(data = sample_data, properties = properties) %>% add_basemap() if (interactive()) deck
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.