Learn R Programming

rangeBuilder (version 2.1)

coordError: Coordinate error

Description

Calculates the potential error in coordinates due to lack of coordinate precision.

Usage

coordError(coords, nthreads = 1)

Value

Returns a vector of coordinate error in meters.

Arguments

coords

longitude and latitude in decimal degrees, either as a long/lat vector, or as a 2-column table. Can be either as numeric or character format

nthreads

number of threads to use for parallelization of the function. The R package parallel must be loaded for nthreads > 1.

Author

Pascal Title

Details

This function assumes that the true precision of the coordinates is equivalent to the greatest number of decimals in either the longitude or latitude that are not trailing zeroes. In other words:
(-130.45670, 45.53000) is interpreted as (-130.4567, 45.5300)
(-130.20000, 45.50000) is interpreted as (-130.2, 45.5)

If we use (-130.45670, 45.53000) as an example, these coordinates are interpreted as (-130.4567, 45.5300) and the greatest possible error is inferred as two endpoints: (-130.45670, 45.53000) and (-130.45679, 45.53009)

The distance between these two is then calculated and returned.

Examples

Run this code
data(crotalus)

xy <- crotalus[1:100, c('decimallongitude','decimallatitude')]

coordError(xy)

Run the code above in your browser using DataLab