3D objects are a type of I3S data that are used to model entities such as buildings. They are typically stored in a hosted ArcGIS scene service. 3D objects are part of the I3S OGC community standard.
This tutorial explains how to add 3D objects from a scene service to your CesiumJS application using the I3SDataProvider class.
To access location services, you need an API key or OAuth 2.0 access token. To learn how to create and scope your key, visit the Create an API key tutorial.
Go to your dashboard to get an API key. The API key must be scoped to access the services used in this tutorial.
In CodePen, update apiKey to use your key. Update cesiumAccessToken to use your Cesium ion access token.
This tutorial uses a 3D object layer centered on the city of San Francisco. Update the camera to focus on the coordinates [-122.433, 37.777] with a height of 500.
Expand
Use dark colors for code blocks
Change lineChange lineChange lineChange lineChange lineChange lineChange line
To ensure that your 3D objects sit properly on top of the terrain, you need to use a geoid service. This service will allow the elevation of the 3D objects to align with the elevation values of Cesium World Terrain.
Initialize a terrain provider called geoidService that references the Earth Gravitational Model EGM2008. This provider will allow for geoid conversion between the gravity-based 3D object layer and the ellipsoidal-based Cesium World Terrain.
Expand
Use dark colors for code blocks
Add line.Add line.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
viewer.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(-122.433,37.777,500),
orientation: {
heading: Cesium.Math.toRadians(60),
pitch: Cesium.Math.toRadians(-15.0),
}
});
// The source data used in this transcoding service was compiled from https://earth-info.nga.mil/#tab_wgs84-data and is based on EGM2008 Gravity Modelconst geoidService = await Cesium.ArcGISTiledElevationTerrainProvider.fromUrl("https://tiles.arcgis.com/tiles/z2tnIkrLQ2BRzr6P/arcgis/rest/services/EGM2008/ImageServer");
const i3sProvider = await Cesium.I3SDataProvider.fromUrl(i3sLayer, {
geoidTiledTerrainProvider: geoidService,
token: apiKey
})