Returns a line at a given offset distance from a linear geometry. If the distance is positive, the offset is on the left side of the input line; if it is negative, it is on the right side. Returns null for empty geometries.
The optional third parameter quadrantSegments controls the number of line segments used to approximate a quarter circle at round joins. The default value is 8.
Signatures
ST_OffsetCurve(geometry: Geometry, distance: Double)
ST_OffsetCurve(geometry: Geometry, distance: Double, quadrantSegments: Integer)
Parameters
The linear geometry to offset.
The offset distance. Positive offsets to the left of the line; negative to the right.
The number of segments used to approximate a quarter circle at round joins. Defaults to 8.
Return type
Example
SELECT ST_AsText(ST_OffsetCurve(ST_GeomFromWKT('LINESTRING(0 0, 10 0, 10 10)'), 5.0))
LINESTRING (0 5, 5 5, 5 10)
With a negative distance (offset to the right):
SELECT ST_NPoints(ST_OffsetCurve(ST_GeomFromWKT('LINESTRING(0 0, 10 0, 10 10)'), -3.0))
With quadrantSegments set to 16:
SELECT ST_NPoints(ST_OffsetCurve(ST_GeomFromWKT('LINESTRING(0 0, 10 0, 10 10)'), -3.0, 16))