Remove World Terrain Option? (Solved)


How would one remove the ‘Cesium World Terrain’ option in the menu, such that a user could not accidentally active it?


Hi! You can customize the BasePlayerPicker and remove the Cesium World Terrain option. Please see the BasePlayerPicker API for more details: BaseLayerPicker - Cesium Documentation.

@dzung Is there a specific way to remove one option, or do I need to construct the baseLayerPicker myself with that specific option not used?

@dzung any clarification on this?

For future reference of others - you don’t have to construct a new base layer, you can just open the element and remove it manually

const worldTerrainOptions = Cesium.Viewer.baseLayerPicker.container.getElementsByClassName(
const worldTerrain = worldTerrainOptions[worldTerrainOptions.length - 1]; // Currently is the last option of this array

This will probably require a change when terrain becomes default.