gis - Spatial join in R -
i have 2 shapefiles—let’s call them shp1.shp , shp2.shp—and want create new shapefile of overlaps between two.
essentially, i'm trying determine geographies shp1 fall within shp2. shp1 polygons contain shp2 polygons, , shp2 polygons fall within multiple shp1 polygons.
if start
library(sp) large_list <- over(shp1,shp2, returnlist = true)
that gets me large list of shared geographies. how take list , use spatial join, , create new shapefile?
i'm relatively new r (especially gis) , appreciated.
you might find answer in function intersect
, package raster
library(raster) newshape <- intersect(shape1, shape2)