Skip to content
Prev 11242 / 29559 Next

loop through polygons for point in polygon function

On Wed, 16 Mar 2011, david depew wrote:

            
Why do you need to extract the polygons?

pts <- spsample(nc.sids, n=5000, type="random")
plot(nc.sids, axes=TRUE)
points(pts, pch=".")
out <- over(xx, pts)

where out is a vector with a count for each Polygons object in nc.sids. 
You will have more work to do if you need to count in each Polygon object 
within each Polygons object, but that would imply that the input data need 
reorganising.

Hope this helps,

Roger