View source: R/layers_contour-layer.R
add_contour_layer | R Documentation |
The ContourLayer
renders contour lines for a given threshold and cell size.
Internally it implements Marching Squares algorithm to generate contour line segments
and feeds them into LineLayer
to render lines.
add_contour_layer( deckgl, data = NULL, properties = list(), ..., id = "contour-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/contour-layer
## @knitr contour-layer data("sf_bike_parking") contours <- list( use_contour_definition( threshold = 1, color = c(255, 0, 0), stroke_width = 2 ), use_contour_definition( threshold = 5, color = c(0, 255, 0), stroke_width = 3 ), use_contour_definition( threshold = 15, color = c(0, 0, 255), stroke_width = 5 ) ) properties <- list( contours = contours, cellSize = 200, elevationScale = 4, getPosition = ~lng + lat ) deck <- deckgl(zoom = 10.5, pitch = 30) %>% add_contour_layer(data = sf_bike_parking, properties = properties) %>% add_control("Contour Layer") %>% add_basemap() if (interactive()) deck
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.