citygml-to-3dtiles - basic conversion from CityGML to 3DTiles

Hello

I've created a very basic (!) JavaScript program to convert CityGML files to batched 3DTiles, which can then be loaded in Cesium.

https://github.com/njam/citygml-to-3dtiles

It works by reading the XML, extracting buildings (only buildings for now), converting coordinates of the geometric primitives, and then writing a single batched 3DTiles file.
The code for writing 3DTiles is based on the 3D Tiles Samples Generator (https://github.com/AnalyticalGraphicsInc/3d-tiles-tools/tree/master/samples-generator).

If you want to try it out, make sure you have a recent version of NodeJS with ESM module support (I'm using v9.9).

To convert the "3dified" CityGML of Delft:

2 Likes

Hi,

Very useful tool! I have tried it on my own dataset, and it seems to work very well. I have noticed one small thing though: concave shapes are not always rendered correctly (example from the Delft dataset: https://imgur.com/a/eBBxA). I would love to contribute and fix it, but unfortunately I am not sufficiently familiar with node.js. If you would be able to have a look at it, could you please let me know?

Thanks!

Thanks for the feedback Jelle!

Indeed the triangulation for concave "linear rings" was completely wrong.
I'm now using a library to do that (libtess.js), and it works much better:

I've released a new version v0.0.4.

Regards
Reto

Awesome, works perfectly!

Thanks!
Jelle

Hello I want work with citygml-to-3dtiles, but when I try with example Delft I get ERRor
image.png
   
Can you help me
Thank You!

@Denis the image you wanted to upload doesn't show up.
Feel free to open a ticket on Github if it's easier:
https://github.com/njam/citygml-to-3dtiles/issues

Hi Reto,

I would like to seek for your assitance regarding to the issue I faced.

Script ((below):

Hey Rex

Currently only a few predefined projections are available.
I've added the projection you mentioned to the list of predefined projections:
https://github.com/njam/citygml-to-3dtiles/commit/644d2ca21081a25e945f45ae9116f4ef83f2aaa6

When using the project as a NodeJS library you *can* configure
additional projections:
https://github.com/njam/citygml-to-3dtiles#option-srsprojections

It should be easy enough to allow passing additional projections from
a command line argument. Unfortunately I currently don't have the time
to implement it. If you do, I will be happy to accept a pull request.

Hope that helps.

Regards
Reto

Hi Reto,

found your tool, but got problems with bug datasets - indexBuffer value out of bounds, if you use indexBuffer.writeUInt16LE - it is bounded to 65535.

Rüdiger

Hello Rüdiger

Unfortunately I haven't seen that error message before, and therefore
cannot help you with a solution.
I'm not actively using/maintaining "citygml-to-3dtiles" (it was more
of a personal experiment). I hope you find a way to solve the problem!

Regards
Reto