Calculating correct area for polygons with geopandas
Asked Answered
U

1

6

I recently tried to calculate country sizes with geopandas and the included world file; and I am not capable to calculate the correct size for the chosen countries. Maybe someone can give me a hint where I made a mistake?

Tried various shapefiles (and the included world file shipped with geopandas); all of the afaik in epsg:4326

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
cnames = ['Austria','Sweden','Kenya']
epsgs = ['3857','3395']

for c in cnames:
    carea = world[world['name'] == c]
    for e in epsgs:
        carea = carea.to_crs(epsg=e)
        area = int(pd.to_numeric(carea['geometry'].area)/10**6)
        print(area)

Expected results are:

  • Austria: 83,879 km²
  • Sweden: 450,295 km²
  • Kenya: 580,367 km²

Actual results I get:

  • Austria: 187163
  • Austria: 186592
  • Sweden: 2190160
  • Sweden: 2187138
  • Kenya: 595731
  • Kenya: 591749

So Kenya is quite close (also to the equator)? Is the reprojection not right?

Uncommunicative answered 10/8, 2019 at 11:36 Comment(0)
A
5

To get correct area, you must use 'equal-area' projection. The one that works well with your code is epsg 6933. It is cylindrical equal-area projection.

Arce answered 10/8, 2019 at 14:8 Comment(1)
Thanks, this clarifies a lot. In this question they talk about 3395 being an equal area crs: gis.stackexchange.com/questions/218450/… one of the reasons I was not on the right path :)Uncommunicative

© 2022 - 2024 — McMap. All rights reserved.