Skip to content
On this page

geos.GEOSSingleSidedBuffer ⇒ number

Creates a single-sided buffer around a geometry with a specified width, number of segments per quadrant, side (left or right), end cap style and join style using a given context handle. A positive distance will create a buffer on the left side of the geometry (as viewed from the start point to the end point), while a negative distance will create a buffer on the right side. A single-sided buffer is constructed by offsetting the input line by the buffer distance then forming a buffer around the offset line by the buffer distance (using round ends). This produces a buffer polygon with one straight side which is parallel to the input line at the given offset distance. If the input line is oriented counter-clockwise then the left side is inside the polygon; otherwise it is outside. If the input line is not simple (i.e. it loops back on itself) then there may be multiple left sides and right sides; in this case it is not clearly defined which side should be buffered. In this case the operation may either fail with an exception or return an approximate result which may not be valid. This function does not support buffering MultiLineStrings (the result will be an empty polygon).

Kind: Exported member
Returns: number - The single-sided buffered geometry pointer or NULL if an exception occurred.

ParamTypeDescription
gnumberThe input geometry pointer.
widthnumberThe buffer width.
quadsegsnumberThe number of segments per quadrant.
joinStylenumberThe join style. One of 1 = GEOSBUF_JOIN_ROUND, 2 = GEOSBUF_JOIN_MITRE or 3 = GEOSBUF_JOIN_BEVEL.
mitreLimitnumberThe mitre limit. A positive number or zero.
sidenumberThe side to buffer. 1 for left, -1 for right.

geos.GEOSSingleSidedBuffer_r ⇒ number

Creates a single-sided buffer around a geometry with a specified width, number of segments per quadrant, side (left or right), end cap style and join style using a given context handle. A positive distance will create a buffer on the left side of the geometry (as viewed from the start point to the end point), while a negative distance will create a buffer on the right side. A single-sided buffer is constructed by offsetting the input line by the buffer distance then forming a buffer around the offset line by the buffer distance (using round ends). This produces a buffer polygon with one straight side which is parallel to the input line at the given offset distance. If the input line is oriented counter-clockwise then the left side is inside the polygon; otherwise it is outside. If the input line is not simple (i.e. it loops back on itself) then there may be multiple left sides and right sides; in this case it is not clearly defined which side should be buffered. In this case the operation may either fail with an exception or return an approximate result which may not be valid. This function does not support buffering MultiLineStrings (the result will be an empty polygon).

Kind: Exported member
Returns: number - The single-sided buffered geometry pointer or NULL if an exception occurred.

ParamTypeDescription
handlenumberA pointer to the GEOS context handle.
gnumberThe input geometry pointer.
widthnumberThe buffer width.
quadsegsnumberThe number of segments per quadrant.
sidenumberThe side to buffer. 1 for left, -1 for right.
endCapStylenumberThe end cap style. One of 1 = GEOSBUF_CAP_ROUND, 2 = GEOSBUF_CAP_FLAT or 3 =GEOSBUF_CAP_SQUARE.
joinStylenumberThe join style. One of 1 = GEOSBUF_JOIN_ROUND, 2 = GEOSBUF_JOIN_MITRE or 3 = GEOSBUF_JOIN_BEVEL.