Was this helpful?
Line_Substring
LINE_SUBSTRING(g Geometry, f1 float, f2 float);
Alias: ST_LINE_SUBSTRING
Creates a new line that is a subset of the line passed as g.
The first argument g must be of type Linestring, LinestringZ, LinestringM, LinestringZM, MultiLinestring, MultiLinestringZ, MultiLinestringM, or MultiLinestringZM.
The second and third arguments, f1 and f2, must be a fraction between 0 and 1. f1 must be smaller than f2.
Result type: If g is any Linestring type, result is Linestring. If g is any MultiLinestring type, result is GeometryCollection.
Example:
SELECT ASTEXT(LINE_SUBSTRING(GEOMFROMTEXT('LINESTRING(0 0, 5 5, 10 10)'), 0.5, 0.75));
-------------
col1
-------------
LINESTRING(5 5, 7.5 7.5)
-------------
SELECT ASTEXT(LINE_SUBSTRING(GEOMFROMTEXT('LINESTRING(0 0, 5 5, 10 10)'), 0.25, 0.75));
-------------
col1
-------------
LINESTRING(2.5 2.5, 5 5, 7.5 7.5)
-------------
Last modified date: 04/03/2024