Loading SGS Layers in Cesium Clients
Cesium-based clients can access data published on SkylineGlobe Server (SGS) directly at the layer level, without using the deprecated SGSProvider or relying on SGS project definitions. Mesh, Gaussian Splatting, and point cloud layers are exposed to Cesium clients as 3D Tiles and loaded using native Cesium APIs, while imagery layers are served via WMS. Elevation layers require a dedicated SGS terrain provider, which dynamically adapts SGS elevation data into a Cesium-compatible terrain format.
§ Public layers – If a layer is configured as public, i.e., it's view access is set to Everyone, it can be accessed directly via its URL. No authentication or token is required. See "Granting Edit or View Access" in the "Working with Layers" chapter for more information.
§ Private layers – Layers whose view access was limited to specific users require authentication. This can be done in one of two ways:
§ Append an access token to each layer URL. See the "Access Token" property in the "Managing Users" chapter for information.
§ Log in using a username and password, which authenticates the browser session. See "Authenticating with Username and Password" in this chapter.
Authenticating with Username and Password
To authenticate a Cesium viewer session using credentials, perform a login request to SGS before loading any private layers:
(async () => {
const response = await fetch(
"https://cloud.skylineglobe.com/SG/[CUSTOMER_KEY]/ConnectSG",
{
method: "POST",
credentials: "include",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
request: "login",
username: "[USERNAME]",
password: "[PASSWORD]"
})
}
);
if (!response.ok) {
console.error("Login failed.");
return;
}
const responseJson = await response.json();
if (responseJson.result !== "success") {
console.error("Login failed: " + responseJson.resultMessageDescription);
} else {
console.log("Login succeeded.");
}
})();
Once authenticated, subsequent layer requests can omit the token and rely on the authenticated session.
Loading 3D Layers in Cesium Clients
To load a 3D (mesh or Gaussian Splatting) layer published on SkylineGlobe Server (SGS) into a Cesium client:
§ Provide the layer’s 3D Tileset URL to Cesium and add the resulting tileset to the scene.
(async () => {
const url = "https://cloud.skylineglobe.com/SG/[SiteName]/[token]/b3dm/[3D_LAYER_ID]/tileset.json";
const tileset = await Cesium.Cesium3DTileset.fromUrl(url);
viewer.scene.primitives.add(tileset);
viewer.camera.flyToBoundingSphere(tileset.boundingSphere);
})();
Note: You can also interactively browse, edit and run this code example in Cesium Sandcastle.
Loading Point Cloud Layers in Cesium Clients
To load a point cloud layer published on SkylineGlobe Server (SGS) into a Cesium client:
§ Provide the layer’s 3D Tileset URL to Cesium and add the resulting tileset to the scene.
(async () => {
const url = "https://cloud.skylineglobe.com/SG/[SiteName]/[token]/pnts/[POINT_CLOUD_LAYER_ID]/tileset.json";
const tileset = await Cesium.Cesium3DTileset.fromUrl(url);
viewer.scene.primitives.add(tileset);
viewer.camera.flyToBoundingSphere(tileset.boundingSphere);
})();
Note: You can also interactively browse, edit and run this code example in Cesium Sandcastle.
Loading Imagery Layers in Cesium Clients
To load an imagery layer published on SkylineGlobe Server (SGS) into a Cesium client, provide the layer’s WMS URL to Cesium and add the imagery layer to the viewer.
(async () => {
const url = "https://cloud.skylineglobe.com/SG/[SiteName]/[token]/streamer.ashx";
const provider = new Cesium.WebMapServiceImageryProvider({
url,
layers: "[IMAGERY_LAYER_ID]",
parameters: {
service: "WMS",
version: "1.3.0",
request: "GetMap",
styles: "",
format: "image/png",
transparent: true
}
});
await provider.readyPromise;
viewer.imageryLayers.addImageryProvider(provider);
})();
Note: You can also interactively browse, edit and run this code example in Cesium Sandcastle.
Loading Elevation Layers in Cesium Clients
To load an elevation layer published on SkylineGlobe Server (SGS) into a Cesium client, configure the viewer to use SGS’s custom terrain provider, which enables Cesium to consume SGS elevation data as terrain.
1. From the SGS installation folder, copy the following directory into your Cesium application folder:
Resources\CesiumJS\SGSTerrainProvider
2. In the main HTML file of your Cesium application, add the following script reference:
<script src="SGSTerrainProvider/SGSTerrainProvider.js" type="text/javascript"></script>
3. Then, configure the terrain provider in your Cesium viewer:
viewer.terrainProvider = new SGSTerrainProvider({
viewer: viewer,
requestVertexNormals: false,
url: 'https://cloud.skylineglobe.com/SG/[SiteName]/Elevation',
layers: '[ELEVATION_LAYER_ID].mpt' // Layer can be in .tbp or .mpt format
});