geopandas.GeoSeries.area#

property GeoSeries.area#

返回一个 Series 中每个几何图形的面积。 GeoSeries 以CRS为单位表示。

参见

GeoSeries.length

测量长度

注意事项

面积对于以度为单位的地理CRS可能无效;请使用 GeoSeries.to_crs() 在使用此函数之前,将几何图形投影到平面CRS。

GeoPandas中的每个操作都是平面的,即没有考虑潜在的第三维。

示例

>>> from shapely.geometry import Polygon, LineString, Point
>>> s = geopandas.GeoSeries(
...     [
...         Polygon([(0, 0), (1, 1), (0, 1)]),
...         Polygon([(10, 0), (10, 5), (0, 0)]),
...         Polygon([(0, 0), (2, 2), (2, 0)]),
...         LineString([(0, 0), (1, 1), (0, 1)]),
...         Point(0, 1)
...     ]
... )
>>> s
0    POLYGON ((0.00000 0.00000, 1.00000 1.00000, 0....
1    POLYGON ((10.00000 0.00000, 10.00000 5.00000, ...
2    POLYGON ((0.00000 0.00000, 2.00000 2.00000, 2....
3    LINESTRING (0.00000 0.00000, 1.00000 1.00000, ...
4                              POINT (0.00000 1.00000)
dtype: geometry
>>> s.area
0     0.5
1    25.0
2     2.0
3     0.0
4     0.0
dtype: float64