jchristiaanse
jchristiaanse

Reputation: 113

Use GeoPandas / Shapely to find intersection area of polygons defined by latitude and longitude coordinates

I have two GeoDataFrames, left and right, with many polygons in them. Now I am trying to find the total intersection area of each polygon in left, with all polygons in right.

I've managed to get the indices of the intersecting polygons in right for each polygon in left using gpd.sjoin, so I compute the intersection area using:

area = left.iloc[i].geometry.intersection(right.iloc[idx].geometry).area

Where i and idx are the indices of the intersecting polygons in the two GDFs (let's assume the left poly only intersects with 1 poly in right). The problem is that the area value I get does not seem correct in any way, and I don't know what units it has. The CRS of both GeoDataFrames is EPSG:4326 so the standard WSG84 projection, and the polygon coordinates are defined in degrees latitude and longitude.

Does anyone know what units the computed area then has? Or does this not work and do I need to convert them to a different projection before computing the area?

Thanks for the help!

Upvotes: 4

Views: 1439

Answers (1)

jchristiaanse
jchristiaanse

Reputation: 113

I fixed it by using the EPSG:6933 projection instead, which is an area preserving map projection and returns the area in square metres (EPSG:4326 does not preserve areas, so is not suitable for area calculations). I could just change my GDF to this projection using

gdf.to_crs(espg=6933)

And then compute the area in the same way as above.

Upvotes: 3

Related Questions