2

I am trying to derive an average/mean Z-value of the GPS measured polygons. The standard z($geometry) I use for point layers doesn't work obviously. I could use z(start_point($geometry)), but that is only the first point.

Is this possible to derive directly from the polygons, thus without converting the polygones to points? And how would this be possible?

1 Answer 1

3

I recommend Extract Z values tool in the Processing Toolbox > Vector geometry.

(As a sample I created a brown polygon geom_from_wkt('POLYGON((4 5 2, 4 6 2.5, 7 6 1, 7 5 1))')

  1. Execute Extract Z values tool.
  2. Click on a small ellipsis button [...] of the Summaries to calculate list.
  3. Select Mean and run the tool.

The tool will produce an Extracted layer with which attribute table contains the mean of Z value. (In this example mean of {2.5, 1.0, 2.0, 1.0} is 1.625).

enter image description here

2
  • I tried finding the 'Extract Z values' command in QGIS 2.18 and QGIS 3.4.3 but it's not there. What version of QGIS does it come with?
    – jberrio
    Commented Jul 14, 2021 at 0:18
  • 1
    @jberrio Sorry for this belated reply. It seems the tool was first introduced in QGIS 3.6 (I may be wrong).
    – Kazuhito
    Commented Jul 14, 2021 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.