geopandas.GeoSeries.buffer¶
- GeoSeries.buffer(distance, resolution=16, **kwargs)¶
Returns a
GeoSeries
of geometries representing all points within a givendistance
of each geometric object.See http://shapely.readthedocs.io/en/latest/manual.html#object.buffer for details.
- Parameters
- distancefloat, np.array, pd.Series
The radius of the buffer. If np.array or pd.Series are used then it must have same length as the GeoSeries.
- resolutionint (optional, default 16)
The resolution of the buffer around each vertex.
Examples
>>> 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
accept further specification asjoin_style
andcap_style
. See the following illustration of different options.(Source code, png, hires.png, pdf)