I would like to calculate the intersected area between a shape file and a fishnet grid.
Therefore, I use this approach (in a Python 3.7 environment):
import geopandas as gpd
fnet = gpd.read_file("foo/bar/fnet.shp")
shapes = gpd.read_file("foo/bar/shapes.shp")
geom_fnet = [x for x in fnet.geometry]
geom_shapes = [x for x in shapes.geometry]
intersections = []
for i, geolist1 in enumerate(geom_fnet):
for j, geolist2 in enumerate(geom_shapes):
if geolist1.intersects(geolist2):
intersections.append((i, (geolist1.intersection(geolist2).area/geolist1.area)))
# next steps of analysis
The fishnet has a large number of tiles and I would like to use an approach faster than a for loop. Any suggestions?