I want to select only the raster files that overlap or intersect my AOI. I have a list of 900 raster files, and I calculate their footprints. Besides, I have my AOI.

Both, the footprints and the AOI are GeoDataFrames. I have troubles constructing my if statement. How can I check if two GeoDataFrames intersect with GeoPandas?

intersect_footprints = []

AOI = load_vector("AOI.geojson")
footprint = import_files("footprints.geojson")

if footprint["geometry"].intersects(AOI["geometry"]):

I have an error:

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

  • files_path is the path of the raster file. I want to save in the list only the paths of the rasters that intersect my AOI Nov 3, 2022 at 11:38

1 Answer 1


Use the spatial join:

import geopandas as gpd

extents = gpd.read_file(r"C:\GIS\temp\extents.shp")
aoi = gpd.read_file(r"C:\GIS\data\testdata\aoi.shp")
intersecting = gpd.sjoin(left_df=extents, right_df=aoi, how="inner")

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.