I have a large set S: List[Polygon]
(Shapely Polygon
s), and a mask: MultiPolygon
.
I want to filter out all of the polygons in S
that intersect with mask
.
I can write: S2 = [p for p in S if not mask.intersects(p)]
.
However, to speed things up I was wondering if there was a way to do it without the list comprehension and as a single operation so that the internal Shapely/GEOS search may be done more efficiently. Essentially like running a mask.intersection(MultiPolygon(S))
but without the added cost of getting the actual intersections of each sub-polygon (and while maintaining the original input order).
Ideally it would return something like a List[bool]
indicating the results per sub-polygon in S
.