3dcitydb / importer-exporter

3D City Database client for high-performance import and export of 3D city model data
Apache License 2.0
128 stars 55 forks source link

Failed to resolve xlink references #308

Closed acgis-pera0044 closed 2 months ago

acgis-pera0044 commented 4 months ago

Hello, I am trying to import a CityGML file I created using FME (From IFC to CityGML). I received multiple errors saying, "Failed to resolve XLink reference". I have done some tests based on the discussion on previous issues created about the same topic (#201) but have not solved the problem.

2204_CityGML2_NAD83_UTM18N_v4.zip I am attaching the CityGML file created with FME.

I would be very happy if someone could help me to guide or solve this problem.

Regards Lisa

yaozhihang commented 4 months ago

Hi Lisa,

Your datasets are unfortunately not valid. You can use the importer/exporter tool to do a quick validation check. See the online doc here: https://3dcitydb-docs.readthedocs.io/en/latest/impexp/import.html

Alternatively, there is a good software "citygml-tools", which also provides the validation functions. https://github.com/citygml4j/citygml-tools

Regards

Zhihang

clausnagel commented 3 months ago

@yaozhihang is right. I also checked your dataset and first of all have to say that I really like the model you have created.

Your dataset unfortunately violates the CityGML schemas. For this reason some of the XLinks in your dataset cannot be resolved. For example, take the gml:id fme-gen-71980d5b-95fc-4749-b044-a5764e478a1b. It belongs to a gml:CompositeSurface on line 25 of the dataset. And this gml:CompositeSurface is assigned an X3DMaterial on line 940294 through an XLink. This looks alright at first glance but the importer still cannot resolve the XLink. To understand why, check lines 11 and 12 of the dataset. The gml:CompositeSurface belongs to a bldg:BuildingInstallation (line 12) which is associated to the building through a bldg:interiorBuildingInstallation property (line 11). However, according to the CityGML 2.0 Building schema, a bldg:BuildingInstallation is not allowed as child of a bldg:interiorBuildingInstallation property. The only allowed subfeature is bldg:IntBuildingInstallation. A subtle but important difference.

Now, what happens is that the bldg:BuildingInstallation on line 12 is skipped and not processed by the importer because it is not allowed at this place. As a consequence, the gml:CompositeSurface on line 25 does not get imported either. And that's finally the reason why the XLink in line 940294 cannot be resolved. When you validate your dataset (e.g. by clicking the "Just validate" button on the "Import" tab of the Importer/Exporter) as suggested by @yaozhihang, this error will be clearly reported.

For test purposes, I simply searched&replaced all occurrences of bldg:BuildingInstallation in your dataset with bldg:IntBuildingInstallation using a text editor. This already helped to substantially reduce the amount of "Failed to resolve XLink reference" error messages.

But even after this change, some XLinks still cannot be resolved. Take the gml:id fme-gen-810616ca-38ad-4158-b547-f7b3ad7c48a1 as another example. When you search your dataset for this gml:id, you can find two XLink references on lines 941166 and 941181 where again an X3DMaterial is assigned to this gml:id. However, there is no surface geometry in your entire dataset with that gml:id. It is simply missing. And that's why this XLink cannot be resolved, of course.

I didn't further investigate your dataset but assume that those two identified issues are the main reasons for your "Failed to resolve XLink reference" error messages. Unfortunately, both issues cannot be magically healed during the import process but require that you fix your FME process that produces the dataset. I guess using bldg:IntBuildingInstallation instead of bldg:BuildingInstallation should be a simple fix.

I hope this has been helpful in giving you an idea of how to correct your data.

clausnagel commented 2 months ago

Closing this issue because it is related to the data but not the Importer/Exporter.