Add x,y coordinates to a table in QGIS

Опубликовано: 28 Сентябрь 2024
на канале: Map Academy
3,713
18

If you have a point layer and you want to add the x and y coordinates in new columns to your attribute table, it's super-simple in QGIS. If you want to add the x and y coordinates in a different coordinate reference system (CRS), that's easy too!

To add x or y you just type in $x or $y when you're adding a new column and if you want to add them in a different CRS you can use the following text - making sure to replace x with y when you're doing latitude!

x(transform($geometry, layer_property(@layer,'crs'), 'EPSG:25832'))

In the example above I used 25832 because that's the code for a CRS that covers Denmark.

The data I used here is from WorldPop and it's 1km population count data: https://hub.worldpop.org/project/cate...

See my intro and intermediate QGIS courses for more: https://www.udemy.com/user/alasdair-r...

© OpenStreetMap contributors