SDraw (version 2.1.8)

voronoi.polygons: Calculate Voronoi polygons for a set of points

Description

Calculate Voronoi polygons (or tessellations) from a SpatialPoints* object

Usage

voronoi.polygons(x, bounding.polygon)

Arguments

x

A SpatialPoints or SpatialPointsDataFrame object

bounding.polygon

If present, this is a SpatialPolygons* object specifying the bounding polygon(s) for the Voronoi polygons. If present, the Voronoi polygons from points in x are clipped to the outside bounding polygon of bounding.polygon. The outside bounding polygon is the union of all polygons in bounding.polygon. If this is not present, the Voronoi polygons extend to a rectangle outside the range of the input points in all directions by 10 percent.

Value

A SpatialPolygonsDataFrame containing the Voronoi polygons (or tessellations) surrounding the points in x. Attributes of the output polygons are:

  • x : the horizontal coordinate of the tessellation's defining point

  • y : the vertical coordinate of the tessellation's defining point

  • area : area of tessellation, in units of x's projection.

Details

This is a convenience routine for the deldir function. The hard work, computing the Voronoi polygons, is done by the deldir::deldir and deldir::tile.list functions. See documentation for those functions for details of computations.

This function is convenient because it takes a SpatialPoints* object and returns a Spatial Polygons DataFrame object.

Examples

Run this code
# NOT RUN {
# Triangular grid inside a set of polygons
WA.samp <- sss.polygon(WA,100,triangular=TRUE) 

# Voronoi polygons of triangular grid 
WA.tess <- voronoi.polygons(WA.samp)

# Plot 
plot(WA)
plot(WA.tess, add=TRUE, col=rainbow(length(WA.samp)))
plot(WA.samp, add=TRUE, pch=16)

# One way to measure spatial balance: 
# Compare variance of Voronoi polygons to same sized 
# SRS sample.  
WA.bas <- bas.polygon(WA, 100)
WA.srs <- srs.polygon(WA, 100)
WA.bas.tess <- voronoi.polygons(WA.bas)
WA.srs.tess <- voronoi.polygons(WA.srs)
rel.balance <- var(WA.bas.tess$area)/var(WA.srs.tess$area)

# }

Run the code above in your browser using DataLab