i have PostgreSQL+PostGIS.
I have a linestring:
"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,60.715571112238 56.8452925041466,60.718382096882 56.8454085290207,60.7204505572805 56.8453505166286,60.7222538304482 56.8450314468649,60.7246405155233 56.8444513130533,60.7260194891224 56.8440742212539,60.7260194891224 56.8440742212539,60.7260194891224 56.8440742212539,60.7260194891224 56.844045214035)"
Now i want to get a substring of this linestring. It is possible get a substring if i have a beggin point and end point of substring what i want to create?
But the more I wonder if I have a point of the line can I get it the next point and create a line of this segment?
Answer
There is more than one question here, and I'm a bit confused about what you want to achieve.
The core function you need is ST_LineSubstring as ST_Line_Substring is now deprecated.
That takes a "fraction" of the line as the start and end points. Since you want to work in point coordinates, you need to convert those to "fractions" of this line.
For that, you can use ST_Line_Locate_Point
For the last part of your question, perhaps you can calculate the vertices by doing a subline based on the points you have, then taking a PointN with the "next to first" and "next to last" points, then taking a new subline.
No comments:
Post a Comment