Skip to content

Cesium config parameters

jmacura edited this page May 13, 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 false Should Cesium animate 3D objects.
cesiumBase
String true Directory of Cesium library. Example: ./node_modules/cesium/Build/Cesium/.
cesiumBaseLayerPicker
Boolean false false Show Base Layer Picker widget. Usually LayerManager takes over its functionality.
cesiumBingKey
String true API key for Bing maps used as Cesium base layer. See: https://www.bingmapsportal.com/.
cesiumDebugShowFramesPerSecond
Boolean false false Turn on or off FPS counter which is used for performance benchmarking.
cesiumFullscreenButton
Boolean false true Show full screen button.
cesiumGeocoder
Boolean or an array of GeocoderServices false false Can be used to display Cesium's geocoder widget instead of (or in addition to) hslayers' search toolbar
cesiumInfoBox
Boolean false false Show 'get feature info' results in Cesium interface.
cesiumShadows
Number false 0 Show shadows for objects and terrain. Values match the enum https://cesium.com/learn/cesiumjs/ref-doc/global.html?classFilter=shadow#ShadowMode
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.
imageryProvider
Cesium.ImageryProvider false
The imagery provider to use instead of default Bing maps. This value is only valid if Cesium's options.baseLayerPicker is set to false. See: https://cesiumjs.org/Cesium/Build/Documentation/ImageryProvider.html.
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).
verticalExaggeration
Number false 1.0
A scalar used to exaggerate the terrain and 3D tiles... Default value is 1.0. Note that vertical exaggeration will not modify other primitives 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