Skip to main content
1 of 2
Bera
  • 77.8k
  • 14
  • 78
  • 188

You can join them, then select the rows which are not in the join.

Find the features in df that are not intersecting df2:

import geopandas as gpd

df = gpd.read_file(r"C:/GIS/data/Bakgrundskartor/Topografi_250/data/mark_sverige.gpkg", layer="sankmark")
df["tempid"] = range(0, df.shape[0]) #Create an id column

df2 = gpd.read_file(r"C:/GIS/data/Bakgrundskartor/Topografi_250/data/naturvard_sverige.gpkg", layer="skyddadnatur")

joined = gpd.sjoin(left_df=df, right_df=df2, how="inner", predicate="intersects") #Find the intersecting polygons

nonintersecting = df.loc[~df["tempid"].isin(joined["tempid"])] #Select the ids in df, that are not in the spatial join output

enter image description here

Bera
  • 77.8k
  • 14
  • 78
  • 188