I have 2 data frames, let's say, df1
and df2
. I need to find df1
polygons that overlay with df2
(the green line), and remove them from main dataframe df1
.
I do not need to extract a overlaying part or create a new dataframe, I need to identify the ones which overlays in any cases and remove them. The result would be df1
with the removed polygons.
I tried to use GeoPandas intersect and overlay, however, could not find the solution. Both dataframes have the same coordinate system.
import pandas as pd
import geopandas as gpd
df1 = gpd.read_file(r'E:\...\dfs1.shp')
df2 = gpd.read_file(r'E:\...\dfs2.shp')
print(df1.crs, df1.crs)
res_intersection = gpd.overlay(df1, df2, how='intersection')
TypeError:
keep_geom_type
does not support None.
Best Answer
You can use spatial join: