get_dem: Gets raster of elevations

View source: R/datatools.R

get_demR Documentation

Gets raster of elevations

Description

Several web services provide access to raster elevations. This function provides access to the Registry of Open Data on AWS to retrieve a raster object of elevations.

Usage

get_dem(r = NA, lat, long, resolution = 30, zmin = 0, xdims = 200, ydims = 200)

Arguments

r

optional raster object covering the location for which elevations are required

lat

the latitude (in decimal degrees) of the location for which elevations are required. Not used if r is a raster.

long

the longitude (in decimal degrees) of the location for which elevations are required. Not used if r is a raster

resolution

the resolution (in metres) of the required dem (see details).

zmin

assumed sea-level height. Values below this are set to zmin.

xdims

optional numeric value specifying the number of longitudinal grid cells

ydims

optional numeric value specifying the number of latitudinal grid cells

Details

Currently, get_dem utilises the Amazon Web Services (AWS) (https://aws.amazon.com/public-datasets/terrain/) to retrieve dems. The spatial resolution of the data available vary by location (see https://mapzen.com/documentation/terrain-tiles/data-sources/ for details and https://github.com/tilezen/joerd/blob/master/docs/images/footprints-preview.png for a map showing the resolution of data available for different parts of the globe). Global coverage is ~30m resolution and if the resolution of data requested is higher than that available, elevations are derived by interpolation. If r is unspecified, then lat and long are used to retrieve a xdims x ydims cell raster centred on lat and long. Bathymetry is also returned automatically form AWS, so zmin allows the user to specify a sea-level height. Elevations below zmin are set at zmin. For use with microclima the returned raster has a Mercator Coordinate Reference System if the latitude specified by lat is between 80 degrees S and 84 degrees N. In polar regions WGS 84 / NSIDC Sea Ice Polar Stereographic projections are used. X, y and Z units are all in metres. If r is specified, the Coordinate Reference System of r is used.

Value

a raster object of elevations in metres.

Examples

library(raster)
dem50m <- get_dem(dtm100m, resolution = 50)
plot(dem50m) # 50m raster, OSGB projection system

dem5m <- get_dem(lat = 49.97, long = -5.22, resolution = 5)
plot(dem5m) # 5m raster, Mercator projection system

ilyamaclean/microclima documentation built on Oct. 31, 2023, 11:41 p.m.