Adds mesh surfaces from height map images

  layer_id = NULL,
  texture = NULL,
  elevation_decoder = c(1, 0, 0, 0),
  bounds = NULL,
  max_error = 4,
  update_view = TRUE,
  focus_layer = FALSE



a mapdeck map object


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


Image URL that encodes height data. When elevation_data is a URL template, i.e. a string containing 'x' and 'y', it loads terrain tiles on demand and renders a mesh for each tile. If elevation_data is an absolute URL, as ingle mesh is used, and the bounds argument is required to position it into the world space.


Image URL to use as the texture


Four value used to convert a pixel to elevation in metres. The values correspond to rScale, gScale, bScale, offset. See details


Four values ( c(left, bottom, right, top) . bounds of the image to fit in x,y coordinates into. left and right referes to the world longitude/x at the corresponding side of the image. top and bottom refers to the world latitude/y at the corresponding side of the image. Must be supplied when using non-tiled elevation_data


Martini error tolerance in metres, smaller number results in more detailed mesh.


logical indicating if the map should update the bounds to include this 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].


# \donttest{ set_token( "MAPBOX_TOKEN" ) ## Digital elevation model from elevation <- '' texture <- '' 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 )
#> terrain is an experimental layer and the function may change without warning
# }