Skip to main content
Glama

removeLayer

Remove a specific layer from a 3D globe by its ID to declutter the map display and manage visualization layers.

Instructions

从地图上移除指定图层(按图层ID)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes要移除的图层ID(可通过 listLayers 获取)

Implementation Reference

  • The implementation of removeLayer, which removes a layer from the Cesium viewer by ID.
    removeLayer(id: string): void {
      const idx = this._layers.findIndex(l => l.id === id)
      if (idx === -1) return
      const refs = this._cesiumRefs.get(id)
      if (refs) {
        if (refs.dataSource) this._viewer.dataSources.remove(refs.dataSource, true)
        if (refs.entity) this._viewer.entities.remove(refs.entity)
        if (refs.labelEntities) {
          for (const e of refs.labelEntities) this._viewer.entities.remove(e)
        }
        if (refs.tileset) this._viewer.scene.primitives.remove(refs.tileset)
        if (refs.imageryLayer) this._viewer.imageryLayers.remove(refs.imageryLayer)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gaopengbin/cesium-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server