sequential_dist: Calculate the sequential distances between sequential...

View source: R/slopes.R

sequential_distR Documentation

Calculate the sequential distances between sequential coordinate pairs

Description

Set lonlat to FALSE if you have projected data, e.g. with coordinates representing distance in meters, not degrees. Lonlat coodinates are assumed (lonlat = TRUE is the default).

Usage

sequential_dist(m, lonlat = TRUE)

Arguments

m

Matrix containing coordinates and elevations. The matrix should have three columns: x, y, and z, in that order. Typically these correspond to location in the West-East, South-North, and vertical elevation axes respectively. In data with geographic coordinates, Z values are assumed to be in metres. In data with projected coordinates, Z values are assumed to have the same units as the X and Y coordinates.

lonlat

Are the coordinates in lon/lat (geographic) coordinates? TRUE by default.

Value

A vector of distance values in meters if lonlat = TRUE or the map units of the input data if lonlat = FALSE between consecutive vertices.

Examples

x = c(0, 2, 3, 4, 5, 9)
y = c(0, 0, 0, 0, 0, 1)
m = cbind(x, y)
d = sequential_dist(m, lonlat = FALSE)
d
nrow(m)
length(d)

ITSLeeds/slopes documentation built on Oct. 13, 2024, 3:54 a.m.