Search code examples
geopandasarea

What unit is the area function for geopandas?


I'm using the .area attribute for a geoseries, which returns a number, but I have no idea what this number means. I've looked in the geopandas documentation and I can't seem to find the answer to this question. I found one answer on stack exchange that said to do this:

print df.crs['units']

but that was from 2015, and I get the error 'TypeError: 'CRS' object is not subscriptable' when I try that for my geodataframe. I added the area as a column in my gdf and randomly tried

gp['area'].unit

but I got the error 'AttributeError: 'Series' object has no attribute 'unit''. Are the units in meters^2? Does it depend on the file? Please let me know!


Solution

  • Starting with the length of a geometry, its unit is expressed in the units of the CRS.

    reference

    The Length may be invalid for a geographic CRS using degrees as units.

    The areas of each geometry are based on the same units of the CRS. The unsatisfactory part is the computation method, Euclidean geometry is used to get the areas.