# ITwinData

engine/Source/Scene/ITwinData.js 11
Methods for loading iTwin platform data into CesiumJS

##### Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

##### See:

- ITwinPlatform

### Methods

#### static Cesium.ITwinData.createDataSourceForRealityDataId(options) → Promise.<(GeoJsonDataSource|KmlDataSource)>
engine/Source/Scene/ITwinData.js 181

Create a data source of the correct type for the specified reality data id. This function only works for KML and GeoJSON type data. If the `type` or `rootDocument` are not provided this function will first request the full metadata for the specified reality data to fill these values.

Name | Type | Description
--- | --- | ---
`options` | object |
Name | Type | Description
--- | --- | ---
`iTwinId` | string | The id of the iTwin to load data from
`realityDataId` | string | The id of the reality data to load
`type` | ITwinPlatform.RealityDataType | optional The type of this reality data
`rootDocument` | string | optional The path of the root document for this reality data

##### Returns:

##### Throws:

- RuntimeError : if the type of reality data is not supported by this function

#### static Cesium.ITwinData.createTilesetForRealityDataId(options) → Promise.<Cesium3DTileset>
engine/Source/Scene/ITwinData.js 109

Create a tileset for the specified reality data id. This function only works with 3D Tiles meshes and point clouds. If the `type` or `rootDocument` are not provided this function will first request the full metadata for the specified reality data to fill these values. The `maximumScreenSpaceError` of the resulting tileset will default to 4, unless it is explicitly overridden with the given tileset options.

Name | Type | Description
--- | --- | ---
`options` | object |
Name | Type | Description
--- | --- | ---
`iTwinId` | string | The id of the iTwin to load data from
`realityDataId` | string | The id of the reality data to load
`type` | ITwinPlatform.RealityDataType | optional The type of this reality data
`rootDocument` | string | optional The path of the root document for this reality data
`tilesetOptions` | Cesium3DTileset.ConstructorOptions | optional Object containing options to pass to the internally created `Cesium3DTileset`.

##### Returns:

##### Throws:

- RuntimeError : if the type of reality data is not supported by this function

##### Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

#### static Cesium.ITwinData.createTilesetFromIModelId(options) → Promise.<(Cesium3DTileset|undefined)>
engine/Source/Scene/ITwinData.js 47

Create a `Cesium3DTileset` for the given iModel id using iTwin's Mesh Export API. If there is not a completed export available for the given iModel id, the returned promise will resolve to `undefined`. We recommend waiting 10-20 seconds and trying to load the tileset again. If all exports are Invalid this will throw an error. See the iTwin Platform Mesh Export API documentation for more information on request parameters

Name | Type | Description
--- | --- | ---
`options` | object |
Name | Type | Description
--- | --- | ---
`iModelId` | string | The id of the iModel to load
`tilesetOptions` | Cesium3DTileset.ConstructorOptions | optional Object containing options to pass to the internally created `Cesium3DTileset`.
`changesetId` | string | optional The id of the changeset to load, if not provided the latest changesets will be used

##### Returns:

A promise that will resolve to the created 3D tileset or `undefined` if there is no completed export for the given iModel id

##### Throws:

- RuntimeError : If all exports for the given iModel are Invalid
- RuntimeError : If the iTwin API request is not successful

##### Example:

    const tileset = await Cesium.ITwinData.createTilesetFromIModelId({ iModelId });
    if (Cesium.defined(tileset)) {
      viewer.scene.primitives.add(tileset);
    }

##### Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

#### static Cesium.ITwinData.loadGeospatialFeatures(options) → Promise.<GeoJsonDataSource>
engine/Source/Scene/ITwinData.js 241

Load data from the Geospatial Features API as GeoJSON.

Name | Type | Description
--- | --- | ---
`options` | object |
Name | Type | Default | Description
--- | --- | --- | ---
`iTwinId` | string |  | The id of the iTwin to load data from
`collectionId` | string |  | The id of the data collection to load
`limit` | number | `10000` | optional number of items per page, must be between 1 and 10,000 inclusive

##### Returns:

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.