I have two GeoPandas dataframes titre_polyG
and df
which I have intersected as follows:
titre_polyG
is as follows:
0 MULTIPOLYGON (((-7.64026 33.59134, -7.63996 33...
1 MULTIPOLYGON (((-7.63987 33.58992, -7.63988 33...
2 MULTIPOLYGON (((-7.63643 33.59023, -7.63670 33...
3 MULTIPOLYGON (((-7.63868 33.59040, -7.63874 33...
4 MULTIPOLYGON (((-7.63892 33.59003, -7.63903 33...
...
133 MULTIPOLYGON (((-7.63924 33.59013, -7.63933 33...
134 MULTIPOLYGON (((-7.63958 33.59210, -7.63939 33...
135 MULTIPOLYGON (((-7.63958 33.59210, -7.63939 33...
136 MULTIPOLYGON (((-7.63958 33.59210, -7.63939 33...
137 MULTIPOLYGON (((-7.63937 33.59163, -7.63937 33...
Name: geometry, Length: 138, dtype: geometry
df is as follows:
apt_psqm geometry
0 15010.000000 POLYGON ((-7.61096 33.55602, -7.61095 33.55602...
1 12675.000000 POLYGON ((-7.59432 33.53328, -7.59432 33.53328...
2 13810.000000 POLYGON ((-7.65112 33.52504, -7.65112 33.52504...
3 16070.000000 POLYGON ((-7.64377 33.54902, -7.64377 33.54902...
4 13930.000000 POLYGON ((-7.64605 33.52386, -7.64605 33.52387...
... ... ...
85 10732.000000 POLYGON ((-7.52905 33.61630, -7.52905 33.61630...
86 9900.000000 POLYGON ((-7.49753 33.59832, -7.49753 33.59832...
87 9170.000000 POLYGON ((-7.51582 33.59657, -7.51582 33.59657...
88 8509.166667 MULTIPOLYGON (((-7.55564 33.57855, -7.55563 33...
89 9495.280899 POLYGON ((-7.57822 33.56580, -7.57821 33.56580...
The code related to the intersection is below:
# iterate over each row in df and identify intersecting polygons
for index, row in df.iterrows():
match_poly = df[df.geometry.intersects(titre_polyG['geometry'])]
match_poly
shows the rows of df
where there is an intersection with titre_polyG
.
My aim is to find the row numbers in titre_polyG
where that intersection happens. titre_polyG
has 138 rows and if intersection happens for instance at row 1 and 60 then I need to find a way to display those numbers.
Any idea?