CityGML2OBJs – a robust semantic-aware tool for converting CityGML to OBJ


I have released the code of CityGML2OBJs, a tool for converting CityGML files to OBJ. The source and manual of the code can be found on Github. The methodology is published in a research paper:

Biljecki, F., & Arroyo Ohori, K. (2015). Automatic Semantic-preserving Conversion Between OBJ and CityGML. Eurographics Workshop on Urban Data Modelling and Visualisation 2015, Delft, Netherlands, pp. 25-30. [PDF] [DOI]

OBJ is probably the most supported 3D format, and converting your CityGML files to OBJ opens a door to a large number of software packages and use(r)s.

Besides the conversion, the tool features some additional options reflected through the suffix “s” in its name:

  • semantics–decoupling of thematically structured surfaces in CityGML and converting them into separate OBJs (that’s where the “OBJs” in the name come from). For instance, below you can see the rendering of an OBJ that contains only WallSurface polygons.sem-tri
  • structured objects–separation and storage of buildings into multiple objects in OBJ by structuring faces that belong to a building into the same group.
  • “see” the attributes from a CityGML file–the utility converts quantitative attributes into colours to support their visualisation. OBJ does not really support the concept of attributes, hence if the CityGML file contains an attribute, this is generally lost in the conversion. However, this converter is capable of converting a quantitative attribute to OBJ as a texture (colour) of the feature. For instance, if the attribute about the yearly solar irradiation is available for each polygon in the CityGML file, it is converted to a graphical information and attached to each polygon as a surface, so now you can easily visualise your attributes in CityGML.
  • sturdy–it checks polygons for validity, considers different forms of geometry storage in GML (e.g. gml:pos and gml:posList), detects for lack of boundary surfaces, etc.

Other features:

  • Supports polygon holes by triangulating all surfaces. Besides the holes, this is done by default because some software handles OBJs only if the faces are triangulated, especially when it comes to the texture, so not only holey polygons are triangulated.
  • It re-uses repeating vertices, resulting in a reduced file size and redundancy
  • Batch processing of multiple files

Visit the Github page, and please let me know if you encounter a bug and/or have a suggestion.