I am trying to switch the line direction in a PostGIS-layer. The postgis-geometry column is e.g. "LINESTRING(0 0, 1 1, 2 1, 2 2)".

The reason is that my symbology is direction-dependent, but I drew some lines in the wrong direction.

I have tried using my usual approach that seems to only work for shapefiles. It is the code by Nathan W. that is in the answer that is linked below.

Link to similar question:

1 Answer 1


If postgis resolution is also good maybe you're looking for ST_Reverse function


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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