Compute the buffer of a geometry for positive and negative buffer distance. The buffer of a geometry is defined as the Minkowski sum (or difference, for negative distance) of the geometry with a circle with radius equal to the absolute value of the buffer distance. The buffer opera
(
geometry,
distance,
quad_segs=8,
cap_style="round",
join_style="round",
mitre_limit=5.0,
single_sided=False,
**kwargs,
)
| 139 | ) |
| 140 | @multithreading_enabled |
| 141 | def buffer( |
| 142 | geometry, |
| 143 | distance, |
| 144 | quad_segs=8, |
| 145 | cap_style="round", |
| 146 | join_style="round", |
| 147 | mitre_limit=5.0, |
| 148 | single_sided=False, |
| 149 | **kwargs, |
| 150 | ): |
| 151 | """Compute the buffer of a geometry for positive and negative buffer distance. |
| 152 | |
| 153 | The buffer of a geometry is defined as the Minkowski sum (or difference, |
| 154 | for negative distance) of the geometry with a circle with radius equal |
| 155 | to the absolute value of the buffer distance. |
| 156 | |
| 157 | The buffer operation always returns a polygonal result. The negative |
| 158 | or zero-distance buffer of lines and points is always empty. |
| 159 | |
| 160 | Parameters |
| 161 | ---------- |
| 162 | geometry : Geometry or array_like |
| 163 | Geometry or geometries for which to compute the buffer. |
| 164 | distance : float or array_like |
| 165 | Specifies the circle radius in the Minkowski sum (or difference). |
| 166 | quad_segs : int, default 8 |
| 167 | Specifies the number of linear segments in a quarter circle in the |
| 168 | approximation of circular arcs. |
| 169 | cap_style : shapely.BufferCapStyle or {'round', 'square', 'flat'}, default 'round' |
| 170 | Specifies the shape of buffered line endings. BufferCapStyle.round ('round') |
| 171 | results in circular line endings (see ``quad_segs``). Both BufferCapStyle.square |
| 172 | ('square') and BufferCapStyle.flat ('flat') result in rectangular line endings, |
| 173 | only BufferCapStyle.flat ('flat') will end at the original vertex, |
| 174 | while BufferCapStyle.square ('square') involves adding the buffer width. |
| 175 | join_style : shapely.BufferJoinStyle or {'round', 'mitre', 'bevel'}, default 'round' |
| 176 | Specifies the shape of buffered line midpoints. BufferJoinStyle.round ('round') |
| 177 | results in rounded shapes. BufferJoinStyle.bevel ('bevel') results in a beveled |
| 178 | edge that touches the original vertex. BufferJoinStyle.mitre ('mitre') results |
| 179 | in a single vertex that is beveled depending on the ``mitre_limit`` parameter. |
| 180 | mitre_limit : float, default 5.0 |
| 181 | Crops of 'mitre'-style joins if the point is displaced from the |
| 182 | buffered vertex by more than this limit. |
| 183 | single_sided : bool, default False |
| 184 | Only buffer at one side of the geometry. |
| 185 | **kwargs |
| 186 | See :ref:`NumPy ufunc docs <ufuncs.kwargs>` for other keyword arguments. |
| 187 | |
| 188 | Notes |
| 189 | ----- |
| 190 | |
| 191 | .. deprecated:: 2.1.0 |
| 192 | A deprecation warning is shown if ``quad_segs``, ``cap_style``, |
| 193 | ``join_style``, ``mitre_limit`` or ``single_sided`` are |
| 194 | specified as positional arguments. In a future release, these will |
| 195 | need to be specified as keyword arguments. |
| 196 | |
| 197 | Examples |
| 198 | -------- |