add_h3_hexagon_layer: Add a h3 hexagon layer to the deckgl widget

View source: R/layers_h3-hexagon-layer.R

add_h3_hexagon_layerR Documentation

Add a h3 hexagon layer to the deckgl widget

Description

Add a h3 hexagon layer to the deckgl widget

Usage

add_h3_hexagon_layer(
  deckgl,
  data = NULL,
  properties = list(),
  ...,
  id = "h3-hexagon-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 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.

id

The unique id of the layer.

See Also

https://deck.gl/#/documentation/deckgl-api-reference/layers/h3-hexagon-layer

Examples

## @knitr h3-hexagon-layer-layer
h3_cells <- system.file("sample-data/h3-cells.csv", package = "deckgl") %>%
  read.csv()

properties <- list(
  getHexagon = ~h3_index,
  getFillColor =JS("d => [255, (1 - d.count / 500) * 255, 0]"),
  getElevation = ~count,
  elevationScale = 20,
  getTooltip = "{{h3_index}}: {{count}}"
)

deck <- deckgl(zoom = 11, pitch = 35) %>%
  add_h3_hexagon_layer(data = h3_cells, properties = properties) %>%
  add_control("H3 Hexagon Layer") %>%
  add_basemap()

if (interactive()) deck

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