Learn R Programming

geosphere (version 1.2.1)

distm: Distance matrix

Description

Distance matrix of a set of points

Usage

distm(x, fun=distCosine)

Arguments

x
longitude/latitude of point(s). Can be a vector of two numbers, a matrix of 2 columns (first one is longitude, second is latitude) or a SpatialPoints* object
fun
A function to compute distances

Value

  • Matrix of distances

References

http://en.wikipedia.org/wiki/Great_circle_distance

See Also

distCosine, distHaversine, distVincentySphere, distVincentyEllipsoid

Examples

Run this code
distm(rbind(c(0,0),c(90,90),c(10,10),c(-120,-45)))

Run the code above in your browser using DataLab