To locate any vertex, it is spatially described with x and y coordinates - of course. You can also add Z and M values - but what is the advantage to use the Z in the vector instead of a attribute Z in attribute table?

In which cases should I use the Z values instead of just a attribute: "Z"? For me it seams easier to use a Z-attribute field because I can use it in expression dialog like any other attribute. Also if I want to make a 3D-looking map, the 2,5 D symbol style asks for a attribute field not the Z-value (screenshot). Also qgis2threejs is asking for an attribute to draw the height of a building...

Screenshot: The Identify window shows, that my buildings already have a Z value. It's written from the "_mean" attribute by using the tool: 'Set Z value'. The "_mean" attribute was created with 'Zonal Statistics' from a DSM (LiDAR). The "2.5 D" symbol needs a height but can't uses the z value, so I have to use the attribute "_mean".

enter image description here

I would like to have some cases or examples where the Z value is needed.

What are the advantages of the Z value?

  • 1
    what's the advantage to have x and y stored as a geometry rather than attributes? e.g. QGIS handles them implicitly; they have well established type definitions to interchange between software/framework; they can be transformed with well established references; etc. xyz geometries share those benefits, albeit with a way more complex math behind them; true 3D awareness did come a long way in the OGC ecosystem, and not many software/frameworks are capable of fully encorporating 3D geometries and their possibilities yet.
    – geozelot
    May 21, 2019 at 10:38

1 Answer 1


I think you are mixing up to concept : elevation (z value) and height (elevation relative to the ground).

For exemple an object may have a Z value (as a z coordinate) representing elevation of the point above a reference level (above geoid or ellipsoid ?) and another value (as an attribute table value) representing the height of the objet above the ground. You can use the second value to extrude an object for representing his volume, the first would be used to place the base of the volume at the correct elevation.

You may use both kind of value simultaneously as in the picture below where I use Qgis2threejs with a tree layer (xyz points) where the base of the tree use the Z coordinate and the height of the tree come from an HEIGHT attribute (a second copie of the layer is used for the sphere the elevation beeing equal to z + HEIGHT). As you can see the tree have different height but also the base of the trunk are at different elevation.

enter image description here

This work because Qgis2threejs work in 3D and so is able to use Z coordinate AND extrude object. If you work in the main QGIS window you work on a flat plane and cant represent the Z value (but if needed you may access it with expression based on the geometry), the 2.5D renderer mimic an extrusion from the flat plane and need the height of the object not his elevation.

  • Okay, understood! Btw: 'z($geometry)' should return the z value, right? But it doesn't... (same data set from screenshot)
    – MartinMap
    May 21, 2019 at 13:40
  • 1
    On polygon you have a Z value for each vertex so you can't calculate it for the whole geometry, you may access each vertex value in edit mode with the vertex editor or use "z( point_n( $geometry ,N))" to get the Z value of the N vertex (remplace N by the vertex you want)
    – J.R
    May 21, 2019 at 14:21

Your Answer

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

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