vor_sp {ptools}R Documentation

Voronoi tesselation from input points

Description

Given an outline and feature points, calculates Voronoi areas

Usage

vor_sp(outline, feat)

Arguments

outline

object that can be coerced to a spatstat window via as.owin (so SpatialPolygonDataFrame, SpatialPolygon, owin)

feat

A SpatialPointsDataFrame object (if duplicate X/Y coordinates will get errors)

Details

Outline should be a single polygon area. Uses spatstats dirichlet and window to compute the Voronoi tesselation. Will generate errors if feat has duplicate X/Y points. Useful to create areas for other functions, such as dcount_xy() or count_xy(). Common spatial unit of analysis used in crime research when using points (e.g. intersections and street midpoints).

Value

A SpatialPolygonsDataFrame object, including the dataframe for all the info in the orignal feat@data dataframe.

References

Wheeler, A. P. (2018). The effect of 311 calls for service on crime in DC at microplaces. Crime & Delinquency, 64(14), 1882-1903.

Wheeler, A. P. (2019). Quantifying the local and spatial effects of alcohol outlets on crime. Crime & Delinquency, 65(6), 845-871.

Examples


library(sp) # for sample/coordinates
data(nyc_bor)
nyc_buff <- buff_sp(nyc_bor,50000)
po <- sp::spsample(nyc_buff,20,'hexagonal')
po$id <- 1:dim(coordinates(po))[1] # turns into SpatialDataFrame
vo <- vor_sp(nyc_buff,po)
plot(vo)
plot(nyc_buff,border='RED',lwd=3, add=TRUE)



[Package ptools version 2.0.0 Index]