# Geopandas and QGIS Calulating Different Polygon Area Values?

I am just trying to understand why Geopandas and QGIS might calculate areas differently despite using exactly the same shapefiles and exactly the same projections.

Both shapefiles are using EPSG:53032 - Sphere Azimuthal Equidistant. Proj4 string is:

+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs

Despite this both have returned similar, but substantially different results.

QGIS Results:

Geopandas Results:

FYI:

• QGIS results were calculated using the \$area function in the field calculator
• Shapefiles are accessible here if you want to play with them.
• Geopandas code is below:
``````import pandas as pd
import geopandas as gpd

# Import Shapefiles from Google Drive

# Update CRS
newcrs = "+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs"

gdf = gdf.to_crs(newcrs)
gdf["area"] = (((gdf['geometry'].area)/1000)/1000) # Divited by 1000 to convert into metres

gdf.sort_values(['area'], ascending = False)
``````
• Why are you converting your shapefile to 'newcrs' when it's already in that CRS? [If it's not in that CRS, are you re-projecting it in QGIS as well?] – Jon Jun 5 '19 at 17:40
• What QGIS version are you using? – GreyHippo Jun 5 '19 at 17:43
• Thanks. The Question is answered but just for the record, I was using QGIS version 3.6.5 and I was also re-projecting this in QGIS. – Daniel Thomas Jun 6 '19 at 13:16

Then re-compute your areas and you should get

I am not sure why this matters, but clearly QGIS gets some information for computing area from the canvas's CRS (which seems dumb). One way to avoid this is to re-project and save your shapefile, so when you pull it into a fresh map canvas it will automatically set the canvas to the same CRS.

EDIT: the area tool description states:

The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.

When you re-project your shapefile, the project's ellipsoid setting (specified by EPSG:4326 or whatever your map CRS is set to) does not change, so you need to manually change it to ensure the same ellipsoid as your new shapefile CRS.

QGIS has two different area functions. One respects the project settings, while the other uses the layer's spatial reference system. To see identical results to the GeoPandas area calculation, use `area(\$geometry)` of the `\$area`.

• `\$area`

The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.

• `area()`

Calculations are always planimetric in the Spatial Reference System (SRS) of this geometry, and the units of the returned area will match the units for the SRS. This differs from the calculations performed by the \$area function, which will perform ellipsoidal calculations based on the project's ellipsoid and area unit settings.