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
st_intersect
function insf
. There'sst_intersects
, which tests for intersection, and there'sst_intersection
, which seems to do exactly what you want. – Spacedman Oct 30 '20 at 17:50st_union
on the intersect feature before the intersection. But it is odd that there is no command to do this directly. – sfetan Nov 3 '20 at 8:21