View source: R/accessory_geo.R
geoDist | R Documentation |
Calculate the distances between geographical coordinates, taking
into account that Earth is an oblate spheroid. By default, distances are
returned in kilometers. This function is adapted from the function
rdist.earth()
from package fields.
geoDist(lon, lat, radius = 6371)
lon |
numerical. Longitude in decimal degrees |
lat |
numerical. Latitude in decimal degrees |
radius |
numerical. Radius in kilometers to find spherical distances. Default to 6371 km. (If 1 distances are returned in radians) |
A distance matrix
Renato A. F. de Lima
Nychka, D., Furrer, R., Paige, J., Sain, S. (2017). fields: Tools for spatial data. R package version 11.6, <URL: https://github.com/NCAR/Fields>.
lon <- c(-47, -46, -47) lat <- c(-23, -24, -23.5) ## Not run: geoDist(lon, lat) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.