ST_Line_Substring — Returns a LineString being a portion of the input one. It will start and end at the given fractions of the total 2D length.
geometry ST_Line_Substring(
bytea
Geometry, double
startFraction, double
endFraction)
;
Returns a LineString being a portion of the input one. It will start and end at the given fractions of the total 2D length. The fractions parameters are numbers between 0 and 1.
MultiLineStrings are also supported. Jaspa returns a substring of a MultiLineString considering it as a whole, not cliping each of the LineStrings.
2D | 3D | M |
---|---|---|
OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
---|---|---|---|
- | - | - | - |
--2D LineString SELECT ST_AsEWKT(ST_Line_Substring(ST_GeomFromEWKT('LINESTRING (17 21, 26 39, 44 46)'),0.2,0.8)); --Result LINESTRING (20.527425830535137 28.05485166107027, 26 39, 36.64875355835534 43.14118193936041) --4D LineString SELECT ST_AsEWKT(ST_Line_Substring(ST_GeomFromEWKT('LINESTRING (17 21 10 -2, 26 39 15 -4, 44 46 20 -2)'),0.2,0.8)); --Result LINESTRING (20.527425830535137 28.05485166107027 11.959681016963964 -2.783872406785585, 26 39 15 -4, 36.64875355835534 43.14118193936041 17.95798709954315 -2.81680516018274) --2D MultiLineString SELECT ST_AsEWKT(ST_Line_Substring(ST_GeomFromEWKT('MULTILINESTRING ((1 1, 1 5), (2 5, 4 5),(5 5, 5 1))'),0.2,0.8)); --Result MULTILINESTRING ((1 3, 1 5), (2 5, 4 5), (5 5, 5 3))
ST_Line_Substring(Line,0.2,0.8) | ST_Line_Substring(MultiLineString,0.2,0.8) |