loader image
Skip to main content

4. Filter using expressions

In the previous chapter we've filtered the points that were classified as buildings. In this chapter we'll create filter expressions using other attributes.

Let's first filter points based on their height using the Z attribute. We're going to filter points that are higher than 25 meters.

1. In the Processing Toolbox go to Point cloud extraction | Filter.

2. Make sure the original point cloud layer (e.g. 65DN1_07) is selected as the Input layer and click  to formulate the Filter Expression in the Point Cloud Expression dialog.

3. Formulate and test the expression Z > 25.


4. Click OK if the expression is valid.

5. Save the file as high.laz and click Run.


6. Check the result.

Maybe we're not interested in buildings, but in urban green. Let's see if we can use a filter to get the vegetation points.

7. Go back to the Filter tool.

8. Make sure the original point cloud layer (e.g. 65DN1_07) is selected as the Input layer and click  to formulate the Filter Expression in the Point Cloud Expression dialog.

We're going to use the ReturnNumber attribute. We assume that if the ReturnNumber > 1, it is likely to be points in vegetation.

9. Create the expression, test the validity and click OK.


10. Save the file as vegetation.laz and click Run.


11. Click Close after processing and check the result. Zoom in to see the details.

  • Does it only filter vegetation?
  • If there's confusion, which other land cover is confused with vegetation?

Let's see if we can refine the filter to reduce the amount of building points.

12. Go back to the Filter tool and create the following expression:

ReturnNumber > 1 AND Classification != 6

Make sure you use the buttons to add the operators and the classification value.

This expression means that it will filter points that have a return number larger than 1 and at the same time are not classified as buildings (value 6 of the Classification attribute).


13. Test and run the filter if the expression is valid. Save the result as vegetation2.laz.

14. Check the result.

  • Did the filter improve the result compared to the previous result?
  • Try to further improve the result using other filter expressions.