Command-line tools for converting CityJSON models into xeokit's optimized XGF format.
Features
Converts CityJSON files into XGF, xeokit's compact geometry format for large-scale models.
Optionally generates a JSON file containing a data model that preserves the CityJSON model's object hierarchy.
Supports all versions of XGF for backward compatibility.
XGF contains only geometry and color—textures are not included.
Installation
npminstall@xeokit/sdk
Usage
Converting a CityJSON File to XGF
Use the cityjson2xgf CLI tool to convert a CityJSON file into an XGF file.
Optionally, generate a JSON file containing a structured representation of the CityJSON model's hierarchy.
Options: -v, --version Output the version number -i, --source [file] Path to the source CityJSON file -s, --scenemodel [file] Path to the target XGF file -d, --datamodel [file] Path to the optional JSON data model file, extracted from the CityJSON hierarchy -f, --format [number] Target XGF version (default: 1, supported versions: 1) -h, --help Display help information
Example: Converting CityJSON to XGF
The following command converts a CityJSON file into an XGF file.
The XGF format retains the geometry and material colors from the CityJSON file.
Once converted, the XGF file can be loaded into a xeokit SceneModel
using the loadXGF() function for optimized visualization.
nodecityjson2xgf-iduplex.json-sduplex.xgf
Example: Extracting Scene Hierarchy
This example converts a CityJSON file to XGF and also generates a JSON file
that represents the CityJSON model's object hierarchy.
The JSON file can then be loaded into a xeokit DataModel
using Data.createModel().
By default, CityJSON files are converted to the latest XGF version.
If you need to generate an XGF file compatible with a specific version,
you can specify the format version using the -f flag.
xeokit CityJSON → XGF Converter
Command-line tools for converting CityJSON models into xeokit's optimized XGF format.
Features
Installation
Usage
Converting a CityJSON File to XGF
Use the
cityjson2xgf
CLI tool to convert a CityJSON file into an XGF file. Optionally, generate a JSON file containing a structured representation of the CityJSON model's hierarchy.Example: Converting CityJSON to XGF
The following command converts a CityJSON file into an XGF file. The XGF format retains the geometry and material colors from the CityJSON file. Once converted, the XGF file can be loaded into a xeokit SceneModel using the loadXGF() function for optimized visualization.
Example: Extracting Scene Hierarchy
This example converts a CityJSON file to XGF and also generates a JSON file that represents the CityJSON model's object hierarchy. The JSON file can then be loaded into a xeokit DataModel using Data.createModel().
Example: Converting to a Specific XGF Version
By default, CityJSON files are converted to the latest XGF version. If you need to generate an XGF file compatible with a specific version, you can specify the format version using the
-f
flag.