I have a list of polygons (and multi-polygons) named p_1, p_2, ..., p_n. And I would like to obtain the area in which they all intersect. As st_intersection() does not accept lists as arguments, I tried the following three approaches. None of them provides a satisfactory solution, which is why I am looking for alternative, more efficient techniques.
(i) I could loop through the list
for(i in P) p_1 <- st_intersection(p_1, i)
where P is a list containing polygons p_2 to p_n. But that is rather slow.
(ii) A do.call() approach, i.e.
p <- do.call(st_intersection, P)
where P is a list of polygons p_1 to p_n, only computes the intersection between the first two polygons in the list.
(iii) I could combine the polygons into one sf object and then run st_intersection():
p <- do.call(c, P) %>%
st_sf() %>%
st_intersection()
It works but is slow. Presumeably because it also derives a lot of other polygons apart from the common intersection of all polygons in P.
None of the three approaches provides a satisfactory solution. Looping through a hierarchy of pairwise comparisons in a parallelized framework might be faster. However, I assume there to be a simpler and more efficient solution than that.
Any comments and suggestions are welcome.
A note to the person who closed this question yesterday: do not close this question. Comment or send me a private message, if you personally have a problem with it. But do not close it.

