TransWikia.com

Expression to Transform XY coordinates to LatLong in QGIS

Geographic Information Systems Asked by Edilson Matiquite on January 28, 2021

I have a Point Layer referenced in a projected CRS (UTM) with X, Y and Elev fields that represent coordinates of some points I have surveyed. I would like to have in the same layer Lat and Long fields coordinates from those XY values without projecting my layer to an Geographic CRS. Would someone help with the expression I could use?
QGIS v3.10

One Answer

If the layer is already georeferenced in QGIS then you can do something like this with the Field Calculator:

Expression for longitude:

x(transform($geometry, @YOUR_CRS_ID, 'EPSG:4326'))

And for latitude:

y(transform($geometry, @YOUR_CRS_ID, 'EPSG:4326'))

If the layer is not georeferenced and you want the fields to be calculated based on the X and Y fields then the expressions look like this:

x(transform(make_point("X", "Y"), @YOUR_CRS_ID, 'EPSG:4326'))


y(transform(make_point("X", "Y"), @YOUR_CRS_ID, 'EPSG:4326'))

enter image description here

Just remember to change the field type to Decimal and to choose your desired precision.

Answered by Leon Powałka on January 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP