Description Usage Arguments Details Examples
View source: R/map_layer_terrain.R
Adds mesh surfaces from height map images
1 2 3 4 5 6 7 8 9 10 11 |
map |
a mapdeck map object |
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 |
elevation_data |
Image URL that encodes height data. When |
texture |
Image URL to use as the texture |
elevation_decoder |
Four value used to convert a pixel to elevation in metres. The values correspond to rScale, gScale, bScale, offset. See details |
bounds |
Four values ( |
max_error |
Martini error tolerance in metres, smaller number results in more detailed mesh. |
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 |
The elevation_decoder
contains four values representing
rScale - Multiplier of the red channel
gScale - Multiplier of the green channel
bScale - Multiplier of the blue channel
offset - translation of the sum
Each colour channel is a number between [0, 255].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | set_token( "MAPBOX_TOKEN" )
## Digital elevation model from https://www.usgs.gov/
elevation <- 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/terrain.png'
texture <- 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/terrain-mask.png'
bounds <- c(-122.5233, 37.6493, -122.3566, 37.8159)
mapdeck() %>%
add_terrain(
, elevation_data = elevation
, elevation_decoder = c(1,0,0,0)
, texture = texture
, bounds = bounds
, max_error = 1
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.