citygml4j / citygml-tools

Collection of tools for processing CityGML files
Apache License 2.0
115 stars 18 forks source link

Option to configure ID generation #47

Closed lordi closed 1 year ago

lordi commented 1 year ago

If a CityObject does not have a gml:id, an ID will be generated for this object when reading. These IDs will also be used when transforming CityGML to CityJSON.

While it is nice to have deterministic IDs, the following does not work:

Can we make the IDs globally unique (i.e. random/non-deterministic) or have something like --id-prefix that will be used in the ID generation process?

clausnagel commented 1 year ago

Hi @lordi, it's not supposed to be like this. Missing IDs should be replaced with "ID_" + a random UUID. Thus, the resulting IDs should already be globally unique. I did a small test and the result looks ok. I wonder why you always get ID_1.

Are you using citygml-tools v2 or v1? Could you share an excerpt of your data for testing?

lordi commented 1 year ago

Thanks for the quick response. The ID_1 was just a placeholder for a non-random UUID. I'm using v2.1.

I did some more research. Most IDs are indeed random, but certain objects get a non-random UUID. have a dataset where some objects get assigned the same ID every run (specifically, these are Buildings in a CityObjectGroup). This ID does not appear in the CityGML. Does it ring a bell? Otherwise I can send you a dataset by mail.

clausnagel commented 1 year ago

Ok, seems to be reproducible then, that's good. Yes, please send a dataset by email because I actually don't know why buildings inside a group would make a difference.

clausnagel commented 1 year ago

Thanks @lordi, the test dataset was really helpful. I fixed the bug with bd361ad4e7da911c82ed1ded78d878a6869a9960.

The bugfix will be included in the next release. In the meantime, you can either use the edge Docker image from Docker Hub or build citygml-tools from the master branch.

lordi commented 1 year ago

Awesome, thanks @clausnagel . Will test the change.

lordi commented 1 year ago

I can confirm that the patch works as expected. Thanks again!