Cesium
Implement CesiumJS solutions with minimal assumptions and production-safe defaults.
Workflow
- 1. Confirm runtime assumptions first: framework (vanilla/Vite/React), CesiumJS version, and whether Cesium Ion is available.
- Start with the smallest runnable viewer setup before adding terrain, 3D Tiles, or heavy data layers.
- Keep token handling out of source code; use environment variables and project config wiring.
- Add data layers incrementally and verify camera framing after each step.
- For rendering/perf issues, reduce scene complexity first, then tune request/render settings.
Implementation guardrails
- - Prefer explicit imports from
cesium and avoid hidden globals. - Use
requestRenderMode for mostly static scenes to reduce GPU/CPU usage. - Dispose resources in teardown paths (
viewer.destroy()) in SPA route changes/unmounts. - For large datasets, prefer 3D Tiles over huge entity collections when possible.
- Keep picking logic resilient: handle
undefined picks and mixed primitive/entity results.
Debugging checklist
- - Blank globe: verify CSS container height/width and render loop not blocked.
- Missing terrain/tiles: verify network access, token, and dataset permissions.
- Misplaced data: verify CRS and coordinate order (lon, lat, height).
- Memory/GPU pressure: profile number of entities/primitives and texture-heavy layers.
Reference docs in this skill
- - Read
{baseDir}/references/patterns.md when generating or fixing Cesium code.
Cesium
以最小假设和生产安全默认值实现CesiumJS解决方案。
工作流程
- 1. 首先确认运行时假设:框架(vanilla/Vite/React)、CesiumJS版本以及Cesium Ion是否可用。
- 在添加地形、3D Tiles或重型数据图层之前,从最小的可运行查看器设置开始。
- 令牌处理不写入源代码;使用环境变量和项目配置连接。
- 逐步添加数据图层,并在每一步后验证相机取景。
- 对于渲染/性能问题,首先降低场景复杂度,然后调整请求/渲染设置。
实现护栏
- - 优先从cesium进行显式导入,避免隐藏的全局变量。
- 对于基本静态场景使用requestRenderMode以减少GPU/CPU使用。
- 在SPA路由变化/卸载时,在清理路径中释放资源(viewer.destroy())。
- 对于大型数据集,尽可能优先使用3D Tiles而非大量实体集合。
- 保持拾取逻辑的弹性:处理undefined拾取结果以及混合图元/实体结果。
调试清单
- - 空白地球:验证CSS容器高度/宽度以及渲染循环未被阻塞。
- 缺失地形/瓦片:验证网络访问、令牌和数据集权限。
- 数据位置错误:验证CRS和坐标顺序(经度、纬度、高度)。
- 内存/GPU压力:分析实体/图元数量以及纹理密集型图层。
本技能中的参考文档
- - 在生成或修复Cesium代码时,阅读{baseDir}/references/patterns.md。