Learn R Programming

geoviz (version 0.2.2)

mapbox_dem: Gets Digital Elevation Model (DEM) data from 'mapbox'

Description

Gets Digital Elevation Model (DEM) data from 'mapbox'

Usage

mapbox_dem(lat, long, square_km, width_buffer = 1, max_tiles = 10, api_key)

Arguments

lat

WGS84 latitude. Either a single point to use as the centre for a square_km sized raster, or a vector of track points

long

WGS84 longitude. Either a single point to use as the centre for a square_km sized raster, or a vector of track points

square_km

length of one edge the required square area, in km. Ignored if lat and long have length > 1

width_buffer

If lat and long have length > 1, used as buffer distance around the provided points in km

max_tiles

maximum number of map tiles to request. More tiles will give higher resolution scenes but take longer to download. Note that very small numbers of tiles may result in a scene that is not square.

api_key

'Mapbox' API key

Value

a raster with values corresponding to terrain height in metres

Examples

Run this code
# NOT RUN {
#NOT RUN
#mapbox_dem() requires a 'mapbox' API key

mapbox_key = "YOUR_MAPBOX_API_KEY"

lat = 54.4502651
long = -3.1767946
square_km = 20

dem <- mapbox_dem(lat, long, square_km, api_key = mapbox_key)

# }

Run the code above in your browser using DataLab