I have a river network in QGIS. I draw opposite direction of one of the rivers. Now I want to change the direction of that river.
How can I do that in QGIS 3?
(As I know it is flip in ArcGIS)
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
It's built into the app now and no plugins are required.
It is accessible via the Advanced digitizing panel that is not shown by default.
I can suggest using a "Virtual Layer" through
Layer > Add Layer > Add/Edit Virtual Layer...
Let's assume we have five features in the
'roads' layer accordingly, see the image below.
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.
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