Learn R Programming

mapgl (version 0.1.3)

set_terrain: Set terrain properties on a map

Description

Set terrain properties on a map

Usage

set_terrain(map, source, exaggeration = 1)

Value

The modified map object with the terrain settings applied.

Arguments

map

A map object created by the mapboxgl or maplibre functions.

source

The ID of the raster DEM source.

exaggeration

The terrain exaggeration factor.

Examples

Run this code
if (FALSE) {
map <- mapboxgl(style = "mapbox://styles/mapbox/satellite-streets-v12",
                center = c(-114.26608, 32.7213), zoom = 14, pitch = 80, bearing = 41,
                access_token = "your_token_here")
map <- add_source(map, id = "mapbox-dem", type = "raster-dem",
                  url = "mapbox://mapbox.mapbox-terrain-dem-v1",
                  tileSize = 512, maxzoom = 14)
map <- set_terrain(map, source = "mapbox-dem", exaggeration = 1.5)
}

Run the code above in your browser using DataLab