0

I have a stream network and I want to convert it in graph like data structure, for which I need to have precise set of FROM and TO vertices.The geometry of stream network is not correct i.e. the stream segments are not split at intersection on stream network.So, I have to merge the degree two nodes in the network so that my network will have only 1 and 3 degree vertices. The label in the figure represents the stream vertex id and degree of the vertex (ID-Degree) . The degree is the total amount of incoming or outgoing edge in the network.I have two shape-files, one is point layer having vertex ID and degree of each vertex and other is stream network having TO and FROM attributes for each edge but with degree 2 vertex as well which is to be eliminated.

Stream Network

I want it to convert as below.

Final Stream Segment

My approach:- For each edge , I will check the degree of the respective vertex ( assuming any starting vertex) and if the degree is not either 1 or 3 (degree greater than 3 is not expected) then the respective edge is merged and the iteration continues else the next vertex pair is considered.

I think there must be a easier way available as a plugin or Postgres/Postgis based query,please point out to any such tool or modified approach to achieve the same.

  • You could dissolve the lines, then select the points that end in -1 or -3 and use split lines at points to split the dissolved lines at those points. – csk Jun 4 at 19:21
  • @csk the "split lines at points" is not giving the desired output despite putting various tolerance values. Can you please provide an alternative for it? – Swapnil Jun 4 at 20:53
  • 1
    Are you having the issue described here: gis.stackexchange.com/questions/315042/… ? – csk Jun 4 at 20:55
  • What do u call 'merging nodes' since there is no geometry change ? Is this question your june 1st question "rephrased" ? I mean ... did u find the intersection points ? – snaileater Jun 6 at 7:35
  • Merging is regarding edges connected by nodes having degree 2 (in either vertex) which can be seen in second image given in question. – Swapnil Jun 6 at 7:41

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.