First the complete building is split up into these basic structures. This step can be realized fully automatic by the analysis of the given ground plan. Figure 5 shows the automatic decomposition of a complex ground plan into rectangular structures. Each of these rectangles defines one building primitive. Since position, orientation and horizontal extension of each cuboid is already defined by the rectangle, only the height of each cuboid as well as roof type and roof slope have to be determined as remaining parameters of each building primitive. The parameters of the building primitives are estimated by a least squares adjustment which minimizes the distances between the DSM surface and the corresponding points of the building primitive, i.e. the building primitives are fit into the DSM surface. In order to apply the least squares adjustment first the appropriate model has to be selected. Additionally roof regions which do not fit to the selected model have to be excluded from the least squares adjustment to avoid gross errors of the estimated parameters. Both tasks can be solved by a segmentation of the DSM into planar surfaces.