elevation_correct: Elevation correction

Description Usage Arguments Details Value Examples

Description

Extracts (reliable) elevation data from raster "alt" dataset, given positional coordinates (lon,lat). Requires the raster package to be installed. Essentially a wrapper for getData and extract.

Usage

1
elevation_correct(lon, lat, country)

Arguments

lon, lat

numeric vectors (of the same length) giving positional coordinates in units of (decimal) degrees.

country

character; the three letter ISO code for the country in which the lon,lat data were collected. See raster::getData("ISO3").

Details

Note that raster data may need to be downloaded, and hence an internet connection will be required if these files do not already exist in the working directory.

Also note that elevation data are interpolated from the values of the four nearest raster cells. See the method argument in extract.

Value

A numeric vector of the same length as lon,lat of elevation values (i.e. metres above sea level).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
data(chaingang)

# Show the original elevation profile...
plot(elevation.m ~ distance.km, type = "l", data = chaingang)

chaingang <- transform(chaingang,
                       elev.new = elevation_correct(lon, lat, "GBR"))

lines(elev.new ~ distance.km, col = "red", data = chaingang)

## End(Not run)

jmackie4/elpatron documentation built on May 19, 2019, 12:49 p.m.