I have a building footprint file in SHP format and a DSM file in TIFF format, and I want to merge them and convert them to KML format for LOD2. However, unfortunately, the slopes of the gable roofs are not displayed correctly and appear flat. In fact, I want to write a Python code for this. I have used many algorithms to extract the roof geometry or edges, but the buildings are displayed with jagged walls, either completely flat or sunken into each other. I have used algorithms such as RANSAC, growing region, and alpha shapes, and I have also applied filters to reduce the noise in the DSM, but it has been useless, and the buildings with correct height, slope, and angle of the roofs are not displayed properly. Continue reading...