I want to export line coordinates of several features of a layer into a CSV file.

This is easily possible with Export -> Save Selected Features As... and choosing Geometry: AS_WKT:

enter image description here

However, this approach will write the coordinates in the scheme of Longitude Latitude into the CSV file (e.g. 11.3307, 50.9829), like seen below:

enter image description here

OpenStreetMap uses coordinates the other way around in scheme of Lat/Long (e.g. 50.9829, 11.3307) - this is what I need.

How can I export coordinates into the CSV in the way of Latitude Longitude?

  • 2
    I would rather study how to make Leaflet or whatever you are using to read the WKT in lon-lat order because that is by far more common type of WKT. It seems to work fine for example here arthur-e.github.io/Wicket. Please describe what OSM service you would like to use, OSM is a large ecosystem.
    – user30184
    Sep 24, 2021 at 7:00

1 Answer 1


First, let's emphasis that it is a strange requirement... CRS and axis order are tightly coupled, so the clean solution is to export and load the data using the same CRS.

That being said, you can create the (not anymore)Well-known-text using swapped coordinates using a virtual layer.

Go the the menu layer / add layer / add-edit virtual layer and enter the following query.

select *, st_astext(SwapCoordinates(geometry)) as lat_long_text 
from myLayer

You can then export this new dynamic layer as CSV, omitting the geometry field.

enter image description here

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.