The xeokit SDK allows us to import 3D urban models from CityJSON, a JSON-based
file format specifically designed for lightweight, user-friendly, and human-readable
storage and sharing of 3D models. CityJSON can represent both basic geometric shapes and intricate objects such as
buildings and trees, offering a simple alternative to other formats like CityGML.
In the example below, we'll import a CityJSON file into a SceneModel
and a DataModel. The @xeokit/core!SDKError class
is used to handle errors that may occur during the process:
import { Scene } from"@xeokit/scene"; import { Data } from"@xeokit/data"; import { loadCityJSON } from"@xeokit/cityjson";
xeokit CityJSON Importer
Import 3D urban models from CityJSON format
The xeokit SDK allows us to import 3D urban models from CityJSON, a JSON-based file format specifically designed for lightweight, user-friendly, and human-readable storage and sharing of 3D models. CityJSON can represent both basic geometric shapes and intricate objects such as buildings and trees, offering a simple alternative to other formats like CityGML.
To import a CityJSON model into xeokit, simply use the @xeokit/cityjson!loadCityJSON function, which will load the file into both a SceneModel and a DataModel.
Installation
Usage
In the example below, we'll import a CityJSON file into a SceneModel and a DataModel. The @xeokit/core!SDKError class is used to handle errors that may occur during the process: