Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CountPointsInPolygons <- function(pts, polygons){
- countPts = c()
- for (i in 1:nrow(polygons)) {
- polySelect <- polygons[i,]
- pts2 <- st_intersection(pts, polySelect)
- countPts[i] = nrow(pts2)
- }
- return(cbind(polygons,countPts))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement