geopandas.GeoSeries.buffer#

GeoSeries.buffer(distance, resolution=16, **kwargs)#

返回一个 GeoSeries 表示给定区域内所有点的几何图形 distance 每个几何对象的。

有关详细信息,请参阅http://shapely.readthedocs.io/en/latest/manual.html#object.buffer。

参数
distanceFloat,np.array,pd.Series

缓冲区的半径。如果使用np.array或pd.Series,则它的长度必须与GeoSeries相同。

resolution整型(可选,默认为16)

每个顶点周围缓冲区的分辨率。

示例

>>> from shapely.geometry import Point, LineString, Polygon
>>> s = geopandas.GeoSeries(
...     [
...         Point(0, 0),
...         LineString([(1, -1), (1, 0), (2, 0), (2, 1)]),
...         Polygon([(3, -1), (4, 0), (3, 1)]),
...     ]
... )
>>> s
0                              POINT (0.00000 0.00000)
1    LINESTRING (1.00000 -1.00000, 1.00000 0.00000,...
2    POLYGON ((3.00000 -1.00000, 4.00000 0.00000, 3...
dtype: geometry
>>> s.buffer(0.2)
0    POLYGON ((0.20000 0.00000, 0.19904 -0.01960, 0...
1    POLYGON ((0.80000 0.00000, 0.80096 0.01960, 0....
2    POLYGON ((2.80000 -1.00000, 2.80000 1.00000, 2...
dtype: geometry

**kwargs 接受进一步的规范为 join_stylecap_style 。请参见不同选项的下图。

(Source code _, pnghires.pngpdf )

../../../_images/buffer.png