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)
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
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.
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