buffer
Creates a buffer around a geometry with a specified distance. Distance is in input geometry units.
Parameters
Name | Type | Default | Description |
---|---|---|---|
geometry | Geometry | The geometry to buffer | |
distance | number | The buffer distance. Positive values expand the geometry, negative values shrink it | |
options? | object | Optional parameters to control buffer generation | |
options.quadrantSegments? | number | 8 | The default number of facets into which to divide a fillet of 90 degrees. A value of 8 gives less than 2% max error in the buffer distance. For a max error of < 1%, use QS = 12. For a max error of < 0.1%, use QS = 18. The error is always less than the buffer distance. |
options.endCapStyle? | 'round' | 'flat' | 'square' | 'round' | Cap styles control the ends of buffered lines.
|
options.joinStyle? | 'round' | 'mitre' | 'bevel' | 'round' | Join styles control the buffer shape at bends in a line.
|
options.mitreLimit? | number | 5.0 | For acute angles, a mitre join can extend very very far from the input geometry, which is probably not desired. The mitre limit places an upper bound on that. |
options.singleSided? | boolean | false | Sets whether the computed buffer should be single-sided. A single-sided buffer is constructed on only one side of each input line. The side used is determined by the sign of the buffer distance:
The endCapStyle for single-sided buffers is always ignored and forced to the equivalent of flat . |
Returns
Polygon | MultiPolygon
A new, buffered, geometry
Throws
GEOSError
on unsupported geometry types (curved)
Examples
create a simple buffer around a point
create a buffer around a line
create a buffer that shrinks the geometry