arcdist: Geographical distance computations

Description Usage Arguments Value See Also Examples

View source: R/arcdist.R

Description

Computes distances between lat/lon data points.

Usage

1
arcdist(lat, lon, lat1 = NULL, lon1 = NULL, scale = "nmi")

Arguments

lat

Latitude of first coordinate or list with lat, lon of first coordinate.

lon

Longitude of first coordinate or list with lat, lon of second coordinate.

lat1,lon1

If lat and lon are vectors of lat,lon positions, then lat1 and lon1 must be given as the second set of positions.

scale

nmi returns value in nautical miles, any other value in kilometers

Value

A single vector of distances between pairs of points is returned

See Also

geoplot, geotext, selpos,

Examples

1
2
3
4
5
6
7
8
pos1 <- list(lat = c(65, 66), lon = c(-19, -20))
  pos2 <- list(lat = c(64, 65), lon = c(-19, -20))
  dists <- arcdist(pos1, pos2)         # pos1 and pos2 are lists of coordinates.
  lat <- c(65, 66)
  lon <- c(-19, -20)
  lat1 <- c(64, 65)
  lon1 <- c(-19, -20)
  dists <- arcdist(lat, lon, lat1, lon1) # Input in vector format.

geo documentation built on May 29, 2017, 5:36 p.m.