please help me, i'm new in gis

1) i have а table with geom railways, which are multilinestrings (for example there are 2 ways one of which is interrupted, so this way will be multilinestrings consisting of many linestrings, wich have the same ID)

2) i have a table with points, which is on the line, but not in the linestring itself, i.e. each point is not a vertex of the linestrings enter image description here

i need to split lines by points in this case (when 1 way is a multilinestring consisting of many linestrings, look at the picture below, column 'glput' is ID of the way)

an illustration of what I have and what i need enter image description here blue lines are segments that i must have

i try to use ST_LineSubstring (roads.geom, ST_LineLocatePoint (poits.geom1), ST_LineLocatePoint (points.geom2))

full query:

select ST_LineSubstring(st_geometryn, ST_LineLocatePoint (st_geometryn,geom1), ST_LineLocatePoint (st_geometryn,geom2)) from table_road t1 join table_point t2 on t1.glput=t2.glput

but it is not working as it should, because ST_LineLocatePoint representing the location of the closest point on EACH of linestrings with the same ID, but it must interpolate point only to the line on which they lie

  • Please consider editing your question (just click edit below the question) instead of leaving important detail in comments where they could be hidden when other information is added. – BradHards Aug 7 '15 at 8:31
  • I have solved this problem with the function ST_Dwithin(st_geometryn,geom1, 50). If is it true, then point lie on the line and ST_LineLocatePoint take this point, else it does not take the point. But I was faced with another problem. Coordinates of each linestring take the start from different vertex, i.e. coordinates not in series. here an illustration: [1]: i.stack.imgur.com/iP2Yv.png – nastinnastin Aug 7 '15 at 12:34
  • And ST_LineLocatePoint return float 1st argument more then 2 argument. you may notice that 1 and 2 records in the table belong to one line, 3,4,5....8 records belong to another line. here an illustration: [1]: i.stack.imgur.com/wlbwX.png Two last columns are results of work function ST_LineLocatePoint and they are right only for 3,4,5....8 records, but for 1,2 records it returns float in reverse – nastinnastin Aug 7 '15 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.