Converting CityGML to INSPIRE 3D Buildings (Annex III)

Sydney Dombowsky
Sydney Dombowsky
  • Updated

Introduction

In this tutorial, we will convert CityGML to INSPIRE Annex III Buildings. Building models are often stored in CityGML, and this format has strongly influenced the model for INSPIRE 3D Buildings.

INSPIRE 3D Buildings GML has several differences compared to CityGML. CityGML comprises feature types, such as windows and doors, that are not required by the INSPIRE Buildings specifications. INSPIRE GML includes attributes to support INSPIRE’s mandate, many of which are common to other INSPIRE themes. Additionally, INSPIRE specifications state that, unlike CityGML, parts cannot have subparts, and appearances are simplified.

This tutorial, we will read CityGML data, then create and populate INSPIRE required attributes. We will simplify and aggregate geometry to match the INSPIRE specifications, then write to INSPIRE BuildingPart GML. 

The source data and complete workspace can be downloaded from the files section.

INSPIRE is a European Union (EU) directive that requires member states and agencies to share spatial data in order to better support environmental decision-making. For more on INSPIRE Buildings please, view the data specifications.

Step-by-Step Instructions

Transforming CityGML into INSPIRE GML

1. Read Source CityGML Feature Types 

Open a new workspace in FME Workbench and add an OGC CityGML 3 reader with the following parameters:

  • Format: OGC CityGML 3
  • Dataset: /Buildings.xml
    • Browse to source dataset
  • Individual Feature Types: Enabled

Click OK. In the Select Feature Types dialog, select the following then click OK to add the reader to the canvas:

  • GroundSurface
  • WallSurface
  • RoofSurface

This tutorial uses the CityGML 3 reader, but can be applied for older versions of CityGML as well.

 

2. Define INSPIRE Attributes and Perform Schema Mapping 

We will create and populate INSPIRE attributes using an AttributeCreator transformer. Connect the GroundSurface, RoofSurface, and WallSurface reader feature types to an AttributeCreator Input port.

Open the AttributeCreator parameters and add the following INSPIRE attributes:

Output Attribute Value
inspireId.Identifier.namespace EU.JRC.BU
beginLifespanVersion 2013-01-15T00:00:00
_geometry_name geometry3DLoD2.BuildingGeometry3DLoD2.geometryMultiSurface
geometry3DLoD2.BuildingGeometry3DLoD2.horizontalGeometryEstimatedAccuracy.uom m
geometry3DLoD2.BuildingGeometry3DLoD2.horizontalGeometryEstimatedAccuracy 1.0

 

3. Copy gml_id Attribute

Add an AttributeCopier to the canvas and connect it to the AttributeCreator Output port. Open the parameters and set the attributes to copy:

Input Attribute Output Attribute
gml_id inspireId.Identifier.localId

 

4. Reproject Data

Add a CsmapReprojector transformer to the canvas and connect its Input port to the AttributeCopier Output port.

Open the parameters and set the coordinate system to ETRF89.Europe/Lambert.

  • Destination Coordinate System: ETRF89.Europe/Lambert

 

5. Build Geometry 

We will simplify the geometry using a GeometryPropertyRemover transformer by removing all geometry traits. 

Connect the CsmapReprojector Reprojected output port to a GeometryPropertyRemover Input port. Leave the parameters as the default.

The geometries will be grouped together into multiple geometries.

 

6. Aggregate Geometry

Add an Aggregator connected to the GeometryPropertyRemover Removed output port and open the parameters to set the following:

  • Group Processing: Enabled
    • Group By: gml_id
      • Click the ellipsis to select attribute
  • Accumulation Mode: Merge Incoming Attributes
  • Aggregate Type: Homogenous Collection (If Possible)
  • Geometry Label Attribute: _geometry_name

This will group geometries together based on gml_id into multiple geometries.

 

7. Remove CityGML Hierarchical Attributes

Since we are converting CityGML to INSPIRE GML, the hierarchical parent-child structure of CityGML is not required. We will remove the associated attributes using an AttributeRemover.

Connect the Aggregator Aggregate output port to an AttributeRemover Intput port. Open the AttributeRemover parameters and set the following:

  • Attributes to Remove: gml_parent_id,gml_parent_property
    • Click the ellipsis to browse all attributes

 

8. Output INSPIRE GML

Add an INSPIRE GML writer and set an output location. We will also use the BuildingsCore3D INSPIRE theme.

The Building feature type, BuildingPart, is described as a subdivision of a building (ground, wall and roof surfaces). As well, the building model level of detail (LoD) 2 is used. In LoD 2, a BuildingPart is represented in a generalized manner.

  • Format: INSPIRE GML
  • Dataset: /INSPIREGML_buildings.xml
    • Choose an output location and file name
  • Parameters: 
    • Select Feature Types: by Themes
    • INSPIRE Themes: "BuildingsCore3D (v4.0)"
      • You can browse the available themes by clicking the ellipsis button
  • Feature Type Definition: Automatic

Click OK. In the Feature Type dialog, enter the feature type name:

  • Feature Type Name: BuildingPart
    • This must align with INSPIRE GML standards, otherwise no data will be written

Connect the AttributeRemover Output port to the newly added BuildingPart writer. The geometry will be written to the “geometry3DLoD2.BuildingGeometry3DLoD2.geometryMultiSurface” attribute, one of the attributes with type xml_geometry.

 

9. Run Workspace and View Output

Click the Run button in the Toolbar to run the workspace. Once the translation succeeds, open FME Data Inspector.

Click Open and select the output file to view:

  • Format: INSPIRE GML
  • Dataset: /INSPIREGML_buildings.xml

The output dataset should look like this:

 

Validation of INSPIRE 3D Buildings GML

In the Navigator in FME Workbench, the INSPIRE writer has the Validate Output File parameter set to Yes. When the workspace is run, in addition to writing INSPIRE GML, the GML is validated against syntax and the BuildingsCore3D schema (XSD). Once the GML validates, turning off validation can improve writing performance.


 

This example is for demonstration purposes only. The resulting data is not to be used for any operational purposes.

 

Additional Resources

Inspire GML Reader/Writer Documentation

OGC City GML 3 Reader

INSPIRE Documentation

INSPIRE Buildings Data Specifications

 

Data Attribution

The 3DBAG data used here originates from open data made available by the 3D geoinformation research group and 3DGI. It contains information licensed under CC BY 4.0.

Was this article helpful?

We're sorry to hear that.

Please tell us why.

As of January 14th, 2026, comments on knowledge base articles have been closed. To make sure questions don’t get missed and to enable more community support, we’ve moved discussions to the FME Community. If you have a question or a comment about this article, please create a new post or create a support ticket.