Intersecting Points and Polygons in R

前端 未结 3 655
感动是毒
感动是毒 2020-12-10 03:30

I am working with shapefiles in R, one is point.shp the other is a polygon.shp. Now, I would like to intersect the points with the polygon, meaning that all

3条回答
  •  旧巷少年郎
    2020-12-10 03:56

    You do this in one line with point.in.poly fom spatialEco package.

    library(spatialEco)
    
    new_shape <- point.in.poly(pts, polys)
    

    from the documentation: point.in.poly "intersects point and polygon feature classes and adds polygon attributes to points".

提交回复
热议问题