PostGIS
Synopsis
geometry +`*`+ST_OffsetCurve
*(`geometry `line
, float
signed_distance
, text style_parameters=''`
)`;
Description
Return an offset line at a given distance and side from an input line. All points of the returned geometries are not further than the given distance from the input geometry. Useful for computing parallel lines about a center line.
For positive distance the offset is on the left side of the input line and retains the same direction. For a negative distance it is on the right side and in the opposite direction.
Units of distance are measured in units of the spatial reference system.
Note that output may be a MULTILINESTRING or EMPTY for some jigsaw-shaped input geometries.
The optional third parameter allows specifying a list of blank-separated key=value pairs to tweak operations as follows:
-
'quad_segs=#' : number of segments used to approximate a quarter circle (defaults to 8).
-
'join=round|mitre|bevel' : join style (defaults to "round"). 'miter' is also accepted as a synonym for 'mitre'.
-
'mitre_limit=.' : mitre ratio limit (only affects mitred join style). 'miter_limit' is also accepted as a synonym for 'mitre_limit'.
Performed by the GEOS module.
Availability: 2.0
Enhanced: 2.5 - added support for GEOMETRYCOLLECTION and MULTILINESTRING
|
Examples
Compute an open buffer around roads
SELECT ST_Union(
ST_OffsetCurve(f.geom, f.width/2, 'quad_segs=4 join=round'),
ST_OffsetCurve(f.geom, -f.width/2, 'quad_segs=4 join=round')
) as track
FROM someroadstable;
15, 'quad_segs=4 join=round' original line and its offset 15 units.
|
-15, 'quad_segs=4 join=round' original line and its offset -15 units
|
double-offset to get more curvy, note the first reverses direction, so -30 + 15 = -15
|
double-offset to get more curvy,combined with regular offset 15 to get parallel lines. Overlaid with original.
|
15, 'quad_segs=4 join=bevel' shown with original line
|
15,-15 collected, join=mitre mitre_limit=2.1
|