Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. CountPointsInPolygons <- function(pts, polygons){
  2. countPts = c()
  3. for (i in 1:nrow(polygons)) {
  4. polySelect <- polygons[i,]
  5. pts2 <- st_intersection(pts, polySelect)
  6. countPts[i] = nrow(pts2)
  7.  
  8. }
  9.  
  10. return(cbind(polygons,countPts))
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement