ST_LineSubstring
Updated at:
Returns a substring of a specified LineString.
Syntax
geometry ST_LineSubstring(geometry aLinestring , float8 startfraction , float8 endfraction);
geography ST_LineSubstring(geography aLinestring , float8 startfraction , float8 endfraction);
Parameters
Parameter name | Description |
aLinestring | The target LineString object. |
startfraction | The start position. |
endfraction | The end position. |
Description
When startfraction and endfraction have the same value, this function is equivalent to ST_LineInterpolatePoint.
To apply this function to a MultiLineString object, you must first use ST_LineMerge to merge it.
This function supports 3D objects and does not delete the Z coordinate.
This function supports M coordinates.
Example
SELECT ST_AsText(ST_LineSubstring('LINESTRING(0 0,10 10)'::geometry,0.3,0.6));
st_astext
---------------------
LINESTRING(3 3,6 6)
(1 row)
--geography
SELECT ST_AsText(ST_LineSubstring('LINESTRING(0 0,10 10)'::geography,0.3,0.6));
st_astext
--------------------------------------------------------------------------------
LINESTRING(2.97227762767668 3.01417970957332,5.96094221033023 6.0199989936211)
Is this page helpful?