Calculating building height from 3D BAG
From TOI-Pedia
Contents
Input data
The input data for this processing step is obtained from a WFS connection to the 3D Basisregistratie Adressen en Gebouwen (BAG) dataset. See this page for more details.
Main steps
Filter out buildings with invalid height
Create a filter on the 3D BAG layer to remove any buildings which do not have a valid height. A filter can be added by right clicking on the layer and navigating to Filter... and typing the following expression:
"height_valid" = 'true'
Calculate building height
Calculate the building height based on the difference between the roof height and ground height of each building.
- Open the field calculator of the 3D BAG layer
- Create a new field called “height” and ensure that the output field type is set to “Decimal number (real)”
- The following expression can be used to calculate building heights rounded to whole meters and to exclude anything below 4m:
ROUND(IF("roof-0.95" - (IF( "ground-0.00" IS NULL, 0, "ground-0.00" )) <= 4,
NULL, "roof-0.95" - (IF( "ground-0.00" IS NULL, 0, "ground-0.00" ))))
Set z-value of building geometry
- Select the Toolbox (gear icon)
- Search for the tool: "Set Z value"
- Select the 3D BAG layer as input and change the "Z Value" input by selecting: Field type: int, double, string > <your building height field> (double)
- Choose a name and file path for the "Z Added" layer
- Run the tool. The output is a new layer in which the building height attribute has been linked to the z-component of the polygon geometries. This is the layer that should be used for any further visualisation / processing steps.