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


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

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 (

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:

1 Like


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: 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 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.


Awesome, works perfectly!


Hello I want work with citygml-to-3dtiles, but when I try with example Delft I get ERRor
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:

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:

When using the project as a NodeJS library you *can* configure
additional projections:

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.


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.


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!