2

I got vector points on a map. I already have the elevation information in the table for each vector point and the point-id. Now I want to get the GPS coordinates for each point stored in this attribute table. How can I do that?

Overall my aim is to get to know the gradient on this line which I divided into those points.

Vince
  • 20,017
  • 15
  • 45
  • 64
Jule kle
  • 53
  • 4

2 Answers2

4

If your layer already is in EPSG:4326 use the following expressions:

  • For field y/lat use: $y
  • For field x/lon use: $x

If your layer is in another projection use:

For field y/lat:

y(transform($geometry, layer_property(@layer_name, 'crs'),
       'EPSG:4326'))

For field x/lon:

x(transform($geometry, layer_property(@layer_name, 'crs'),
   'EPSG:4326'))

Create the fields with fieldcalculator and make sure to set field type to Decimal number (real) and set its precision. enter image description here

MrXsquared
  • 34,292
  • 21
  • 67
  • 117
3

vector -> geometry tools -> add geometry attributes adds columns with you coordinates in the layers CRS to its attribute table.

Erik
  • 16,269
  • 1
  • 24
  • 43