# Roofs

The roof shapes for building sections in the Tygron Platform are calculated as follows:

• Based on a BAG building polygon, we look at the DTM (height points every 50cm).
• Then we use the Hough Line algorithm to recognize lines in the elevation data (https://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html). These lines are often the division between higher and lower parts in the BAG building polygon. Think of a garage next to a house that is lower than the house itself. The advantage of these lines is that you get a sharp demarcation instead of fuzzy deviations in an inaccurate height model.
• The BAG building polygon is then divided into sections (garage, house, conservatory etc.). We calculate the standard deviation per section. If it is higher than a certain threshold and the model probably has a sloping roof (for example houses from the 1960s), we calculate a roof height attribute, which is the difference in height between the gutter and the ridge.
• We then use a Skeleton algorithm to determine the ridge of the roof. We include adjacent terraced houses (same construction date and height) so that you get a nice continuous roof ridge.

Based on the ridge lines and the gutter lines (polygon edges) we use a triangulation algorithm to build triangles which are needed for the 3D model. We also store the following data:

• The outer walls (for insulation), but you cannot yet query them with TQL.
• The different sections as separate polygons. Each section has its own building height and an estimated number of floors.
• The color of the roof (based on aerial images).

The advantage of this calculation method is that it is completely procedural. You can easily make new buildings with it and give them a visual representation. A disadvantage is that it is an approximation and therefore not 100% accurate.

The location of the ridge is determined as being the center of the building and not directly based on the height data. This is adequate for many common Dutch terraced houses, but there may be a deviation, especially with more complex roof shapes.