Converting to/from CityGML files
The open-source software citygml-tools allows us to automatically convert between CityGML and CityJSON, and vice-versa.
Download its latest release (v1.4.3 at the time of writing this), and unzip its content.
Open a console/terminal (also called “Command Prompt” in Windows)
The executable is at the root of the folder, type
Conversion CityGML -> CityJSON
Download this CityGML file of The Hague (or any CityGML files; these can have textures too), and place it in a given folder (say
/home/elvis/temp/data/) To convert it to CityJSON:
./citygml-tools to-cityjson /home/elvis/temp/data/DenHaag_01.xml
Voilà, this creates a new CityJSON v1.0 file:
To upgrade the file to CityJSON v1.1:
cjio DenHaag_01.json upgrade save DenHaag_01.city.json
If you drag that file into the viewer ninja, you can view it:
Conversion CityJSON -> CityGML
From the CityJSON file, a new GML file can be created with that command