@anov/gis-skills-cli 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +618 -0
- package/INSTALL.md +478 -0
- package/LICENSE +15 -0
- package/README.md +148 -2
- package/RELEASING.md +160 -0
- package/bin/anov-gis-skills.mjs +408 -0
- package/lib/mcp-config.mjs +273 -0
- package/package.json +42 -4
- package/skills/anovgis-analysis/SKILL.md +585 -0
- package/skills/anovgis-effects/SKILL.md +260 -0
- package/skills/anovgis-imagery-terrain/SKILL.md +505 -0
- package/skills/anovgis-layers/SKILL.md +627 -0
- package/skills/anovgis-materials/SKILL.md +635 -0
- package/skills/anovgis-models-3dtiles/SKILL.md +448 -0
- package/skills/anovgis-pitfalls/SKILL.md +561 -0
- package/skills/anovgis-popup-widget/SKILL.md +474 -0
- package/skills/anovgis-primitives/SKILL.md +482 -0
- package/skills/anovgis-vector-graphics/SKILL.md +602 -0
- package/skills/anovgis-viewer/SKILL.md +618 -0
- package/skills/using-anovgis/DEMO-MAP.md +64 -0
- package/skills/using-anovgis/DEMO-SKILL-MAP.md +248 -0
- package/skills/using-anovgis/DOMAINS.md +183 -0
- package/skills/using-anovgis/REFERENCE.md +114 -0
- package/skills/using-anovgis/SKILL.md +392 -0
- package/skills/using-anovgis/templates/README.md +154 -0
- package/skills/using-anovgis/templates/combo1-vue3-vite.md +295 -0
- package/skills/using-anovgis/templates/combo2-vue2-cli.md +119 -0
- package/skills/using-anovgis/templates/combo3-html-cdn.md +107 -0
- package/skills/using-anovgis/templates/combo4-vanilla-webpack.md +91 -0
- package/skills/using-anovgis/templates/wizard-profiles.md +105 -0
- package/vendor/cesiumjs-skills/LICENSE +201 -0
- package/vendor/cesiumjs-skills/NOTICE +18 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-3d-tiles/SKILL.md +465 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-camera/SKILL.md +500 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-core-utilities/SKILL.md +403 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/REFERENCE.md +397 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/SKILL.md +351 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/01-diffuse-tint.js +38 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/02-texture-swap.js +42 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/03-feature-id-tileset.js +29 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/04-translucent-override.js +37 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/05-vertex-displacement.js +49 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/06-metadata-ramp.js +34 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/07-voxel-shader.js +27 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/README.md +19 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/_sandcastle-template.html +9 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-entities/SKILL.md +389 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-imagery/SKILL.md +471 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-interaction/SKILL.md +423 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-materials-shaders/SKILL.md +292 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-models-particles/SKILL.md +423 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-primitives/SKILL.md +537 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-spatial-math/SKILL.md +358 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-terrain-environment/SKILL.md +401 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-time-properties/SKILL.md +353 -0
- package/vendor/cesiumjs-skills/skills/cesiumjs-viewer-setup/SKILL.md +434 -0
- package/vendor/cesiumjs-skills/skills/using-cesiumjs-skills/SKILL.md +35 -0
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cesiumjs-viewer-setup
|
|
3
|
+
description: "CesiumJS viewer setup - Viewer, CesiumWidget, widgets, Ion token, Scene configuration, SceneMode, factory helpers, geocoders, platform services. Use when initializing a CesiumJS application, configuring viewer widgets, setting Ion access tokens, creating default terrain or imagery, or bootstrapping a 3D globe."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CesiumJS Viewer & Scene Setup
|
|
7
|
+
|
|
8
|
+
Reference for bootstrapping CesiumJS applications: Viewer, CesiumWidget, Ion/GoogleMaps/ITwinPlatform configuration, widgets, factory helpers, geocoder services, viewer mixins, Credits, and related enums.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import { Ion, Viewer, Terrain } from "cesium";
|
|
14
|
+
import "cesium/Build/Cesium/Widgets/widgets.css";
|
|
15
|
+
|
|
16
|
+
// Always set your Ion token before any other Cesium calls
|
|
17
|
+
Ion.defaultAccessToken = "YOUR_CESIUM_ION_ACCESS_TOKEN";
|
|
18
|
+
|
|
19
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
20
|
+
terrain: Terrain.fromWorldTerrain(),
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Required HTML: `<div id="cesiumContainer" style="width:100%;height:100vh"></div>`
|
|
25
|
+
|
|
26
|
+
## Ion & Platform Configuration
|
|
27
|
+
|
|
28
|
+
### Cesium Ion
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { Ion } from "cesium";
|
|
32
|
+
|
|
33
|
+
Ion.defaultAccessToken = "YOUR_TOKEN"; // required for ion assets
|
|
34
|
+
Ion.defaultServer = "https://your-ion-server.example.com/"; // optional: self-hosted
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### IonResource
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import { IonResource, Cesium3DTileset } from "cesium";
|
|
41
|
+
|
|
42
|
+
const resource = await IonResource.fromAssetId(96188);
|
|
43
|
+
const tileset = await Cesium3DTileset.fromUrl(resource);
|
|
44
|
+
viewer.scene.primitives.add(tileset);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Google Maps Platform
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
import { GoogleMaps, createGooglePhotorealistic3DTileset, Viewer, IonGeocodeProviderType } from "cesium";
|
|
51
|
+
|
|
52
|
+
GoogleMaps.defaultApiKey = "YOUR_GOOGLE_MAPS_API_KEY"; // optional: without key, served via ion
|
|
53
|
+
|
|
54
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
55
|
+
geocoder: IonGeocodeProviderType.GOOGLE, // required with Google 3D Tiles
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const tileset = await createGooglePhotorealistic3DTileset({
|
|
59
|
+
onlyUsingWithGoogleGeocoder: true,
|
|
60
|
+
});
|
|
61
|
+
viewer.scene.primitives.add(tileset);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### iTwin Platform (experimental)
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { ITwinPlatform, ITwinData } from "cesium";
|
|
68
|
+
|
|
69
|
+
ITwinPlatform.defaultAccessToken = "YOUR_ITWIN_TOKEN";
|
|
70
|
+
const tileset = await ITwinData.createTilesetForIModel(viewer, "imodel-id");
|
|
71
|
+
|
|
72
|
+
// 1.140+ (#13208): Reality Data of type GaussianSplat3DTiles is now supported
|
|
73
|
+
const splats = await ITwinData.createTilesetForRealityDataId(
|
|
74
|
+
iTwinId,
|
|
75
|
+
realityDataId,
|
|
76
|
+
ITwinPlatform.RealityDataType.GaussianSplat3DTiles,
|
|
77
|
+
);
|
|
78
|
+
viewer.scene.primitives.add(splats);
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Viewer Constructor Options
|
|
82
|
+
|
|
83
|
+
`new Viewer(container, options?)` -- `container` is a DOM element or its string ID.
|
|
84
|
+
|
|
85
|
+
### Widget Toggles
|
|
86
|
+
|
|
87
|
+
| Option | Default | Purpose |
|
|
88
|
+
|--------|---------|---------|
|
|
89
|
+
| `animation` | `true` | Playback controls |
|
|
90
|
+
| `baseLayerPicker` | `true` | Imagery/terrain switcher |
|
|
91
|
+
| `fullscreenButton` | `true` | Fullscreen toggle |
|
|
92
|
+
| `vrButton` | `false` | WebVR toggle |
|
|
93
|
+
| `geocoder` | `IonGeocodeProviderType.DEFAULT` | Search bar (`false` to hide) |
|
|
94
|
+
| `homeButton` | `true` | Reset to home view |
|
|
95
|
+
| `infoBox` | `true` | Entity info popup |
|
|
96
|
+
| `sceneModePicker` | `true` | 2D/3D/Columbus toggle |
|
|
97
|
+
| `selectionIndicator` | `true` | Selection reticle |
|
|
98
|
+
| `timeline` | `true` | Time scrubber |
|
|
99
|
+
| `navigationHelpButton` | `true` | Mouse/touch help |
|
|
100
|
+
| `projectionPicker` | `false` | Perspective/ortho toggle |
|
|
101
|
+
|
|
102
|
+
### Scene & Rendering
|
|
103
|
+
|
|
104
|
+
| Option | Default | Purpose |
|
|
105
|
+
|--------|---------|---------|
|
|
106
|
+
| `sceneMode` | `SceneMode.SCENE3D` | Initial scene mode |
|
|
107
|
+
| `scene3DOnly` | `false` | Lock to 3D, saves GPU memory |
|
|
108
|
+
| `shadows` | `false` | Shadow casting |
|
|
109
|
+
| `terrainShadows` | `ShadowMode.RECEIVE_ONLY` | Terrain shadow mode |
|
|
110
|
+
| `requestRenderMode` | `false` | Render only on changes |
|
|
111
|
+
| `maximumRenderTimeChange` | `0.0` | Max sim-time delta for render |
|
|
112
|
+
| `msaaSamples` | `4` | MSAA (1 to disable) |
|
|
113
|
+
| `orderIndependentTranslucency` | `true` | Translucent ordering |
|
|
114
|
+
| `mapMode2D` | `MapMode2D.INFINITE_SCROLL` | 2D scroll behavior |
|
|
115
|
+
|
|
116
|
+
### Layers & Terrain
|
|
117
|
+
|
|
118
|
+
| Option | Default | Purpose |
|
|
119
|
+
|--------|---------|---------|
|
|
120
|
+
| `baseLayer` | `ImageryLayer.fromWorldImagery()` | Base imagery (`false` for none; needs `baseLayerPicker: false`) |
|
|
121
|
+
| `terrain` | none | Async terrain helper (cannot combine with `terrainProvider`) |
|
|
122
|
+
| `terrainProvider` | `EllipsoidTerrainProvider` | Sync terrain provider |
|
|
123
|
+
| `globe` | `new Globe()` | `false` for no globe (space scenes) |
|
|
124
|
+
| `skyBox` | auto (WGS84) | `false` disables sky/sun/moon |
|
|
125
|
+
| `skyAtmosphere` | auto (WGS84) | `false` disables limb glow |
|
|
126
|
+
|
|
127
|
+
### Minimal Viewer (No Widgets)
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
import { Viewer, Ion, Terrain } from "cesium";
|
|
131
|
+
Ion.defaultAccessToken = "YOUR_TOKEN";
|
|
132
|
+
|
|
133
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
134
|
+
animation: false, baseLayerPicker: false, fullscreenButton: false,
|
|
135
|
+
geocoder: false, homeButton: false, infoBox: false,
|
|
136
|
+
sceneModePicker: false, selectionIndicator: false,
|
|
137
|
+
timeline: false, navigationHelpButton: false,
|
|
138
|
+
terrain: Terrain.fromWorldTerrain(),
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## CesiumWidget (Lightweight Alternative)
|
|
143
|
+
|
|
144
|
+
No UI widgets, no Knockout dependency. Suitable for custom UIs or embedding.
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
import { CesiumWidget, Ion } from "cesium";
|
|
148
|
+
Ion.defaultAccessToken = "YOUR_TOKEN";
|
|
149
|
+
|
|
150
|
+
const widget = new CesiumWidget("cesiumContainer", { shouldAnimate: true });
|
|
151
|
+
// Exposes: widget.scene, widget.camera, widget.entities
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## SceneMode Enum
|
|
155
|
+
|
|
156
|
+
| Value | Description |
|
|
157
|
+
|-------|-------------|
|
|
158
|
+
| `SceneMode.SCENE3D` | Standard 3D globe (default) |
|
|
159
|
+
| `SceneMode.SCENE2D` | Top-down orthographic map |
|
|
160
|
+
| `SceneMode.COLUMBUS_VIEW` | 2.5D flat map with height |
|
|
161
|
+
| `SceneMode.MORPHING` | Transitioning between modes |
|
|
162
|
+
|
|
163
|
+
```js
|
|
164
|
+
import { Viewer, SceneMode } from "cesium";
|
|
165
|
+
|
|
166
|
+
const viewer = new Viewer("cesiumContainer", { sceneMode: SceneMode.SCENE2D });
|
|
167
|
+
viewer.scene.morphTo3D(2.0); // animated transition
|
|
168
|
+
viewer.scene.morphToColumbusView(2.0);
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Scene Configuration
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
const scene = viewer.scene;
|
|
175
|
+
scene.globe.depthTestAgainstTerrain = true; // entities interact with terrain
|
|
176
|
+
scene.globe.enableLighting = true; // sun-based lighting
|
|
177
|
+
|
|
178
|
+
// Key sub-objects
|
|
179
|
+
scene.camera; // Camera
|
|
180
|
+
scene.primitives; // PrimitiveCollection
|
|
181
|
+
scene.groundPrimitives; // PrimitiveCollection (ground-clamped)
|
|
182
|
+
scene.imageryLayers; // ImageryLayerCollection
|
|
183
|
+
scene.postProcessStages;
|
|
184
|
+
|
|
185
|
+
scene.requestRender(); // trigger frame in requestRenderMode
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Factory Helpers
|
|
189
|
+
|
|
190
|
+
### createOsmBuildingsAsync
|
|
191
|
+
|
|
192
|
+
```js
|
|
193
|
+
import { createOsmBuildingsAsync, Cesium3DTileStyle } from "cesium";
|
|
194
|
+
|
|
195
|
+
// Default styling (colors from OSM tags)
|
|
196
|
+
const tileset = await createOsmBuildingsAsync();
|
|
197
|
+
viewer.scene.primitives.add(tileset);
|
|
198
|
+
|
|
199
|
+
// Custom style
|
|
200
|
+
const styled = await createOsmBuildingsAsync({
|
|
201
|
+
style: new Cesium3DTileStyle({
|
|
202
|
+
color: { conditions: [
|
|
203
|
+
["${feature['building']} === 'hospital'", "color('#0000FF')"],
|
|
204
|
+
[true, "color('#ffffff')"],
|
|
205
|
+
]},
|
|
206
|
+
}),
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### createGooglePhotorealistic3DTileset
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
import { createGooglePhotorealistic3DTileset, IonGeocodeProviderType } from "cesium";
|
|
214
|
+
|
|
215
|
+
// Must use Google geocoder
|
|
216
|
+
const viewer = new Viewer("cesiumContainer", { geocoder: IonGeocodeProviderType.GOOGLE });
|
|
217
|
+
const tileset = await createGooglePhotorealistic3DTileset({ onlyUsingWithGoogleGeocoder: true });
|
|
218
|
+
viewer.scene.primitives.add(tileset);
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Terrain.fromWorldTerrain / fromWorldBathymetry
|
|
222
|
+
|
|
223
|
+
Preferred for the `terrain` constructor option. Non-blocking with error events.
|
|
224
|
+
|
|
225
|
+
```js
|
|
226
|
+
import { Viewer, Terrain } from "cesium";
|
|
227
|
+
|
|
228
|
+
// World terrain with normals and water
|
|
229
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
230
|
+
terrain: Terrain.fromWorldTerrain({ requestVertexNormals: true, requestWaterMask: true }),
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// Bathymetry (ocean floor)
|
|
234
|
+
const viewer2 = new Viewer("cesiumContainer", {
|
|
235
|
+
terrain: Terrain.fromWorldBathymetry({ requestVertexNormals: true }),
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Terrain Event Handling
|
|
240
|
+
|
|
241
|
+
```js
|
|
242
|
+
import { Terrain, CesiumTerrainProvider } from "cesium";
|
|
243
|
+
|
|
244
|
+
const terrain = new Terrain(CesiumTerrainProvider.fromUrl("https://my-terrain.example.com"));
|
|
245
|
+
viewer.scene.setTerrain(terrain);
|
|
246
|
+
|
|
247
|
+
terrain.readyEvent.addEventListener((provider) => {
|
|
248
|
+
viewer.scene.globe.enableLighting = true;
|
|
249
|
+
});
|
|
250
|
+
terrain.errorEvent.addEventListener((error) => console.error("Terrain failed:", error));
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### createWorldTerrainAsync / createWorldImageryAsync
|
|
254
|
+
|
|
255
|
+
Lower-level: return raw providers. Use when you need the provider directly.
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
import { createWorldTerrainAsync, createWorldImageryAsync, IonWorldImageryStyle } from "cesium";
|
|
259
|
+
|
|
260
|
+
const terrainProvider = await createWorldTerrainAsync({ requestVertexNormals: true });
|
|
261
|
+
viewer.terrainProvider = terrainProvider;
|
|
262
|
+
|
|
263
|
+
const imageryProvider = await createWorldImageryAsync({ style: IonWorldImageryStyle.AERIAL_WITH_LABELS });
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**IonWorldImageryStyle**: `AERIAL` (default) | `AERIAL_WITH_LABELS` | `ROAD`
|
|
267
|
+
|
|
268
|
+
## Geocoder Configuration
|
|
269
|
+
|
|
270
|
+
The `geocoder` option accepts `false`, an `IonGeocodeProviderType`, or a `GeocoderService[]`.
|
|
271
|
+
|
|
272
|
+
**IonGeocodeProviderType**: `DEFAULT` | `GOOGLE` (required with Google tiles) | `BING`
|
|
273
|
+
|
|
274
|
+
```js
|
|
275
|
+
import { Viewer, CartographicGeocoderService, IonGeocoderService, OpenCageGeocoderService } from "cesium";
|
|
276
|
+
|
|
277
|
+
// Multiple services (searched in order)
|
|
278
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
279
|
+
geocoder: [
|
|
280
|
+
new CartographicGeocoderService(), // accepts "lat, lon" input
|
|
281
|
+
new IonGeocoderService({ scene: viewer.scene }),
|
|
282
|
+
],
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Custom GeocoderService
|
|
287
|
+
|
|
288
|
+
```js
|
|
289
|
+
const myGeocoder = {
|
|
290
|
+
async geocode(input, type) {
|
|
291
|
+
// type: GeocodeType.SEARCH or GeocodeType.AUTOCOMPLETE
|
|
292
|
+
const resp = await fetch(`https://api.example.com/search?q=${input}`);
|
|
293
|
+
const data = await resp.json();
|
|
294
|
+
return data.map((item) => ({
|
|
295
|
+
displayName: item.name,
|
|
296
|
+
destination: Cartesian3.fromDegrees(item.lon, item.lat),
|
|
297
|
+
}));
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
const viewer = new Viewer("cesiumContainer", { geocoder: [myGeocoder] });
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Viewer Mixins
|
|
304
|
+
|
|
305
|
+
```js
|
|
306
|
+
import { Viewer, viewerDragDropMixin, viewerCesium3DTilesInspectorMixin,
|
|
307
|
+
viewerCesiumInspectorMixin, viewerPerformanceWatchdogMixin, viewerVoxelInspectorMixin } from "cesium";
|
|
308
|
+
|
|
309
|
+
const viewer = new Viewer("cesiumContainer");
|
|
310
|
+
|
|
311
|
+
// Drag-and-drop CZML/GeoJSON/KML loading
|
|
312
|
+
viewer.extend(viewerDragDropMixin, { dropTarget: "cesiumContainer", clearOnDrop: true });
|
|
313
|
+
viewer.dropError.addEventListener((handler, name, error) => console.error(error));
|
|
314
|
+
|
|
315
|
+
viewer.extend(viewerCesium3DTilesInspectorMixin); // 3D Tiles debug panel
|
|
316
|
+
viewer.extend(viewerCesiumInspectorMixin); // general scene inspector
|
|
317
|
+
viewer.extend(viewerPerformanceWatchdogMixin); // low-FPS warning
|
|
318
|
+
viewer.extend(viewerVoxelInspectorMixin); // voxel debug panel
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Key Viewer Properties & Methods
|
|
322
|
+
|
|
323
|
+
| Property | Type |
|
|
324
|
+
|----------|------|
|
|
325
|
+
| `viewer.scene` | `Scene` |
|
|
326
|
+
| `viewer.camera` | `Camera` |
|
|
327
|
+
| `viewer.entities` | `EntityCollection` |
|
|
328
|
+
| `viewer.dataSources` | `DataSourceCollection` |
|
|
329
|
+
| `viewer.imageryLayers` | `ImageryLayerCollection` |
|
|
330
|
+
| `viewer.terrainProvider` | `TerrainProvider` |
|
|
331
|
+
| `viewer.clock` / `clockViewModel` | `Clock` / `ClockViewModel` |
|
|
332
|
+
| `viewer.canvas` | `HTMLCanvasElement` |
|
|
333
|
+
| `viewer.screenSpaceEventHandler` | `ScreenSpaceEventHandler` |
|
|
334
|
+
| `viewer.selectedEntity` / `trackedEntity` | `Entity` |
|
|
335
|
+
| `viewer.shadows` | `boolean` |
|
|
336
|
+
| `viewer.resolutionScale` | `number` (default 1.0) |
|
|
337
|
+
|
|
338
|
+
```js
|
|
339
|
+
await viewer.flyTo(entity, { duration: 3.0, offset: headingPitchRange }); // animated
|
|
340
|
+
await viewer.zoomTo(tileset); // instant
|
|
341
|
+
viewer.destroy(); // free all resources
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## Credit & FrameRateMonitor
|
|
345
|
+
|
|
346
|
+
```js
|
|
347
|
+
import { Credit, FrameRateMonitor } from "cesium";
|
|
348
|
+
|
|
349
|
+
// Custom credit (showOnScreen = true)
|
|
350
|
+
viewer.creditDisplay.addStaticCredit(new Credit("Data by Example Corp", true));
|
|
351
|
+
|
|
352
|
+
// Monitor frame rate
|
|
353
|
+
const monitor = FrameRateMonitor.fromScene(viewer.scene);
|
|
354
|
+
monitor.lowFrameRate.addEventListener(() => console.warn("Low FPS"));
|
|
355
|
+
monitor.nominalFrameRate.addEventListener(() => console.log("FPS recovered"));
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Common Patterns
|
|
359
|
+
|
|
360
|
+
### Production Viewer with Terrain and OSM Buildings
|
|
361
|
+
|
|
362
|
+
```js
|
|
363
|
+
import { Ion, Viewer, Terrain, createOsmBuildingsAsync, Cartesian3, Math as CesiumMath } from "cesium";
|
|
364
|
+
|
|
365
|
+
Ion.defaultAccessToken = "YOUR_TOKEN";
|
|
366
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
367
|
+
terrain: Terrain.fromWorldTerrain(), animation: false, timeline: false,
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
viewer.scene.primitives.add(await createOsmBuildingsAsync());
|
|
371
|
+
viewer.scene.camera.flyTo({
|
|
372
|
+
destination: Cartesian3.fromDegrees(-74.019, 40.6912, 750),
|
|
373
|
+
orientation: { heading: CesiumMath.toRadians(20), pitch: CesiumMath.toRadians(-20) },
|
|
374
|
+
});
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Space Scene (No Globe)
|
|
378
|
+
|
|
379
|
+
```js
|
|
380
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
381
|
+
globe: false, skyAtmosphere: false, baseLayerPicker: false,
|
|
382
|
+
});
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Explicit Render Mode (Low Power)
|
|
386
|
+
|
|
387
|
+
```js
|
|
388
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
389
|
+
requestRenderMode: true, maximumRenderTimeChange: Infinity,
|
|
390
|
+
});
|
|
391
|
+
// Call viewer.scene.requestRender() after programmatic changes
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Custom Base Layer
|
|
395
|
+
|
|
396
|
+
```js
|
|
397
|
+
import { Viewer, ImageryLayer, OpenStreetMapImageryProvider } from "cesium";
|
|
398
|
+
|
|
399
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
400
|
+
baseLayerPicker: false,
|
|
401
|
+
baseLayer: new ImageryLayer(new OpenStreetMapImageryProvider({
|
|
402
|
+
url: "https://tile.openstreetmap.org/",
|
|
403
|
+
})),
|
|
404
|
+
});
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Columbus View with Web Mercator
|
|
408
|
+
|
|
409
|
+
```js
|
|
410
|
+
import { Viewer, SceneMode, WebMercatorProjection } from "cesium";
|
|
411
|
+
|
|
412
|
+
const viewer = new Viewer("cesiumContainer", {
|
|
413
|
+
sceneMode: SceneMode.COLUMBUS_VIEW, mapProjection: new WebMercatorProjection(),
|
|
414
|
+
});
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Performance Tips
|
|
418
|
+
|
|
419
|
+
1. **Set `requestRenderMode: true`** for mostly-static apps. Reduces CPU/GPU and battery drain. Call `scene.requestRender()` after changes.
|
|
420
|
+
2. **Use `scene3DOnly: true`** when 2D/Columbus View is not needed. Saves GPU memory per geometry instance.
|
|
421
|
+
3. **Disable unused widgets** (`animation: false`, `timeline: false`) to reduce DOM overhead.
|
|
422
|
+
4. **Set `msaaSamples: 1`** on low-power devices. Default `4` balances quality.
|
|
423
|
+
5. **Lower `resolutionScale`** (e.g., `0.75`) on HiDPI displays for better frame rates.
|
|
424
|
+
6. **Prefer `Terrain.fromWorldTerrain()`** over `await createWorldTerrainAsync()` -- non-blocking with error events.
|
|
425
|
+
7. **Enable `requestVertexNormals: true`** on terrain for proper lighting at negligible cost.
|
|
426
|
+
8. **Call `viewer.destroy()`** when removing from DOM to free WebGL contexts.
|
|
427
|
+
9. **Limit imagery layers** to 2-3. Each adds a texture lookup per fragment.
|
|
428
|
+
|
|
429
|
+
## See Also
|
|
430
|
+
|
|
431
|
+
- **cesiumjs-camera** -- Camera positioning, flyTo, lookAt, navigation constraints
|
|
432
|
+
- **cesiumjs-entities** -- Entity API, data sources, GeoJSON/KML/CZML loading
|
|
433
|
+
- **cesiumjs-imagery** -- Imagery providers, layer management, split-screen
|
|
434
|
+
- **cesiumjs-terrain-environment** -- Terrain providers, Globe, atmosphere, sky, lighting
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-cesiumjs-skills
|
|
3
|
+
description: Use when starting any conversation involving CesiumJS development - provides orientation on available domain skills and how they activate
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CesiumJS Skills Orientation
|
|
7
|
+
|
|
8
|
+
This plugin provides 14 domain skills covering CesiumJS v1.142 (~550 public symbols). Skills activate passively via description matching — no explicit invocation is required.
|
|
9
|
+
|
|
10
|
+
## Available Skills
|
|
11
|
+
|
|
12
|
+
| Skill | Use when... |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `cesiumjs-viewer-setup` | Initializing a CesiumJS app, configuring widgets, setting Ion tokens, bootstrapping a globe |
|
|
15
|
+
| `cesiumjs-camera` | Positioning the camera, flyTo animations, constraining navigation, entity tracking |
|
|
16
|
+
| `cesiumjs-entities` | Adding points/labels/models/polygons, loading GeoJSON/KML/CZML/GPX data through the high-level DataSource layer |
|
|
17
|
+
| `cesiumjs-3d-tiles` | Loading tilesets, MVT as runtime 3D Tiles, styling features, querying metadata, voxels, point clouds, clipping |
|
|
18
|
+
| `cesiumjs-imagery` | Adding/swapping base map layers, configuring imagery providers, split-screen comparisons |
|
|
19
|
+
| `cesiumjs-terrain-environment` | Configuring terrain, querying heights, atmosphere/sky/fog/lighting/shadows, panoramas |
|
|
20
|
+
| `cesiumjs-primitives` | Performance-critical static geometry, custom shapes, batching, BufferPrimitive collections, GeoJsonPrimitive |
|
|
21
|
+
| `cesiumjs-materials-shaders` | Fabric materials, ImageBasedLighting, post-processing effects, bloom, tonemapping |
|
|
22
|
+
| `cesiumjs-custom-shader` | Writing GLSL shader bodies for Model/Cesium3DTileset/VoxelPrimitive; reading feature IDs or structural metadata inside a shader |
|
|
23
|
+
| `cesiumjs-time-properties` | Time-dynamic entity attributes, simulation clock, interpolation, sampled/callback properties |
|
|
24
|
+
| `cesiumjs-spatial-math` | Coordinate conversions, ellipsoid geometry, model matrices, intersection tests, projections |
|
|
25
|
+
| `cesiumjs-interaction` | User clicks on the globe, multi-modifier input actions, entity/feature selection, hover effects, drag interactions |
|
|
26
|
+
| `cesiumjs-models-particles` | glTF/GLB model loading, edge display modes, animations, particle effects (fire, smoke) |
|
|
27
|
+
| `cesiumjs-core-utilities` | HTTP requests via Resource, Color, Event, error handling, helper functions |
|
|
28
|
+
|
|
29
|
+
## Cross-Domain Questions
|
|
30
|
+
|
|
31
|
+
When a question spans multiple domains, consult `docs/DOMAINS.md` — the definitive ownership map assigning every public CesiumJS class, function, and enum to exactly one skill.
|
|
32
|
+
|
|
33
|
+
## Runtime Verification
|
|
34
|
+
|
|
35
|
+
Chrome DevTools MCP is available for browser-based iteration: console error checking, network inspection, screenshots, and Lighthouse audits.
|