Skip to main content
Glama

screenshot

Capture current map view as base64 PNG image for documentation, sharing, or analysis within the CesiumJS 3D globe environment.

Instructions

截取当前地图视图(返回 base64 PNG)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The screenshot function captures the current Cesium viewer canvas as a base64 DataURL.
    export function screenshot(viewer: Cesium.Viewer): Promise<ScreenshotResult> {
      return new Promise((resolve) => {
        // 等待下一帧渲染完成
        viewer.scene.requestRender()
        const removeListener = viewer.scene.postRender.addEventListener(() => {
          removeListener()
          const canvas = viewer.scene.canvas
          const dataUrl = canvas.toDataURL('image/png')
          resolve({
            dataUrl,
            width: canvas.width,
            height: canvas.height,
          })
        })
      })
    }
  • ScreenshotResult interface defining the shape of the screenshot output.
    export interface ScreenshotResult {
      dataUrl: string
      width: number
      height: number
    }

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