dtoolkit.geoaccessor.geoseries.geoarea#

dtoolkit.geoaccessor.geoseries.geoarea(s: GeoSeries, /) Series[source]#

Returns a Series containing the geographic area (m2) of each geometry.

A sugar syntax wraps:

s.to_crs("+proj=cea").area
Returns:
Series(float64)

Notes

The result is a tiny bit different from the value, because of CRS problem. But the cea (Equal Area Cylindrical) CRS is quite enough, the average absolute error is less than 0.04% base on ‘naturalearth_lowres’ data.

Examples

>>> import dtoolkit.geoaccessor
>>> import geopandas as gpd
>>> from shapely import Polygon
>>> df = gpd.GeoDataFrame(
...     geometry=[
...         Polygon([(0,0), (1,0), (1,1), (0,1)]),
...         Polygon([(1,1), (2,1), (2,2), (1,2)]),
...         Polygon([(2,2), (3,2), (3,3), (2,3)]),
...         Polygon([(2, 0), (3, 0), (3, 1)]),
...     ],
...     crs="EPSG:4326",
... )
>>> df.geoarea()
0    1.230846e+10
1    1.230481e+10
2    1.229752e+10
3    6.154232e+09
dtype: float64