The active Cesium Viewer instance.
Optional
options: {Optional
content?: anyCesium primitive/entity/data/imagery/etc. managed by this layer.
Optional
customShader?: CustomShaderCustom shader override for rendering.
Optional
deletable?: booleanIf false, prevents user from deleting/removing this layer.
Optional
dynamicScreenSpaceError?: booleanEnable adaptive (distance-based) detail for tiles.
Optional
dynamicScreenSpaceErrorDensity?: numberDensity parameter for adaptive LOD.
Optional
dynamicScreenSpaceErrorFactor?: numberFactor parameter for adaptive LOD.
Optional
dynamicScreenSpaceErrorHeightFalloff?: numberHeight falloff for LOD optimization.
Optional
id?: stringUnique layer ID (uuid generated if omitted).
Optional
imageryIndex?: null | numberOptional imagery stacking/render order.
Optional
maximumScreenSpaceError?: numberMax error for LOD/tiling.
Optional
name?: stringHuman-readable display name (optional).
Optional
onShowChange?: (arg0: boolean) => voidCallback, triggered whenever layer.visible ('show') changes.
Optional
parent?: null | LayerParent/aggregate layer (if any).
Optional
show?: booleanInitial visible state.
Optional
style?: anyStyle/appearance configuration for features/primitives/etc.
Optional
styleManager?: anyStyle manager/controller (handles coloring/visibility in groups).
Optional
tags?: string | string[]Tags for grouping, styling, filtering layers.
Optional
type?: null | stringLayer type (see Layer.LayerTypes).
Optional
url?: stringData source or config source URL.
Cesium primitive/entity/imagery/terrain object.
Is the layer removable?
Unique ID for this layer.
Display/UI name.
Layer grouping/filter tags.
Layer type (matches Layer.LayerTypes string values).
Configuration/source URL.
Static
LayerEnum of string layer types (B3DM, POINTS, ...).
Returns the bounding sphere of the layer, for spatial queries and UI zoom-to-fit. The implementation is type-dependent:
The bounding sphere, or undefined if not computable.
Get or set clipping polygons for this layer (used in 3D terrain/model clipping). Setter will propagate to the underlying Cesium content.
Set the global color for all grouped features (handled externally). For mesh types, this may be handled elsewhere.
Assigns a new custom shader to this layer (or disables if falsy). For non-GEOJSON layer types, handles full reconstruction (with translucency mode handling). For GEOJSON and GEOJSON3D, directly updates polygon or polyline material alpha.
Shader instance or null to disable.
Whether this layer is currently set as opaque. Triggers shader/mode update when changed.
Show or hide this Layer. Deeply propagates the visible state to underlying Cesium content. If the layer is of type FEATURE, it also updates the style manager’s feature visibility and hideIDs. Triggers the onShowChange callback.
True to show, false to hide.
Sets or retrieves styling for the layer (e.g. for GeoJSON/tiles/features). For mesh types, style setting is usually not allowed.
Style object.
Iterator protocol implementation for Layer.
For Layer collections/objects, allows use in for...of
loops.
Always returns the Layer instance itself (not a collection).
Sets the content of this Layer, and assigns this layer as its parent. Will throw if content is not a Layer.
The Layer to add as content.
Returns the current "content" object assigned to this layer.
The Cesium or sublayer content object.
Returns this Layer if any of its tags are in the provided tags array.
Tags to check against.
Returns this Layer if its type matches the given type, else null. Typically used for gathering/iterating matching content.
Type string to check.
Returns this layer's ID if any of its tags are in the provided tags array.
Tags to check against.
ID if a tag matches, else null.
Returns this layer's ID if its type matches the given type, else null.
Type string to check.
ID if match, else null.
Returns this layer instance (used for lookup patterns in layer registries).
Checks if a given object is a valid Layer: Must be truthy, have an 'id' property, and be an actual Layer instance.
The object to check.
True if the object is a valid Layer instance.
Removes the Cesium primitive/entity/etc. for this layer from the scene and severs parent links. Handles resource de-allocation by layer type (removes primitive, data source, imagery, or terrain).
Removes a layer (and its content), unlinks its parent, and disables its content link. Used for structured layer collections.
The layer instance to remove.
Shows the layer unless its ID or its content's UUID is present in the excludeIds array, otherwise hides it. Useful for toggling all layers except given ones.
Shows/hides the Layer if its ID is in layerIds (or if layerIds unspecified). Batch operation interface for toggling by ID sets.
Target visible state.
ID or array of IDs to show/hide.
Layer – Unified wrapper for a wide variety of Cesium scene layers (3D tiles, meshes, imagery, terrain, geojson, etc).
Encapsulates both configuration and runtime state, custom shaders/styling/visibility, and offers utility methods for feature/content/visibility management, tagging, and hierarchy. Layer types can be easily checked via Layer.LayerTypes (B3DM, POINTS, MESH, etc).
Param: viewer
Cesium Viewer instance.
Param: options
Param: options.id
Unique ID (auto-generated if not provided).
Param: options.name
Display name for UI and legends.
Param: options.type
One of Layer.LayerTypes, stringly-typed.
Param: options.tags
Tags for grouping and filtering.
Param: options.content
The Cesium primitive/entity/object managed by this layer.
Param: options.url
Source or configuration URL.
Param: options.show
Initial visibility state.
Param: options.deletable
Can this layer be removed by the user?
Param: options.parent
Parent/collection this layer belongs to.
Param: options.imageryIndex
(Imagery) Layer index/hierarchy, if used.
Param: options.customShader
Custom shader for Cesium rendering (if set).
Param: options.style
Style configuration object for displayed features.
Param: options.maximumScreenSpaceError
Tiling/detail threshold.
Param: options.dynamicScreenSpaceError
Whether adaptive error is enabled.
Param: options.dynamicScreenSpaceErrorDensity
Param: options.dynamicScreenSpaceErrorFactor
Param: options.dynamicScreenSpaceErrorHeightFalloff
Param: options.styleManager
Optional reference for managing thematic styling/feature visibility.
Param: options.onShowChange
Callback for when 'show' value changes.
Method
addContent(content) - Add/merge a content primitive or object.
Method
removeContent() - Remove its Cesium scene primitive/data source/imagery layer.
Method
toggleVisibility(show, ids) - Show/hide if id matches (for bulk ops).
Method
toggleAllVisibilityExcept(show, excludeIds) - Show/hide unless excluded by id.
Static
Example