geopandas.GeoSeries.intersection_all#

GeoSeries.intersection_all()[来源]#

返回一个几何图形,其中包含GeoSeries中所有几何图形的交集。

当其他几何体存在时,此方法会忽略 None 值。 如果 GeoSeries 的所有元素都是 None,则会返回一个空的 GeometryCollection。

示例

>>> from shapely.geometry import box
>>> s = geopandas.GeoSeries(
...     [box(0, 0, 2, 2), box(1, 1, 3, 3), box(0, 0, 1.5, 1.5)]
... )
>>> s
0              POLYGON ((2 0, 2 2, 0 2, 0 0, 2 0))
1              POLYGON ((3 1, 3 3, 1 3, 1 1, 3 1))
2    POLYGON ((1.5 0, 1.5 1.5, 0 1.5, 0 0, 1.5 0))
dtype: geometry
>>> s.intersection_all()
<POLYGON ((1 1, 1 1.5, 1.5 1.5, 1.5 1, 1 1))>