8

I am trying to extract the z coordinate value from the derived attributes, similar to How to re-calculate area, perim, p2a,width and length in QGIS? but I cannot see a dedicated operator for finding the z coordinate like when trying to find area within the field calculator.

I have tried extraction of geometry tools > extract nodes & export/add geometry columns Screen shot of the attributes, I want Closest vertex Z to be a new column

whyzar
  • 12,053
  • 23
  • 38
  • 72
nashm999
  • 317
  • 3
  • 10
  • Have you tried using the expression z($geometry)? – Joseph Nov 07 '17 at 12:05
  • Yes it only returns Null from the vector layer, after extracting the nodes the Z coordinate is lost and I am only left with X & Y – nashm999 Nov 07 '17 at 12:15
  • I have a similar problem. To get Z coordinate from polygons you need to tell what is the vertice you want Z. z(point_n($geometry ,1)) The problem while calculating Z coordinate from polygons is that Z returned is an integer. I need Z real, i´ve tryed a lot of other ways inside calculator and keep getting an integer. – Bruno ReZende Jan 29 '19 at 18:33
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – xunilk Jan 29 '19 at 18:56

2 Answers2

6

Apparently the z function available in the Geometry section of the field calculator works well with points. I was able to find a solution to a similar problem of that asked by the OP by using z(start_point($geometry)) in the field calculator.

tinlyx
  • 11,057
  • 18
  • 71
  • 119
Javgs
  • 101
  • 1
  • 3
5

You could try How to „extract“ z-values ? to open the attribute-table, go directly into the field-calculator. Within the geometry-functions you will find z

Just calculate z on the geometry: z ($geometry)

enter image description here

whyzar
  • 12,053
  • 23
  • 38
  • 72