R/table_findAdjacentDistances.R
table_findAdjacentDistances.Rd
Calculate distances between all locations within a known
locations table and return a tibble with the row indices and separation
distances of those records separated by less than distanceThreshold
meters.
It is useful when working with new metadata tables to identify ajacent
locations early on so that decisions can be made about the appropriateness
of the specified distanceThreshold
.
table_findAdjacentDistances( locationTbl = NULL, distanceThreshold = NULL, measure = "geodesic" )
locationTbl | Tibble of known locations. |
---|---|
distanceThreshold | Distance in meters. |
measure | One of "haversine" "vincenty", "geodesic", or "cheap"
specifying desired method of geodesic distance calculation. See |
Tibble of row indices and distances for those locations separated by
less than distanceThreshold
meters.
The measure "cheap"
may be used to speed things up depending on
the spatial scale being considered. Distances calculated with
measure = "cheap"
will vary by a few meters compared with those
calculated using measure = "geodesic"
.
library(MazamaLocationUtils) meta <- wa_airfire_meta # Any locations closer than 2 km? table_findAdjacentDistances(meta, distanceThreshold = 2000)#> # A tibble: 1 × 3 #> row1 row2 distance #> <int> <int> <dbl> #> 1 72 73 461.# How about 4 km? table_findAdjacentDistances(meta, distanceThreshold = 4000)#> # A tibble: 4 × 3 #> row1 row2 distance #> <int> <int> <dbl> #> 1 72 73 461. #> 2 1 2 2412. #> 3 2 32 3329. #> 4 1 42 3628.