I try to clip shape "a" with shape "b". The result should be a polygon with the attributes and borders of "a" but cliped on the extent of "b". Basically a simple clip as we know it from ArcMap or QField.
Now I want to use the sf package
in R. But all the suggestions I find tell me to use““st_intersection“`.
But this is not actually a clip because it will result in a layer containing also the borders of "b".
a<-st_read("a.shp")
be<-st_read("b.shp"
Clip1<- st_intersection(a,b)
What I want
what st_intersection does
Best Answer
This all works for me:
The
output
object has the attributes from the underlyinginput
object: