I have two Shapely geometries:
- 1 MultiPoint instance named
- 1 Polygon instance named
I can compute their
multipoints.intersection(polyon) which results in all points that fall inside the polygon.
I'd like to compute their 'non intersection' to get the points which doesn't fall inside the polygon but there is no such:
I can use the
multipoints.symmetric_difference(polyon) but this gives a geometry collection with the points I'm searching for + the whole initial polygon (for which I don't care).
I need to have that done in either one line, or a function that can be plugged into a lambda function for applying it all over the rows of a
MultiPoint geometry instances in each row.
Notice; I can use the boolean result of an
intersects inside my lambda but it doesn't seem to work when I apply it on a
gdf['nonintersectingpoints'] = gdf['my_multipoint_column'].apply( lambda multipoints: multipoints if not multipoints.intersects(polygon) \ else None )
None every where).