BufferOptions
Not logged in

Back to 5.0.0-doc main page



Buffer Options

For many years the GEOS library has allowed the customization of the ST_Buffer() standard behavior, which the previous SpatiaLite versions did not fully support.

Starting with version 5.0 SpatiaLite will now offer a complete support for all Buffer Options available through GEOS:
A short introduction to these new SQL functions:

SQL FunctionExamplesArgumentReturn ValueNotes
BufferOptions_SetEndCapStyle()
SELECT BufferOptions_SetEndCapStyle('SQUARE');
----
1

SELECT BufferOptions_SetEndCapStyle('square');
----
1

SELECT BufferOptions_SetEndCapStyle('gothic');
----
0
the name of a valid EndCap Style; accepted values are:
  • ROUND (default)
  • FLAT
  • SQUARE

Note: style names are case insensitive
1 (aka TRUE) on success.
0 (aka FALSE) on failure or on invalid argument.
Will set the current EndCap Style.
(it will control the style of line's terminations).
BufferOptions_GetEndCapStyle()
SELECT BufferOptions_GetEndCapStyle();
----
SQUARE
none a Text string on success.
NULL on failure.
Will return the name of the currently set EndCap Style.
BufferOptions_SetJoinStyle()
SELECT BufferOptions_SetJoinStyle('BEVEL');
----
1

SELECT BufferOptions_SetJoinStyle('BeVeL');
----
1

SELECT BufferOptions_SetJoinStyle('baroque');
----
0
the name of a valid Join Style; accepted values are:
  • ROUND (default)
  • MITRE or MITER
    (this Style joins lines in a more or less elongated Bishop's hat shape; actual elongation depends on MitreLimit setting)
  • BEVEL
    (this Style avoids using sharp edges; a short 45° segment will be always interpolated in the middle so to appropriately smoothen edges)

Note: style names are case insensitive
1 (aka TRUE) on success.
0 (aka FALSE) on failure or on invalid argument.
Will set the current Join Style.
(it will control the style of joins connecting two consecutive lines).
BufferOptions_GetJoinStyle()
SELECT BufferOptions_GetJoinStyle();
----
MITRE
none a Text string on success.
NULL on failure.
Will return the name of the currently set Join Style.
BufferOptions_SetMitreLimit()
SELECT BufferOptions_SetMitreLimit(2.5);
----
1

SELECT BufferOptions_SetMitreLimit(5);
----
1

SELECT BufferOptions_SetMitreLimit('zero');
----
0
an Integer or Double positive number.

Default value: 5.0
1 (aka TRUE) on success.
0 (aka FALSE) on failure or on invalid argument.
Will set the current Mitre Limit value.
(it will control how much acute will be a mitered join connecting two consecutive lines).

Note: the MitreLimit will be considered only when the MITRE Join Style is set.
BufferOptions_GetMitreLimit()
SELECT BufferOptions_GetMitreLimit();
----
5.0
none a Double number on success.
NULL on failure.
Will return the value of the currently set Mitre Limit.
BufferOptions_SetQuadrantSegments()
SELECT BufferOptions_SetQuadrantSegments(8);
----
1

SELECT BufferOptions_SetQuadrantSegments('none');
----
0
an Integer positive number.

Default value: 30
1 (aka TRUE) on success.
0 (aka FALSE) on failure or on invalid argument.
Will set the current QuadrantSegments value.
(it will control how many points have to be interpolated for each quadrant when approximating circular arcs).

Note: both ST_Buffer() and ST_SingleSidedBuffer() support an optional points argument with the same identical meaning.
An explicitly set points argument will always override the current BufferOprions QuadrantSegments value.
BufferOptions_GetQuadrantSegments()
SELECT BufferOptions_GetQuadrantSegments();
----
30
none an Integer number on success.
NULL on failure.
Will return the value of the currently set QuadrantSegments.
BufferOptions_Reset()
SELECT BufferOptions_Reset();
---
1
none 1 (aka TRUE) on success.
0 (aka FALSE) on failure.
Will reset the persistent BufferOptions to their initial default values.



The easiest and quickest way to fully understand the exact effect of each Buffer Option, is by consulting the following graphic chart:

OptionVisual Samples
EndCapStyle cap_round.png
ROUND (default)
cap_flat.png
FLAT
cap_square.png
SQUARE
JoinStyle join_round.png
ROUND (default)
join_mitre.png
MITRE
join_bevel.png
BEVEL
MitreLimit mitre_10.png
1.0
mitre_25.png
2.5
mitre_50.png
5.0 (default)
QuadrantSegments quad_1.png
1
quad_2.png
2
default.png
30 (default)



Back to 5.0.0-doc main page