I am using PostGIS2.0 and PostgreSQL9.3. I have LineString in Spatial-Ref 4326 like
geom:= ST_GEOMETRYFROMTEXT('LINESTRING(60.7014631515719 56.8441322356241,60.7023117507097 56.8445673405349,60.702948200063 56.8447993944193,60.703902874093 56.8448574076656,60.706236521722 56.8447993944193,60.7094187684889 56.8449444273664,60.7121236782406 56.8450894597515',4326);
And 2 Points in Spatial-Ref 4326 like
point1:= ST_GEOMETRYFROMTEXT('POINT(60.703902874093 56.8448574076656)', 4326);
point2:= ST_GEOMETRYFROMTEXT('POINT(60.7023117507097 56.8445673405349)', 4326);
Both points have been extracted from given LineString. So it is guaranteed, that both points are inside the given LineString. No neared points will be used.
It is not guaranteed, that the points are in the same order like in given LineString (see example: point1 is point #4 and point2 is point #2 of the LineString). They can be ascending or descending.
Is there any function or operator to extract a LineString from a given LineString by the points?
I want to do someting like
sub_geom:= ST_???(geom, point1, point2);
to get a LineString geometry that contains all Points from the given geometry from point1 to point2 (points are included)?
Expected result:
sub_geom == ST_GEOMETRYFROMTEXT('LINESTRING(60.7023117507097 56.8445673405349,60.702948200063 56.8447993944193,60.703902874093 56.8448574076656',4326)
The order of the points of the result geometry does not matter. It can be ascending or descending. The result is only used for visualisation.
It would be nice, if you can show me a solution for my problem.