I have been playing around with roads layers and wanted to change the line directions for some of my features. I looked around for solutions to do this in QGIS and saw that I could use the swap vector direction plugin in QGIS or ST_reverse in PostgreSQL. But I wanted to find a non destructive way to do this as I did not want to alter my data. I decided to try the geometry generator in QGIS.
Normal road symbology showing direction.
I then set out to reverse the line direction using QGIS Geometry generator.
* Activate the style tab in the layer properties.
* Change symbol layer type from Simple Line to Geometry Generator.
* Change geometry type to LineString/MultiLineString.
* In the expression write reverse( $geometry ) to reverse the geometry of the features.
* Change Simple Line to Marker line and symbolize the marker line according to your specifications.
* Symbology should appear like the image below:
* You have your reversed lines showing in the map canvas as
* A side by side comparison of the roads layers
Share on Twitter Share on Facebook