Name

ST_LineExtend — Returns a line with the last and first segments extended the specified distance(s).

Synopsis

geometry ST_LineExtend(geometry line, float distance_forward, float distance_backward=0.0);

Description

Returns a line with the last and first segments extended the specified distance(s). Distance of zero carries out no extension. Only non-negative distances are allowed. The first (and last) two distinct points in a line are used to determine the direction of projection, duplicate points are ignored.

Availability: 3.4.0

Example: Extends a line 5 units forward and 6 units backward

SELECT ST_AsText(ST_LineExtend('LINESTRING(0 0, 0 10)'::geometry, 5, 6));
--------------------------------------------
LINESTRING(0 -6,0 0,0 10,0 15)

See Also

ST_LocateAlong, ST_Project