mwVoronoi | R Documentation |
Calculate a multiplicatively-weighed Voronoi diagram, where distances are
divided by some per-observation weight. On planar an spherical topologies
all segments are circles and segments thereof (or straight lines if observations
with equal weights exist), with the radii of the circles corresponding to
\frac{r_e}{4}\left(\frac{w_p}{w_p + w_q}\right)
, with r_e
corresponding to earth's radius. The circle is positioned such that (1) it
encompasses the point of interest and (2) the point immediately between p
and q
lies at \ell_{pq} \left(\frac{w_p}{w_p + w_q}\right)
units away
from p
with \ell_{pq}
being the distance between p
and q, and
(3) oriented with this point normal to the geodesic between p
and q.
mwVoronoi(
xy,
w,
tolerance = 7,
prec = 100,
clip = NULL,
x = "lon",
y = "lat",
topology = "geoid",
a = 6378137,
f = 1/298.257223563,
pb = FALSE
)
xy |
Something coercible to a SpatVect points object and with at least
two observations. The point locations of interest. Units must be degrees longitude for
|
w |
A vector of equal length to xy. The weights corresponding to each point |
tolerance |
How many digits of the lonlat coordinates are kept (to avoid
floating point errors?). Default is |
prec |
How many segments does each ellipsoid contain? Default is
|
clip |
An object of class null, logical, or coercible to a SpatExtent.
Should the output polygons encompass the whole world (the default,
|
x |
A character vector indicating the column with 'x' coordinates. Ignored
if |
y |
A character vector indicating the column with 'y' coordinates. Ignored
if |
topology |
One of |
a |
Equatorial radius. Default is for WGS84. Ignored if |
f |
Ellipsoidal flattening. Default is for WGS84. Ignored if |
pb |
Logical. Should a progress bar be displayed?
Default is |
See also makeCatchment
A SpatVector containing the Voronoi polygons for each input observation
set.seed(3755)
# Create dummy observations
obs <- data.table(lon = runif(25, -180, 180),
lat = runif(25, -90, 90),
N = runif(25, 0, 100))
mwv <- mwVoronoi(obs[,1:2], w = obs$N)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.