Point in Polygon Counts | R Documentation |
Given a set of points, and a set of polygons, computes the number of points in each polygon.
poly.counts(pts, polys)
pts |
A |
polys |
A |
A list of integers of the same length as the number of polygons in polys
, giving the number of points from pts
.
Chris Brunsdon, Binbin Lu
# Data for New Haven to use in example
data(newhaven)
# How many breaches of peace in each census block?
n.breach = poly.counts(breach,blocks)
blocks@data$Count.per <- n.breach/poly.areas(blocks)
# Compute densities and map them
choropleth(blocks,"Count.per")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.