Search code examples
python-3.xgeopandas

I need to calculate the area of each country


I am using the naturalearth_lowres pre-set map of geopandas and I need the area in km² of each country for further calculation. I have tried several solutions I found in the internet, but none of them worked for me.

One of he solutions that did not work is this one. The values I get from this calculation are not fitting the real values at all (compared them with values from wikipedia).

I just need some sort of a formula for the area.


Solution

  • I got it running now:

    df_copy = df.to_crs({'init': 'epsg:3035})
    df['area'] = df_copy['geometry'].area / 10**6
    

    This way I managed to get a satisfactory result, fitting the 'real' values from wikipedia.