Unable to Tile CityGML in Cesium (germany data)

Dear Cesium-Team,

Could you please check why I am not able to upload the attached citygml data into cesium ion?

It is an official German open data for the state of the Saxany

Many thanks for your support

Best,

Mohammad

lod2_33460_5668_2_sn_citygml.zip (12.4 MB)

Looks like potentially malformed GML, from the error log. Going to take a deeper look.

Hm. The GML itself looks fine; the errors are complaining about expecting core:externalReference nodes where it’s encountering core:informationSystem nodes (which, per the schema and subject under test, are a child node of core:externalReference). Which means it may be a bug in how libcitygml deals with externalReferenceType.

I’m Bryan from the Cesium Ion team.

Unfortunately, our support for CityGML is not exhaustive. We use libcitygml for parsing CityGML, and it looks like it’s failing on the <core:externalReference> tags in that file. On visual inspection, they appear to be correct in the file as defined by the schema. We’re looking at whether it’s a problem in libcitygml, or just in our handling of the emitted element. If it’s the latter, we’ll try to support the feature.

Thank you for your patience; I’ll keep this thread up to date as there’s news.

Thank you so much, dear Bryan.

Until I get an answer from your side, Could you please tell me how should modify the data to be acceptable by cesium ion?

Thanks a again for support :folded_hands:

Hi dear @Mohammad_Hosseinghol ,

If we compare the Saxony CityGML dataset to the versions from other German states such as Baden-Württemberg, we can find that the problem lies in how the data is structured.

The original Saxony CityGML files include a <gml:boundedBy> element inside every individual building. Each building defines its own coordinate reference system (CRS) through an attribute such as:

<gml:Envelope srsName="urn:ogc:def:crs,crs:EPSG:6.12:25833,crs:EPSG:6.12:7837">

However, Cesium Ion expects a valid CityModel-level envelope (global bounding box) and a single consistent CRS definition at the top level. When the CRS is repeated per building, Ion cannot identify a unified spatial reference, and tiling fails with the message “Input does not contain any eligible features for tiling.”

To resolve this, I wrote a Python script that performs the following corrections:

  1. Removes all per-building <gml:boundedBy> elements.

  2. Computes the global bounding box (min/max coordinates) from all buildings.

  3. Adds a single <gml:boundedBy> under <core:CityModel> with:

    <gml:Envelope srsName="urn:adv:crs:ETRS89_UTM33*DE_DHHN2016_NH" srsDimension="3">
    Or srsName="EPSG:25833" srsDimension="3" which is simple.
    
  4. Replaces the root <core:CityModel> namespaces and schema locations with the official AdV (Germany) schema definitions.

  5. Reformats the entire XML with proper indentation and encoding.

  6. Optionally compresses each fixed CityGML file back into a .zip ready for upload to Cesium Ion.

After applying this fix, the data uploads and tiles correctly in Cesium Ion — identical to the behavior of CityGML data from other federal states.

If you’re still experiencing issues, please ensure the corrected file structure looks like this at the top level:

<core:CityModel
    xmlns:gml="http://www.opengis.net/gml"
    xmlns:core="http://www.opengis.net/citygml/1.0"
    xmlns:bldg="http://www.opengis.net/citygml/building/1.0"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/citygml/building/1.0 http://repository.gdi-de.org/schemas/adv/citygml/building/1.0/buildingLoD2.xsd">
  <gml:name>LoD2_Sachsen_fixed</gml:name>
  <gml:boundedBy>
    <gml:Envelope srsName="EPSG:25833" srsDimension="3">
      <gml:lowerCorner>4604248.362 5606945.726 209.783</gml:lowerCorner>
      <gml:upperCorner>4604261.202 5606948.596 222.935</gml:upperCorner>
    </gml:Envelope>
  </gml:boundedBy>

Once formatted this way, Cesium Ion recognizes the dataset and generates 3D tiles successfully.

Best regards,

Cephas MWIMANGIRE.

1 Like

@MWIMANGIRE_CEPHAS That sounds interesting. I don’t have much context about CityGML and the tiling error, but am curious: Is this Python script publicly available, so that others can easily try out whether it resolves their issues?