FME Version
Files
-
- 600 KB
- Download
Introduction
This example demonstrates an advanced translation of a more complex LOD 200 IFC model to a LOD3 CityGML document. The output contains both LOD2 and LOD3 representations of the Riverside Building.
Downloads
- Download LOD_100 Data (Data can be downloaded from Vectorworks)
- Download LOD_200 Data (Data can be downloaded from Vectorworks)
Step-by-step Instructions
1. Download data
This exercise will be using the DC Riverside Building LOD 100 IFC file as well as the DC Riverside Building ARCH 200 IFC file. Before beginning please download the LOD_100 data and the LOD_200 data from the Vectorworks website.
2. Read source
In this example, the Revit reader is used to read the LOD 200 IFC data. The advantage of this approach is that it provides the “building elements with hierarchy” reader option which assembles and exposes the properties of the building elements. The geometries extracted by the REVIT reader can then more easily be written to a GIS like representation such as a CityGML document.
Add an Autodesk Revit reader to a blank workspace and browse to the DC_Riverside_Bldg-ARCH-LOD_200.ifc dataset. In the parameters ensure that Revit Data View is set to Building Elements with Hierarchy.
AutoDesk Revit Reader parameters
For Feature Types to read select BuildingColumnStair, BuildingElementProxy, Door, Member, Opening, Slab, StairFlight, Wall, and Window. You should have nine feature types on the canvas.
3. Group by CityGML feature types
It is essential to know which building elements or layers of the IFC model are represented by a particular feature type of the of the CityGML document. Sometimes a CityGML feature type corresponds with more than one building element. In this case, they are merged by a common ID so they can be routed to the same feature type together. Since the element IDs of the IFC data are not valid GML IDs, new GML IDs are created for each feature. Additionally, every feature gets an attribute with which it can be joined with the GML ID of its parent, the building feature type, later on.
Add an AttributeCreator transformer to the canvas and connect it to both the StairFlight and BuildingElementProxy. In the parameters, append _BldgInstallations to the Transformer Name. Then create a new attribute called feature_type and give it the value of BuildingInstallation. Create a second attribute called parent_name and give it the value of dc_riverside_building. Finally, create a third attribute called _uuid and give it the value of gml_@UUID()
Create three new attributes using an AttributeCreator
Duplicate the AttributeCreator and connect it to both BuildingColumn and Member. In the parameters append _BldgParts to the Transformer Name and change the value of feature_type to BuildingPart.
Duplicate the AttributeCreator three more times and set them up as follows:
Connect to Feature Type | Append Transformer Name | feature_type Value | |
AttributeCreator_3 | Walls | _Walls | Wall |
AttributeCreator_4 | Slab | _FloorRoof | Floor_Roof |
AttributeCreator_5 | Window and Door | _Openings | Windows_Doors |
The Opening Feature Type will remain unconnected for now.
AttributeCreator parameters and connections for each Feature Type
4. Scale and create a coordinate system
The model is currently in millimetres and will need to be scaled to meters. Add a Scaler transformer to the canvas and connect it to all of the AttributeCreators. In the parameters set X, Y, and Z to 0.001.
There is no coordinate system information stored in the IFC. The LocalCoordinateSystemSetter transformer still allows us to tag all features with an auto-generated local reference system (AZMEA). Add a LocalCoordinateSystemSetter to the canvas and connect it to the Scaler. In the parameters, set the following:
Origin Coordinate System | LL84 |
Origin X | -76.986560155564575 |
Origin Y | 38.876070469421258 |
LocalCoordinateSystemSetter parameters for Origin X and Y
Finally, the coordinate system to will need to be changed. Add a CsmapReprojector transformer to the canvas and connect it to the LocalCoordinateSystemSetter. In the parameters set the Destination Coordinate System to EPSG:2248 and set the Vertical Handling to Heights are relative to the ellipsoid(s) or geocentric.
5. Create building feature type
The hierarchy of an IFC model is often more complex than the hierarchy of the CityGML document. In this example, the CityGML model is assembled in a simplified way that all building elements are children of the building feature type, except for the openings.
Add an Industry Foundation Class STEP Files (IFC) Reader to the canvas and browse to the DC_Riverside_Bldg-LOD_100.ifc dataset. In the parameters change the Read IfcSpace Geometries to Yes. In the Select Feature Types dialog select only IfcSpace and IfcSlab.
IFC Reader parameters; change Read IfcSpace Geometries to Yes
Next, a single mesh will need to be created. Add a Triangulator transformer to the canvas and connect it to both IfcSpace and IfcSlab. In the parameters, ensure that Aggregate Handling is set to Deaggregate. Then add a MeshMerger transformer to the canvas and connect it to the TINSurface output port on the Triangulator.
Connect the Triangulator to IfcSlab and IfcSpace, the the MeshMerger to the TINSurface output port
6. Create CityGML Attributes
There is no need to create every single CityGML feature type. All feature type schemas can be imported from the CityGML_feature_types.xml file which can be found in the XML folder of a Safe FME installation. To create a CityGML document it is important to set valid geometry, feature roles, and a level of detail for every feature. The geometry role has to be set as a trait on the geometry. This trait is used by the CityGML writer to create the correct and valid geometry for the feature. The feature roles and levels of detail are set as attributes.
Add a CityGMLGeometrySetter transformer to the canvas and connect it to the MeshMerger. This is a custom transformer that creates the CityGML Feature Role and Level of Detail attributes, which follow a strict naming convention. Using the transformer prevents case sensitive typos. In the parameters, set the CityGML Lod Name to lod2Solid and then set the Feature Role to cityObjectMember.
Next, add an AttributeCreator to the canvas and connect it to the CityGMLGeometrySetter. In the parameters, create the following attributes:
Attribute Name | Attribute Value |
citygml_level_of_detail | 2 |
gml_id | gml_@UUID() |
gml_name | dc_riverside_building |
7. Write building out to CityGML
Highlight and duplicate the Scaler, LocalCoordinateSystemSetter and the CsmapReprojector transformers. Connect the Scaler_2 to the AttributeCreator connected to the IfcSpace and IfcSlab workflow.
Add a CityGML writer to the canvas and browse to a folder to save, name the file riverside_lod3.gml. The default parameters are ok but set the Feature Type Definition to Automatic. Next, in the Feature Type window, change the Feature Type Name to Building. Connect it to the CsmapReprojector_2.
Workflow to create a Building in CityGML
8. Join with parent gml_id
Next, join the building elements with the building, add a FeatureMerger transformer to the canvas. Connect the CsmapReprojector from the Building Elements workflow to the Requestor input port and then connect to AttributeCreator from the IfcSpace and IfcSlab workflow to the Supplier input port.
Join the workflow from the Revit Reader and IFC Reader to the FeatureMerger
In the parameters, set the Join On Requestor to parent_name and then the Supplier to gml_name. Set the Attribute Accumulation Mode to Prefix Supplier and add the Prefix suppl_.
FeatureMerger parameters; Join on parent_name and gml_name, and set the Prefix to suppl_
9. Keep and create Attributes
There are a bunch of attributes that were read in that are not needed. Add an AttributeKeeper transformer to the canvas and connect it to the Merged output port on the FeatureMerger, then select only the following attributes to keep:
- _uuid
- Element_id
- element_parent_id
- feature_type
- name
- Peset_SlabCommon.IsExternal
- suppl_gml_name
AttributeKeeper parameters
Add an AttributeCreator to the canvas and connect it to the AttributeKeeper. In the parameters set the following:
Attribute Name | Attribute Value |
citygml_level_of_detail | 3 |
gml_id | _uuid |
gml_parent_id | suppl_gml_id |
10. Filter attributes
Now that all the features have received the appropriate CityGML attributes, they need to be styled according to their type. Separate out the Feature Types using the AttributeFilter transformer. Add an AttributeFilter transformer to the canvas and connect it to the AttributeKeeper. In the parameters, set the Attribute to Filter by to feature_type. Then for Possible Attribute Values type in the following:
- BuildingInstallation
- BuildingPart
- Floor_Roof
- Wall
- Windows_Doors
AttributeFilter parameters to separate out parts
11. Building Installations and Building Parts
The specification for building installations and building parts are different depending on their selected geometry and feature roles. It is crucial to know which roles are valid for certain feature types, to write a valid CityGML document. Building installations is an example of one of the least restrictive geometry roles in CityGML. An arbitrary GML geometry can represent the lod3Geometry whereas building parts are limited to lod3Solid, lod3Multisurface, lod3Multicurve, and lod3TerrainIntersection. For an IFC to CityGML translation, lod3Mulitsurface might be the safest choice, because some features might not build valid solid geometries if lod3Solid is used.
Add a CityGMLGeometrySetter to the canvas and connect it to the BuildingInstallation output port on the AttributeFilter. In the parameters set the CityGML Lod Name to lod3Geometry and set the Feature Role to outerBuildingInstallation.
Next, add an ApperanceSetter transformer to the canvas and connect its Geometry Input port to the CityGMLGeometrySetter_2. In the parameters, expand Color Parameters and set the Appearance Name to Installation, set the Diffuse color to 0.317647,0.317647,0.317647 and then set the Alpha to 1.
AppearanceSetter parameters, set the Appearance Name, Diffuse Color and Alpha.
Add a writer feature type and name it BuildingInstallation, connect it to the Output port on the AppearanceSetter.
Duplicate the CityGMLGeometrySetter, AppeareanceSetter and Writer Feature Type. Connect the duplicates to the Building Part output port on the AttributeFilter.
In the CityGMLGeometrySetter_3 change the CityGML Lod Name to lod3MultiSurface and the Feature Role to consistsOfBuildingPart. In the AppearanceSetter_2 change the Appearance Name to Part and the Diffuse Color to black. Finally, rename the Writer Feature Type to BuildingPart.
BuildingPart and Building Installation workflow
12. Roof, Walls, and Floors
Add another CityGMLGeometrySetter to the canvas; this time connect it to the Floor_Roof, and Wall output ports on the AttributeFilter. In the parameters, set the CityGML Lod Name to lod3MultiSurface and the Feature Role to boundedBy.
Next split the features into their parts, add a TestFilter transformer to the canvas. In the parameters set the first IF test condition to Name Contains ROOF OR Pset_SlabCommon.IsExternal = Yes then set the Output Port to Roof
Set the Else If to Name Contains Wall and the Output Port to Wall
Set the Else Output Port to Floor
TestFilter parameters to create the output ports Roof, Wall and Floor
Next, add an AppearanceSetter and connect the Geometry input port to the Roof output port on the TestFilter. In the parameters set the Appearance Name to Roof, the Diffuse Color to Red and the Alpha to 1. Add another Writer Feature Type and name it RoofSurface and connect it to the Output port on the AppearenceSetter.
Duplicate the AppearenceSetter and the Writer Feature Type and connect it to the Wall output port on the TestFilter. In the AppearanceSetter parameters change the Appearance Name to Wall and the color to a light yellow. Rename the Writer Feature Type to WallSurface.
Duplicate the AppearenceSetter and the Writer Feature Type once more and connect it to the Floor output port. In the AppearanceSetter parameters change the Appearance Name to Floor and the color to brown. Rename the Writer Feature Type to FloorSurface.
Workflow for Roof, Wall and Floor CityGML features
13. Preserve hierarchy
The opening layer of the IFC model can supply every door and window with an element ID of the wall it belongs to. To transform this two-levelled hierarchy to the hierarchy we need in CityGML, two joins are required.
The first join is joining the Opening Feature Type that was added earlier with the Wall. Add a FeatureMerger to the canvas and connect the Wall output port from the AttributeFilter to the Supplier input port. Then connect the Opening Feature Type to the Requestor input port. Set the Join On Requestor to element_parent_id and the Supplier to element_id. Then set the Attribute Accumulation Mode to Prefix Supplier and add the Prefix suppl_wall_.
Add another FeatureMerger to the canvas and connect the Windows_Doors output port on the AttributeFilter to the Requestor input port then connect the Merged output port of the previous FeatureMerger to the Supplier input port. Set the Join On Requestor to element_parent_id and the Supplier to element_id. Then set the Attribute Accumulation Mode to Prefix Supplier and add the Prefix suppl_.
Preserve hierarchy workflow for Openings
14. Windows and Doors
The final step in creating the window and door features is to set the CityGML attributes and apply an appearance. Add an AttributeCreator and connect it to the Merged output port. In the parameters set the following:
Attribute Name | Attribute Value |
citygml_lod_name | lod3MultiSurface |
citygml_level_of_detail | 3 |
citygml_feature_role | opening |
gml_id | _uuid |
gml_parent_id | suppl_suppl_wall_uuid |
Then connect a GeometryPropertySetter to the AttributeCreator. In the parameters set the Source Attributes to citygml_lod_name.
Separate out of the windows and doors, do this by adding a Tester transformer to the workspace and connect it to the Set output port on the GeometryPropertySetter. Set the test to Name = Window.
Add an AppearanceSetter to the canvas and connect it to the Passed output port on the Tester, this will set the appearance for the windows. In the parameters, set the Appearance Name to Window and set the Diffuse Color to a light blue. To achieve a transparent glass-like effect for the window’s appearance set the Alpha to 0.2 and the Shininess to 1.
Add another Writer Feature Type and name it Window and connect it to the Output port on the AppearenceSetter.
Add another AppearanceSetter and connect it to the Failed output port on the Tester, this will set the appearance for the doors. In the parameters, set the Appearance Name to Door, the Diffuse color to light brown and Alpha to 1.
Add another Writer Feature Type and name it Door and connect it to the Output port on the AppearanceSetter.
Entire completed workspace
15. Inspect and Validate the CityGML document
Before running the workspace, ensure that Rejected Feature Handling is set to Continue Translation then Run the workspace.
Output CityGML file viewed in the FME Data Inspector
Validation
Opening the resulting CityGML file in the Data Inspector allows the user to check for missing geometries or wrong appearances. The XMLValidator transformer can be used to validate a CityGML document. A Creator transformer connected to the XMLValidator starts the validation. In the XMLValidator parameters, the CityGML file is selected as the input, and the appropriate schema file is chosen for schema validation. For CityGML 1.0 use:
<FMEHome>\xml\schemas\CityGML\CityGML\1.0.0\CityGML.xsd
If you see errors or geometries dropped when writing to CityGML, you can also use the GeometryValidator transformer to check for 2D and 3D geometry errors on your output before the features are written. There are even repair options, though these should be used with some caution and results verified since any repair always has a chance of introducing new errors.
Data Attribution
Riverside Building demo project data produced by Nemetschek Vectorworks.
Comments
0 comments
Please sign in to leave a comment.