4

I have river network in QGIS. I draw opposite direction one of the rivers. Now I want to change direction of that river.

How can I do that in QGIS 3?

(As I know it is flip in ArcGIS)

  • In QGIS 3.0 there is Reverse line direction tool (under Vector geometry tool) to do the job. I first thought this question was duplicate of How can I switch line direction in QGIS?. Strangely Reverse line direction tool is not there... (name change, pehaps?) – Kazuhito Mar 20 '18 at 0:49
  • @Kazuhito the tool was not available when the linked question was asked. You needed a plugin for that, or the processing script added to the toolbox lately. – AndreJ Mar 20 '18 at 7:08
  • Dear @Kazuhito Reverse line direction tool works for all rivers and after running that tool, I have all the rivers flowing upstream (which is not correct). There was a possibility to select only one feature as well. But doing the reverse of the selected feature make new shapefile, only containing selected feature – Stepan Khachatryan Mar 21 '18 at 19:54
  • Edit the original shapefile, deleting the selected river and pasting in the corrected river from the new shapefile. – csk Mar 21 '18 at 20:08
  • Thanks for the feedback. Just as an addition to suggestion by @csk can you perhaps select features you want to process? For instance, (1) Select features while holding Ctrl key (Windows) or (2) Use Select Features by Freehand tool. – Kazuhito Mar 22 '18 at 1:05
4

If you want to reverse selected crossection lines in QGIS3.X, I recommend the plugin--digitizingtools. Of course it works well in qgis3.x. And at its tool bar, you can see flip line tool. Enjoy youself!

  • 3
    now in QGIS3.4,the feature Reverse line has been supported! – lilith894 Dec 26 '18 at 8:44
0

Tested on QGIS 2.18 and QGIS 3.4

I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume we have five features in "roads" layer accordingly, see image below.

input

With the following Query and using ST_Reverse, it is possible to achieve the result

SELECT id, Name, length, ST_Reverse(geometry)
FROM roads

The output Virtual Layer will maintain initial attributes and reverse geometries.

result


Checking whether the query works proper possible with writing a small extra query

SELECT r1.id,
       st_astext(start_point(r1.geometry)) AS original, 
       st_astext(start_point(ST_reverse(r2.geometry))) AS reverse 
FROM roads AS r1
JOIN roads AS r2 ON r1.id = r2.id

The output table will prove that the original geometry was swapped for a new layer, see table below

proving

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.