Skip to contents

Calculate occurrence count, centroid coordinates, latitudinal range (degrees), great circle distance (km), mean pairwise distance (km), and summed minimum spanning tree length (km) for spatial point coordinates.

Usage

rangeSize(coords, crs = "epsg:4326")

Arguments

coords

2-column data.frame or matrix containing x- and y-coordinates, respectively (e.g. longitude and latitude).

crs

Coordinate reference system as a GDAL text string, EPSG code, or object of class crs. Default is latitude-longitude (EPSG:4326).

Value

A 1-row, 7-column matrix

Details

Coordinates and their distances are computed with respect to the original coordinate reference system if supplied, except in calculation of latitudinal range, for which projected coordinates are transformed to geodetic ones. If crs is unspecified, by default points are assumed to be given in latitude-longitude and distances are calculated with spherical geometry.

Duplicate coordinates will be removed. If a single unique point is supplied, all distance measures returned will be NA.

Examples

# generate 20 occurrences for a pseudo-species
# centred on Yellowstone National Park (latitude-longitude)
# normally distributed with a standard deviation ~110 km
set.seed(2)
x <- rnorm(20, 110.5885, 2)
y <- rnorm(20,  44.4280, 1)
pts <- cbind(x,y)

rangeSize(pts)
#>      nLoc centroidX centroidY latRange greatCircDist meanPairDist minSpanTree
#> [1,]   20  110.9828  44.44622 4.542526      697.9476     269.6437    1855.473