Description Usage Arguments Details Value Author(s) See Also Examples
This is a general function to calculate the distance on Earth between a
target location and all points in a field of coordinates. It provides a
straighforward interface to the function distGeo
from package geosphere
.
1 | GetDistance(lat0, lon0, lat, lon, get.nearest = FALSE, verbose = FALSE)
|
lat0 |
numeric vector of length 1 with the latitude (in degree) of the target location relative to which distances are to be calculated. |
lon0 |
numeric vector of length 1 with the longitude (in degree) of the target location. |
lat |
numeric vector of latitudes (in degree) of the positions for which distances from the target position are to be calculated. |
lon |
numeric vector of longitudes (in degree) of the positions for
which distances from the target position are to be calculated. Must have the
same length as |
get.nearest |
logical; specify whether the given 'lat0' - 'lon0' pair
shall be used _as is_ as the target location ( |
verbose |
logical; if |
This is a wrapper function whose purpose it is to provide a straighforward
interface to the function distGeo
; this includes:
direct input of latitude/longitude values which are then shaped into
the appropriate structure for distGeo
;
longitude values are automatically confined to [-180, 180] as needed by
distGeo
;
if required, one can select the point closest to the target location as the reference for the distance calculations.
Numeric vector of the same length as lat
with the distances
in km from the target location.
Thomas Münch
MinimizeSpherical
;
GetDistanceField
;
https://github.com/EarthSystemDiagnostics/pfields
1 2 3 4 5 6 7 8 9 10 11 | # some coordinates
lat0 <- -75
lon0 <- 0
lat <- seq(-74, -80, -2)
lon <- seq(-2, 7, 3)
d <- GetDistance(lat0, lon0, lat, lon, verbose = TRUE)
range(d)
d <- GetDistance(lat0, lon0, lat, lon, get.nearest = TRUE, verbose = TRUE)
range(d)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.