# A Simplified CityGML-Based 3D Indoor Space Model for Indoor Applications
## 4 Implementation
### Data Extraction
The walls of each story are filtered out according to the story ID by AttributeFilter, as shown in Figure 19. The same applies to other building components. Figure 19: Filtering of walls in each story. Figure 18: Transformation of spatial reference system. Extraction of the building components  
As described in Section 3.2.2, the extracted surfaces of the building components, such as floors, ceilings, and walls, are all centered in the original building components, and doors, windows, and walls are in one plane. Since the walls of the building are perpendicular to the floors and ceilings, the following steps are followed to extract the building components in this work. First, the walls and stairs of a story are processed to extract the 2D center walls and the 2D bounding box, respectively, which are overlaid to generate the final 2D center walls of the story. The doors and windows of the story are projected to a plane to clip the final 2D center walls to generate the 2D doors and windows. Second, the center positions of the original upper and lower floors (IfcSlab) associated with the story are calculated as the elevations of the ceiling and floor of the story, respectively. Surfaces are constructed by _AreaBuilder_ based on the final 2D center walls and assigned the elevations by _3 DForcer_ to obtain the final ceilings and floors, of which the gml_parent_id is set as gml_id of the building. Note that if the story has adjacent stories, the ceilings of the story will be overlaid on the floors upstairs to meet the maximal segmentation before the final ceilings are obtained. Similarly, the floors of the story should be overlaid on the ceilings downstairs to obtain the final floors. The extractions of the ceilings and floors are shown in Figures 20 and 21, respectively. Finally, the final 2D center walls are assigned the elevation of the floors, which are extruded by the height of the story to obtain the initial interior walls of the story. The doors and windows are assigned elevations, and extruded by the respective heights to obtain the final doors and windows, which are overlaid with the initial interior walls by SurfaceOnSurfaceOverlayer to obtain the final interior walls. The parent ID: gml_parent_id of the interior walls is set as ID: gml_id of the building, while the parent ID: gml_parent_id of the doors and windows are is set as the ID: gml_id of the interior walls since the doors and windows belong to _Openings_. The extractions of interior walls, doors and windows are shown in Figure 22.  
Figure 21: Extraction of floors. Figure 20: Extraction of ceilings. * Generation of Indoor Spaces  
Rooms can be constructed through _SolidBuilder_ using the building components extracted above. However, the solid entities constructed in this way have redundant geometric information instead of being built by CityGML XLinks. Therefore, it is necessary to remove the geometric information and set the xlink_href property on the extracted building components before constructing the rooms. In this work, a customized transformer _RoomBuilder_ is used to implement the construction of each interior space, as shown in Figure 23.