minDist: Minimum Distance between Coordinates

View source: R/accessory_geo.R

minDistR Documentation

Minimum Distance between Coordinates

Description

The function calculates the minimum distance between coordinates or the coordinates which are below a minimum threshold distance.

Usage

minDist(lon, lat, min.dist = 0.001, output = NULL)

Arguments

lon

numerical. Longitude in decimal degrees

lat

numerical. Latitude in decimal degrees

min.dist

numerical. Minimum threshold distance (in kilometers) to be used to detect duplicated coordinates. Default to 1 meter.

output

character. The type of information that should be returned (see Details)

Details

The argument output controls the type of output that should be returned:

  • 'flag': a TRUE/FALSE vector indicating the coordinates which are below min.dist from other coordinates.

  • 'group': the position of the first coordinate representing a group of duplicated coordinates.

  • 'dist': the distance of each coordinate to the closest coordinated.

Value

A vector of TRUE/FALSE or of minimum distances in kilometers.

Author(s)

Renato A. F. de Lima

See Also

geoDist

Examples


lat <- c(-23.475389, -23.475389, -23.475390, -23.475389)
lon <- c(-47.123768, -47.123768, -47.123768, -47.123868)

## Not run: 
minDist(lon, lat, output = 'group')
minDist(lon, lat, output = 'flag')
minDist(lon, lat, output = 'dist')

## End(Not run)


LimaRAF/plantR documentation built on Jan. 1, 2023, 10:18 a.m.