How to visualize point data with Z values? Let’s say: we have data about noise pollution in multi-storey buildings. The point data (apartments) looks like this:
One idea was to use diagrams. QGIS, however, gives only pie charts and histograms, which don’t satisfy in my case.
Another idea was the Point Displacement option in the styling of the layer. This didn’t work out well either, because I couldn’t arrange the points properly. I wanted to place them above each other, with the highest Z value on top.
The idea that did work out was to use Offset X,Y in the Symbol selector:
Using this, you can offset the marker symbols in horizontal (X) and vertical (Y) direction. Instead of just using X and Y values, you can also use an expression. Using an expression, you get the possibility to use values in the attribute table for changing the X and Y offset value for each point. That gave me the solution!
After a lot of trying I used this expression:
‘0, ‘|| to_string(-1 * “z”)
Let me explain. “z” is the height value I want to use. A positive Z value gives the marker a downward offset. I want it upward, so I took the negative of Z. Because the result of the expression has to be a string value, I used the to_string expression to do so. Because the expression changes both X and Y, and I didn’t want to change the X value, I used ‘0, ‘ in the beginning of the expression, and concatenated (||) the 2 expressions.
Here’s the result:
Now you see all apartments in the different blocks: the markers at the bottom are the lowest in the block, at the top are the highest apartments. There are some gaps, because the data were incomplete. The small blue points indicate the original X and Y coordinates.
The possibilities of these expressions are myriad. And with adding text labels, you can use these expressions too, to place them exactly where you want (in the markers, beside the markers, whatever).