Skip to content

Cesium config parameters

jmacura edited this page Apr 16, 2024 · 12 revisions

To configure an hslayers-ng project with a Cesium 3D map, an extra configuration must be specified similarly like for a simple hslayers-ng base map project. Either in the main application file (usually app.component.ts's constructor) using this.hsCesiumConfig.update(...) method.

Example:

constructor(private hsCesiumConfig: HsCesiumConfig) {
this.hsCesiumConfig.update({
    terrainLayers: [{
        title: 'Cesium World Terrain',
        url: 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
        active: true
    }],

Or in the hslayersCesiumConfig() function in case of the "simple" application.

Example:

function hslayersCesiumConfig() {
  return {
    terrainLayers: [{
        title: 'Cesium World Terrain',
        url: 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
        active: true
    }],

Cesium 3D Maps

Property Type Mandatory Default Value Description Example
cesiumAccessToken
String true Access token for Cesium. Register for it here: https://cesium.com/ion/assets/.
cesiumAnimation
Boolean false Should Cesium animate 3D objects.
cesiumBase
String true Directory of Cesium library. Example: ./node_modules/cesium/Build/Cesium/.
cesiumBingKey
String true API key for Bing maps used as Cesium base layer. See: https://www.bingmapsportal.com/.
cesiumDebugShowFramesPerSecond
Boolean false Turn on or off FPS counter which is used for performance benchmarking.
cesiumInfoBox
Boolean false Show 'get feature info' results in Cesium interface.
cesiumShadows
Boolean false Show shadows for objects and terrain.
cesiumTime
Cesium.JulianDate false
Cesium.JulianDate class object which specifies default time value... to set Cesium viewer.clockViewModel.currentTime to. See: https://cesiumjs.org/Cesium/Build/Documentation/JulianDate.html.
cesiumTimeline
Boolean false Turn on or off Cesium timeline.
creditContainer
Element | String false
The DOM element or ID that will contain the CreditDisplay... If not specified, the credits are added to the bottom of the widget itself.
terrainProvider
Object false
This is passed to viewer.terrainProvider configuration option... See: https://cesiumjs.org/Cesium/Build/Documentation/Viewer.html and https://cesiumjs.org/Cesium/Build/Documentation/TerrainProvider.html.
Example
terrainLayers
Array<Terrain Layer> false
Terrains between which user will be able to choose in layer manager... The config object must have structure as in the example at the top of the page. Supported terrain formats are CesiumTerrainProvider (QunatizedMesh or HeightMap) and ArcGISTiledElevationTerrainProvider (esriImageServiceDataTypeElevation).
terrainExaggeration
Number false
A scalar used to exaggerate the terrain... Default value is 1.0. Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.

Terrain layer type

  title?: string;
  url: string;
  active?: boolean;
  visible?: boolean;
  options?: CesiumTerrainProvider.ConstructorOptions;
  type?: 'terrain';
};

also see CesiumTerrainProvider.ConstructorOptions

terrainProvider example

new Cesium.CesiumTerrainProvider({
        url : Cesium.IonResource.fromAssetId(3956),
        requestVertexNormals : true
    })
Clone this wiki locally