I have a triangulated DEM PolygonZM shape and would like to Rasterize it in QGIS (3.2). enter image description here

I couldn´t find an option to use the geometry´s z value so i tried to create a field and calculate the centroid´s Z values.

But i´m kind of stumped as to how to do it.

Using "centroid($geometry) removes the z-values so it seems i can´t use the z() function. enter image description here

If i use "vector -> geometry tools -> centroids", the resulting geometry is 2d as well. enter image description here


You can extract points from the TIN using Vector->Geometry tools->Extract vertices. I tried it on a PolylineZ layer and Z values were preserved.

I suppose you had better to use the TIN interpolation to rasterize the original triangles, you can find it in the processing toolbox: QGIS->Interpoation->TIN (or you can select other interpolation method. If you would like to preserve TIN edges as break lines in your model than add 3D polygons as break lines.

Original triangles

Original layer 3D data

interpolation parameters and result

interpolation parameters and result

  • TIN interpolation works for a small subset of the data, but once i try the whole dataset (~290k features), it stops with an unknown Exception. – rr5577 Dec 13 '18 at 8:11

For future reference - a possible workflow in QGIS >= 3.6:

  • Run the "Extract Z Values" algorithm on your PolygonZM input, and either extract the first vertex's Z value to an attribute (the default behaviour), or extract a derived statistic based on the Z values to an attribute (e.g. the mean/median/min/max z value -- the algorithm has options for all of these)

  • Run the Rasterize (vector to raster) algorithm on the output from Extract Z Values. Select your newly created Z value field as the "field to use for a burn-in value". Clear the "fixed value to burn" field. Fill in the resolution/extent parameters as desired, and run.

The output will be a raster containing the z values from the original PolygonZM input vector.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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