Skip to contents

Terrain Layer

Usage

add_terrain_layer(
  rdeck,
  ...,
  id = uuid::UUIDgenerate(),
  name = "TerrainLayer",
  group_name = NULL,
  data = NULL,
  visible = TRUE,
  pickable = FALSE,
  opacity = 1,
  wrap_longitude = FALSE,
  position_format = "XY",
  color_format = "RGBA",
  auto_highlight = FALSE,
  highlight_color = "#00008080",
  get_tile_data = NULL,
  extent = NULL,
  tile_size = 512,
  max_zoom = NULL,
  min_zoom = 0,
  max_cache_size = NULL,
  max_cache_byte_size = NULL,
  refinement_strategy = "best-available",
  z_range = NULL,
  max_requests = 6,
  zoom_offset = 0,
  elevation_data = NULL,
  texture = NULL,
  mesh_max_error = 4,
  bounds = NULL,
  color = "#ffffff",
  elevation_decoder = list(rScaler = 1, gScaler = 0, bScaler = 0, offset = 0),
  worker_url = NULL,
  wireframe = FALSE,
  material = TRUE,
  blending_mode = "normal",
  visibility_toggle = TRUE,
  tooltip = NULL
)

update_terrain_layer(
  rdeck,
  ...,
  id,
  name = cur_value(),
  group_name = cur_value(),
  data = cur_value(),
  visible = cur_value(),
  pickable = cur_value(),
  opacity = cur_value(),
  wrap_longitude = cur_value(),
  position_format = cur_value(),
  color_format = cur_value(),
  auto_highlight = cur_value(),
  highlight_color = cur_value(),
  get_tile_data = cur_value(),
  extent = cur_value(),
  tile_size = cur_value(),
  max_zoom = cur_value(),
  min_zoom = cur_value(),
  max_cache_size = cur_value(),
  max_cache_byte_size = cur_value(),
  refinement_strategy = cur_value(),
  z_range = cur_value(),
  max_requests = cur_value(),
  zoom_offset = cur_value(),
  elevation_data = cur_value(),
  texture = cur_value(),
  mesh_max_error = cur_value(),
  bounds = cur_value(),
  color = cur_value(),
  elevation_decoder = cur_value(),
  worker_url = cur_value(),
  wireframe = cur_value(),
  material = cur_value(),
  blending_mode = cur_value(),
  visibility_toggle = cur_value(),
  tooltip = cur_value()
)

Arguments

rdeck

<rdeck | rdeck_proxy> An rdeck map instance.

...

Additional parameters that will be forwarded to deck.gl javascript without validation nor processing. All dots must be named and will be camelCased when serialised. A warning is raised when dots are used, warning class rdeck_dots_nonempty.

id

<string> The layer's identifier must be unique for among all layers of the same type for a map. Defaults to uuid::UUIDgenerate(), but should be explicitly defined for updatable layers in a shiny application.

name

<string> Identifies the layer on tooltips and legends. It does not need to be unique, but should be brief. Defaults to the deck.gl class name for the layer.

group_name

<string> Defines the group that this layer belongs to. Currently only effective on the layer selector, if visibility_toggle = TRUE.

data

<data.frame | sf | string> The layer's data. Data frames and sf objects will contain all columns that are referenced by the layer's accessors. Strings will be interpreted as a URL and data will be retrieved dynamically in the browser.

visible

<boolean> Determines whether the layer is visible or not; also determines whether any legend elements for the layer will be displayed.

pickable

<boolean> Determines if the layer responds to pointer / touch events.

opacity

<number> Determines the layer's opacity.

wrap_longitude

<boolean> Normalises geometry longitudes.

position_format

<"XY" | "XYZ"> Determines whether each coordinate has two (XY) or three (XYZ) elements.

color_format

<"RGB" | "RGBA"> Determines whether the alpha channel of the colours will be ignored by accessors, making all colours opaque.

auto_highlight

<boolean> When TRUE, the current object hovered by the cursor is highlighted by highlight_color.

highlight_color

<accessor | scale | color> When auto_highlight and pickable are enabled, highlight_color determines the colour of the currently highlighted object. If a single colour value is supplied, that colour will be used to highlight all objects in the layer. Per-object highlighting is achieved with a colour scale, or a tidy-eval column of colours.

get_tile_data

<JS> retrieves the data of each tile. See deck.gl getTileData.

extent

<c(min_x, min_y, max_x, max_y)> Tiles in this bounding box will be rendered at min_zoom, when zoomed out below min_zoom.

tile_size

<number> A power of 2 that is the pixel dimensions of the tile.

max_zoom

<number> Tiles above this zoom level are not shown. Defaults to NULL.

min_zoom

<number> Tiles below this zoom level are not shown. Defaults to 0.

max_cache_size

<number> Maximum number of tiles that can be cached. Defaults to 5x the number of tiles in current viewport.

max_cache_byte_size

<number> Maximum memory used for caching tiles.

refinement_strategy

<"best-available" | "no-overlap" | "never"> How the tile layer refines visibility of tiles. Defaults to "best-available".

z_range

<c(min, max)> Array representing the range of heights in the tile.

max_requests

<number> Maximum number of concurrent HTTP requests across all specified tile provider domains. If a negative number is supplied no throttling occurs (HTTP/2 only).

zoom_offset

<int> The offset changes the zoom level at which the tiles are fetched.

elevation_data

url

texture

not yet supported.

mesh_max_error

number

bounds

<rct/st_bbox/wk-geometry> The bounds of the image to fit x,y coordinates into. Requires CRS EPSG:4326. Must be supplied when using non-tiled elevation data.

color

color

elevation_decoder

object

worker_url

string

wireframe

<boolean> If TRUE and extruded == TRUE, draw a line wireframe of the object. The outline will have horizontal lines closing the top and bottom polygons and vertical lines for each vertex of the polygon.

material

<boolean>

blending_mode

<"normal" | "additive" | "subtractive"> Sets the blending mode. Blending modes:

  • normal: Normal blending doesn't alter colours of overlapping objects.

  • additive: Additive blending adds colours of overlapping objects. Useful for highlighting dot density on dark maps.

  • subtractive: Subtractive blending darkens overlapping objects. Useful for highlighting dot density on light maps.

visibility_toggle

<boolean> Whether this layer will appear in the layer selector.

tooltip

<tooltip> Defines the columns (and their order) that will be displayed in the layer tooltip, if pickable == TRUE. Supports tidy-select if a data is a data.frame. Geometry columns are always removed.