Loop to check multiple polygons overlap in r SF package

Viewed 1540

I have a set of polygons which can overlap each other. I can find intersection by comparing 1 by 1 polygon each time step by step. by using st_intersection(x,y) The problem is my data contains many polygons and I am prefer to make a loop and include the iteration of polygons which has overall intersect area of each of the intersections. for example I need to check condition where one polygons S intersect with n numbers of (p1,p2,p3...)polygons like below and get the sum of overlap of areas like shaded area in yellow or is there any pre-defined function to do this in r:

st_intersection(S, p1)
st_intersection(S, p2)
st_intersection(S, p3)

enter image description here

0 Answers
Related