add_h3 {mapdeck} | R Documentation |
Add h3
Description
The h3 layer renders hexagons from the H3 geospatial indexing system. To use
this layer you must specify libraries = "h3"
within the mapdeck()
call. See examples.
Usage
add_h3(
map,
data = get_map_data(map),
hexagon = NULL,
stroke_colour = NULL,
stroke_width = NULL,
stroke_opacity = NULL,
fill_colour = NULL,
fill_opacity = NULL,
elevation = NULL,
tooltip = NULL,
auto_highlight = FALSE,
elevation_scale = 1,
highlight_colour = "#AAFFFFFF",
light_settings = list(),
layer_id = NULL,
id = NULL,
palette = "viridis",
na_colour = "#808080FF",
legend = FALSE,
legend_options = NULL,
legend_format = NULL,
update_view = TRUE,
focus_layer = FALSE,
transitions = NULL
)
Arguments
map |
a mapdeck map object |
data |
data to be used in the layer. All coordinates are expected to be EPSG:4326 (WGS 84) coordinate system |
hexagon |
column of |
stroke_colour |
variable of |
stroke_width |
width of the stroke in meters. If used, |
stroke_opacity |
Either a string specifying the column of |
fill_colour |
column of |
fill_opacity |
Either a string specifying the column of |
elevation |
the height the polygon extrudes from the map. Only available if neither
|
tooltip |
variable of |
auto_highlight |
logical indicating if the shape under the mouse should auto-highlight |
elevation_scale |
elevation multiplier. |
highlight_colour |
hex string colour to use for highlighting. Must contain the alpha component. |
light_settings |
list of light setting parameters. See light_settings |
layer_id |
single value specifying an id for the layer. Use this value to distinguish between shape layers of the same type. Layers with the same id are likely to conflict and not plot correctly |
id |
an id value in |
palette |
string or matrix. String will be one of |
na_colour |
hex string colour to use for NA values |
legend |
either a logical indiciating if the legend(s) should be displayed, or a named list indicating which colour attributes should be included in the legend. |
legend_options |
A list of options for controlling the legend. |
legend_format |
A list containing functions to apply to legend values. See section legend |
update_view |
logical indicating if the map should update the bounds to include this layer |
focus_layer |
logical indicating if the map should update the bounds to only include this layer |
transitions |
list specifying the duration of transitions. |
Details
add_h3
supports a data.frame with a column of h3 indexes
transitions
The transitions argument lets you specify the time it will take for the shapes to transition from one state to the next. Only works in an interactive environment (Shiny) and on WebGL-2 supported browsers and hardware.
The time is in milliseconds
Available transitions for h3
list( elevation = 0 colour = 0 )
Examples
## Not run:
## You need a valid access token from Mapbox
key <- 'abc'
set_token( key )
mapdeck(
style = mapdeck_style("dark")
, location = c(0, 51.3)
, zoom = 10
, pitch = 60
, libraries = "h3"
) %>%
add_h3(
data = road_safety
, hexagon = "hex"
, fill_colour = "count"
, auto_highlight = TRUE
, legend = TRUE
, elevation = "count"
, elevation_scale = 20
, palette = colourvalues::get_palette("inferno")
)
## End(Not run)