[GIS] Exporting x,y coordinates as latitude,longitude in QGIS

convertcoordinate systemlatitude longitudeqgisxy

I have a shapefile and I loaded it into QGIS using 'Add vector layer'.
After that, I can see points in different positions.

I open the Attribute table and I can see columns "X" and "Y" with values such as (151449.965057, 204642.790761). Now I want to convert them to latitude and longitude. How can I do that?

Therefore, I use the option 'Save as' to export the data to CSV format using the CRS WGS 84.

However, nothing changes in the CSV file ("X" and "Y" stay the same as the original data).

example

I read and tried several suggestions from this forum without help, e.g., Converting x,y coordinates to longitude,latitude using QGIS.

Best Answer

Before exporting there are several more steps have to be applied.

Step 1. Create two additional fields, i.e. "lat" and "long" via the calc Field Calculator

Step 2. Apply the following expressions for "lat" and "long" respectively

For "lat" :

x(transform($geometry, 'EPSG:4326', 'EPSG:31370'))

For "long" :

y(transform($geometry, 'EPSG:4326', 'EPSG:31370'))

or alternatively, you can already use your "X" and "Y" fields with

For "lat" :

transform("x", 'EPSG:4326', 'EPSG:31370'))

For "long" :

transform("y", 'EPSG:4326', 'EPSG:31370'))

Additionally, I may refer you to this article: Adding x,y coordinates to Attribute table in QGIS.