View source: R/geom_sugarbag.R
infer_focal_points | R Documentation |
From a given set of (long, lat) coordinates, return the coordinate that is the 'focal point'.
infer_focal_points(centroids)
centroids |
A data frame with three columns: |
The 'focal point' coordinate is defined as the coordinate with the smallest total distance between it and its three closest other coordinates.
A dataframe with longitude
and latitude
columns.
The output dataframe has one row, corresponding to the 'focal point' row.
centroids <- tibble::tribble(
~sf_id, ~longitude, ~latitude,
1L, 143.733882205026, -37.3749816911681,
2L, 144.092833347828, -36.5994048331978,
3L, 144.126090989656, -38.110623159732,
4L, 146.418433326656, -36.7767887044158,
5L, 147.436575203924, -37.7245209900909,
6L, 144.964502395924, -37.8001310712579,
7L, 145.104879082048, -37.8047905740117,
8L, 145.063768728334, -37.9503253274278,
9L, 145.169211500636, -37.5206187637749,
10L, 144.745689372755, -37.4757934330461,
11L, 145.505990121285, -37.7596168112236,
12L, 145.468024958887, -38.0731739302227,
13L, 144.624846316441, -37.776375592293,
14L, 145.056546632905, -38.310243349317,
15L, 142.235170269284, -35.8606656849638,
16L, 145.168411414665, -36.2522733040558,
17L, 142.377470204542, -37.9751565676334
)
# infer_focal_points(centroids)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.