@saschabrunnerch/arcgis-maps-sdk-js-ai-context 0.0.2 → 0.1.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/README.md +163 -203
- package/bin/cli.js +157 -173
- package/contexts/4.34/{claude → skills}/arcgis-3d-advanced/SKILL.md +586 -586
- package/contexts/4.34/{claude → skills}/arcgis-advanced-layers/SKILL.md +431 -431
- package/contexts/4.34/{claude → skills}/arcgis-analysis-services/SKILL.md +607 -607
- package/contexts/4.34/{claude → skills}/arcgis-authentication/SKILL.md +301 -301
- package/contexts/4.34/{claude → skills}/arcgis-cim-symbols/SKILL.md +486 -486
- package/contexts/4.34/{claude → skills}/arcgis-coordinates-projection/SKILL.md +406 -406
- package/contexts/4.34/{claude → skills}/arcgis-core-maps/SKILL.md +739 -739
- package/contexts/4.34/{claude → skills}/arcgis-core-utilities/SKILL.md +732 -732
- package/contexts/4.34/{claude → skills}/arcgis-custom-rendering/SKILL.md +445 -445
- package/contexts/4.34/{claude → skills}/arcgis-editing-advanced/SKILL.md +702 -702
- package/contexts/4.34/{claude → skills}/arcgis-feature-effects/SKILL.md +393 -393
- package/contexts/4.34/{claude → skills}/arcgis-geometry-operations/SKILL.md +489 -489
- package/contexts/4.34/{claude → skills}/arcgis-imagery/SKILL.md +307 -307
- package/contexts/4.34/{claude → skills}/arcgis-interaction/SKILL.md +572 -572
- package/contexts/4.34/{claude → skills}/arcgis-knowledge-graphs/SKILL.md +582 -582
- package/contexts/4.34/{claude → skills}/arcgis-layers/SKILL.md +601 -601
- package/contexts/4.34/{claude → skills}/arcgis-map-tools/SKILL.md +668 -668
- package/contexts/4.34/{claude → skills}/arcgis-media-layers/SKILL.md +290 -290
- package/contexts/4.34/{claude → skills}/arcgis-portal-content/SKILL.md +679 -679
- package/contexts/4.34/{claude → skills}/arcgis-scene-effects/SKILL.md +512 -512
- package/contexts/4.34/{claude → skills}/arcgis-smart-mapping/SKILL.md +686 -686
- package/contexts/4.34/{claude → skills}/arcgis-starter-app-extended/SKILL.md +649 -649
- package/contexts/4.34/{claude → skills}/arcgis-tables-forms/SKILL.md +877 -877
- package/contexts/4.34/{claude → skills}/arcgis-time-animation/SKILL.md +722 -722
- package/contexts/4.34/{claude → skills}/arcgis-utility-networks/SKILL.md +301 -301
- package/contexts/4.34/{claude → skills}/arcgis-visualization/SKILL.md +580 -580
- package/contexts/4.34/{claude → skills}/arcgis-widgets-ui/SKILL.md +574 -574
- package/lib/installer.js +19 -104
- package/package.json +45 -45
- package/contexts/4.34/copilot/arcgis-3d.instructions.md +0 -267
- package/contexts/4.34/copilot/arcgis-analysis.instructions.md +0 -294
- package/contexts/4.34/copilot/arcgis-arcade.instructions.md +0 -234
- package/contexts/4.34/copilot/arcgis-authentication.instructions.md +0 -187
- package/contexts/4.34/copilot/arcgis-cim-symbols.instructions.md +0 -177
- package/contexts/4.34/copilot/arcgis-core-maps.instructions.md +0 -246
- package/contexts/4.34/copilot/arcgis-core-utilities.instructions.md +0 -247
- package/contexts/4.34/copilot/arcgis-editing.instructions.md +0 -262
- package/contexts/4.34/copilot/arcgis-geometry.instructions.md +0 -225
- package/contexts/4.34/copilot/arcgis-layers.instructions.md +0 -278
- package/contexts/4.34/copilot/arcgis-popup-templates.instructions.md +0 -266
- package/contexts/4.34/copilot/arcgis-portal-advanced.instructions.md +0 -275
- package/contexts/4.34/copilot/arcgis-smart-mapping.instructions.md +0 -184
- package/contexts/4.34/copilot/arcgis-starter-app-extended.instructions.md +0 -643
- package/contexts/4.34/copilot/arcgis-starter-app.instructions.md +0 -268
- package/contexts/4.34/copilot/arcgis-time-animation.instructions.md +0 -112
- package/contexts/4.34/copilot/arcgis-visualization.instructions.md +0 -321
- package/contexts/4.34/copilot/arcgis-widgets-ui.instructions.md +0 -277
- /package/contexts/4.34/{claude → skills}/arcgis-arcade/SKILL.md +0 -0
- /package/contexts/4.34/{claude → skills}/arcgis-popup-templates/SKILL.md +0 -0
- /package/contexts/4.34/{claude → skills}/arcgis-starter-app/SKILL.md +0 -0
|
@@ -1,512 +1,512 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: arcgis-scene-effects
|
|
3
|
-
description: Configure SceneView environment settings including shadows, lighting, backgrounds, underground navigation, and elevation modes. Use for realistic 3D visualizations.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# ArcGIS Scene Effects
|
|
7
|
-
|
|
8
|
-
Use this skill for configuring SceneView environment, shadows, backgrounds, underground navigation, and elevation settings.
|
|
9
|
-
|
|
10
|
-
## Environment Settings
|
|
11
|
-
|
|
12
|
-
### Basic Environment Configuration
|
|
13
|
-
```javascript
|
|
14
|
-
const view = new SceneView({
|
|
15
|
-
container: "viewDiv",
|
|
16
|
-
map: scene,
|
|
17
|
-
environment: {
|
|
18
|
-
lighting: {
|
|
19
|
-
directShadowsEnabled: true,
|
|
20
|
-
date: new Date("Sun Mar 15 2019 16:00:00 GMT+0100")
|
|
21
|
-
},
|
|
22
|
-
atmosphereEnabled: true,
|
|
23
|
-
starsEnabled: true
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Map Component Environment
|
|
29
|
-
```html
|
|
30
|
-
<arcgis-scene item-id="YOUR_WEBSCENE_ID">
|
|
31
|
-
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
32
|
-
</arcgis-scene>
|
|
33
|
-
|
|
34
|
-
<script type="module">
|
|
35
|
-
const viewElement = document.querySelector("arcgis-scene");
|
|
36
|
-
await viewElement.viewOnReady();
|
|
37
|
-
|
|
38
|
-
viewElement.environment = {
|
|
39
|
-
lighting: {
|
|
40
|
-
directShadowsEnabled: true,
|
|
41
|
-
date: new Date()
|
|
42
|
-
},
|
|
43
|
-
atmosphereEnabled: true,
|
|
44
|
-
starsEnabled: true
|
|
45
|
-
};
|
|
46
|
-
</script>
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Shadows and Lighting
|
|
50
|
-
|
|
51
|
-
### Enable Direct Shadows
|
|
52
|
-
```javascript
|
|
53
|
-
view.environment = {
|
|
54
|
-
lighting: {
|
|
55
|
-
directShadowsEnabled: true,
|
|
56
|
-
date: new Date("Sun Mar 15 2019 16:00:00 GMT+0100")
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// Update time of day dynamically
|
|
61
|
-
function updateTimeOfDay(dateString) {
|
|
62
|
-
view.environment.lighting.date = new Date(dateString);
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Toggle Shadows on Symbols
|
|
67
|
-
```javascript
|
|
68
|
-
// Clone renderer and toggle castShadows
|
|
69
|
-
const clone = layer.renderer.clone();
|
|
70
|
-
clone.symbol.symbolLayers.getItemAt(0).castShadows = true;
|
|
71
|
-
layer.renderer = clone;
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Highlight Shadow Color
|
|
75
|
-
```javascript
|
|
76
|
-
import HighlightOptions from "@arcgis/core/views/support/HighlightOptions.js";
|
|
77
|
-
|
|
78
|
-
const highlightOptions = new HighlightOptions({
|
|
79
|
-
name: "default",
|
|
80
|
-
color: "cyan",
|
|
81
|
-
shadowColor: "cyan"
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
view.highlights = [highlightOptions];
|
|
85
|
-
|
|
86
|
-
// Change shadow color dynamically
|
|
87
|
-
highlightOptions.shadowColor = "#ff0000";
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Virtual Lighting
|
|
91
|
-
```javascript
|
|
92
|
-
view.environment = {
|
|
93
|
-
lighting: {
|
|
94
|
-
type: "virtual" // Consistent lighting without sun position
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Transparent Background
|
|
100
|
-
|
|
101
|
-
### Configure Transparent Background
|
|
102
|
-
```javascript
|
|
103
|
-
const view = new SceneView({
|
|
104
|
-
container: "viewDiv",
|
|
105
|
-
map: scene,
|
|
106
|
-
alphaCompositingEnabled: true, // Required for transparency
|
|
107
|
-
environment: {
|
|
108
|
-
background: {
|
|
109
|
-
type: "color",
|
|
110
|
-
color: [255, 252, 244, 0] // RGBA with 0 alpha = transparent
|
|
111
|
-
},
|
|
112
|
-
starsEnabled: false,
|
|
113
|
-
atmosphereEnabled: false
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Toggle Background Transparency
|
|
119
|
-
```javascript
|
|
120
|
-
// Make background transparent
|
|
121
|
-
const backgroundColor = view.environment.background.color.clone();
|
|
122
|
-
backgroundColor.a = 0; // 0 = transparent, 1 = opaque
|
|
123
|
-
view.environment.background.color = backgroundColor;
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Underground Navigation
|
|
127
|
-
|
|
128
|
-
### Enable Underground Navigation (Map Component)
|
|
129
|
-
```html
|
|
130
|
-
<arcgis-scene item-id="YOUR_WEBSCENE_ID">
|
|
131
|
-
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
132
|
-
</arcgis-scene>
|
|
133
|
-
|
|
134
|
-
<script type="module">
|
|
135
|
-
const viewElement = document.querySelector("arcgis-scene");
|
|
136
|
-
await viewElement.viewOnReady();
|
|
137
|
-
|
|
138
|
-
// Allow navigation below ground
|
|
139
|
-
viewElement.map.ground.navigationConstraint = {
|
|
140
|
-
type: "none"
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
// Set ground opacity to see through
|
|
144
|
-
viewElement.map.ground.opacity = 0.4;
|
|
145
|
-
|
|
146
|
-
// Optional: set surface color when no basemap
|
|
147
|
-
viewElement.map.ground.surfaceColor = "#fff";
|
|
148
|
-
</script>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Underground Navigation (Core API)
|
|
152
|
-
```javascript
|
|
153
|
-
const view = new SceneView({
|
|
154
|
-
container: "viewDiv",
|
|
155
|
-
map: scene
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
view.when(() => {
|
|
159
|
-
// Allow camera below ground
|
|
160
|
-
view.map.ground.navigationConstraint = {
|
|
161
|
-
type: "none"
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// Make ground semi-transparent
|
|
165
|
-
view.map.ground.opacity = 0.4;
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// Navigate to underground viewpoint
|
|
169
|
-
view.goTo({
|
|
170
|
-
position: {
|
|
171
|
-
x: -122.4,
|
|
172
|
-
y: 37.8,
|
|
173
|
-
z: -500, // Negative z = underground
|
|
174
|
-
spatialReference: { wkid: 4326 }
|
|
175
|
-
},
|
|
176
|
-
tilt: 80
|
|
177
|
-
});
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Local Scene Mode
|
|
181
|
-
|
|
182
|
-
### Create Local Scene
|
|
183
|
-
```html
|
|
184
|
-
<arcgis-scene basemap="topo-vector" viewing-mode="local">
|
|
185
|
-
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
186
|
-
</arcgis-scene>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Local Scene with Clipping Area
|
|
190
|
-
```javascript
|
|
191
|
-
const viewElement = document.querySelector("arcgis-scene");
|
|
192
|
-
await viewElement.viewOnReady();
|
|
193
|
-
|
|
194
|
-
// Define clipping extent
|
|
195
|
-
const clippingExtent = {
|
|
196
|
-
xmax: -10834217,
|
|
197
|
-
xmin: -10932882,
|
|
198
|
-
ymax: 4493918,
|
|
199
|
-
ymin: 4432667,
|
|
200
|
-
spatialReference: { wkid: 3857 }
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// Set clipping area
|
|
204
|
-
viewElement.clippingArea = clippingExtent;
|
|
205
|
-
viewElement.extent = clippingExtent;
|
|
206
|
-
|
|
207
|
-
// Disable atmosphere for local scenes
|
|
208
|
-
viewElement.environment = {
|
|
209
|
-
atmosphereEnabled: false,
|
|
210
|
-
starsEnabled: false
|
|
211
|
-
};
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Elevation Info
|
|
215
|
-
|
|
216
|
-
### Elevation Modes
|
|
217
|
-
```javascript
|
|
218
|
-
// Feature placement relative to ground/scene
|
|
219
|
-
layer.elevationInfo = {
|
|
220
|
-
mode: "on-the-ground" // Features draped on ground
|
|
221
|
-
// mode: "relative-to-ground" // Features offset from ground
|
|
222
|
-
// mode: "relative-to-scene" // Features offset from scene
|
|
223
|
-
// mode: "absolute-height" // Features at absolute Z values
|
|
224
|
-
};
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### Elevation with Offset
|
|
228
|
-
```javascript
|
|
229
|
-
layer.elevationInfo = {
|
|
230
|
-
mode: "relative-to-ground",
|
|
231
|
-
offset: 100, // Meters above ground
|
|
232
|
-
unit: "meters"
|
|
233
|
-
};
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
### Elevation with Expression
|
|
237
|
-
```javascript
|
|
238
|
-
layer.elevationInfo = {
|
|
239
|
-
mode: "relative-to-ground",
|
|
240
|
-
featureExpressionInfo: {
|
|
241
|
-
expression: "Geometry($feature).z * 10" // Exaggerate Z values
|
|
242
|
-
},
|
|
243
|
-
unit: "meters"
|
|
244
|
-
};
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Dynamic Elevation Configuration
|
|
248
|
-
```javascript
|
|
249
|
-
function updateElevationInfo(mode, offset, expression, unit) {
|
|
250
|
-
layer.elevationInfo = {
|
|
251
|
-
mode: mode,
|
|
252
|
-
offset: Number(offset),
|
|
253
|
-
featureExpressionInfo: {
|
|
254
|
-
expression: expression || "0"
|
|
255
|
-
},
|
|
256
|
-
unit: unit
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
## Screenshot Capture
|
|
262
|
-
|
|
263
|
-
### Take Screenshot
|
|
264
|
-
```javascript
|
|
265
|
-
const viewElement = document.querySelector("arcgis-scene");
|
|
266
|
-
|
|
267
|
-
// Take full view screenshot
|
|
268
|
-
const screenshot = await viewElement.takeScreenshot({
|
|
269
|
-
format: "png"
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
// Display screenshot
|
|
273
|
-
const img = document.createElement("img");
|
|
274
|
-
img.src = screenshot.dataUrl;
|
|
275
|
-
document.body.appendChild(img);
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Screenshot of Specific Area
|
|
279
|
-
```javascript
|
|
280
|
-
const screenshot = await viewElement.takeScreenshot({
|
|
281
|
-
area: {
|
|
282
|
-
x: 100,
|
|
283
|
-
y: 100,
|
|
284
|
-
width: 500,
|
|
285
|
-
height: 400
|
|
286
|
-
},
|
|
287
|
-
format: "png"
|
|
288
|
-
});
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Screenshot with Drag Selection
|
|
292
|
-
```javascript
|
|
293
|
-
viewElement.addEventListener("arcgisViewDrag", (event) => {
|
|
294
|
-
event.detail.stopPropagation(); // Prevent navigation
|
|
295
|
-
|
|
296
|
-
if (event.detail.action === "end") {
|
|
297
|
-
const area = {
|
|
298
|
-
x: Math.min(event.detail.origin.x, event.detail.x),
|
|
299
|
-
y: Math.min(event.detail.origin.y, event.detail.y),
|
|
300
|
-
width: Math.abs(event.detail.x - event.detail.origin.x),
|
|
301
|
-
height: Math.abs(event.detail.y - event.detail.origin.y)
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
viewElement.takeScreenshot({ area, format: "png" })
|
|
305
|
-
.then(screenshot => {
|
|
306
|
-
// Use screenshot.dataUrl or screenshot.data
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
### Download Screenshot
|
|
313
|
-
```javascript
|
|
314
|
-
function downloadImage(filename, dataUrl) {
|
|
315
|
-
const element = document.createElement("a");
|
|
316
|
-
element.href = dataUrl;
|
|
317
|
-
element.download = filename;
|
|
318
|
-
element.click();
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const screenshot = await view.takeScreenshot({ format: "png" });
|
|
322
|
-
downloadImage("scene-screenshot.png", screenshot.dataUrl);
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
## Atmosphere and Stars
|
|
326
|
-
|
|
327
|
-
### Configure Atmosphere
|
|
328
|
-
```javascript
|
|
329
|
-
view.environment = {
|
|
330
|
-
atmosphereEnabled: true, // Show atmosphere haze
|
|
331
|
-
starsEnabled: true, // Show stars at night
|
|
332
|
-
lighting: {
|
|
333
|
-
date: new Date() // Current sun position
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### Disable for Clean Visualization
|
|
339
|
-
```javascript
|
|
340
|
-
view.environment = {
|
|
341
|
-
atmosphereEnabled: false,
|
|
342
|
-
starsEnabled: false
|
|
343
|
-
};
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
## View Constraints
|
|
347
|
-
|
|
348
|
-
### Altitude Constraints
|
|
349
|
-
```javascript
|
|
350
|
-
const view = new SceneView({
|
|
351
|
-
container: "viewDiv",
|
|
352
|
-
map: scene,
|
|
353
|
-
constraints: {
|
|
354
|
-
altitude: {
|
|
355
|
-
min: 20000000, // Minimum camera altitude
|
|
356
|
-
max: 25000000 // Maximum camera altitude
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
## Focus Area
|
|
363
|
-
|
|
364
|
-
### Create Focus Area
|
|
365
|
-
```javascript
|
|
366
|
-
import FocusArea from "@arcgis/core/effects/FocusArea.js";
|
|
367
|
-
import Polygon from "@arcgis/core/geometry/Polygon.js";
|
|
368
|
-
import Collection from "@arcgis/core/core/Collection.js";
|
|
369
|
-
|
|
370
|
-
// Define focus area geometry
|
|
371
|
-
const focusGeometry = new Polygon({
|
|
372
|
-
spatialReference: { wkid: 102100 },
|
|
373
|
-
rings: [[
|
|
374
|
-
[1288603, 6130075],
|
|
375
|
-
[1288506, 6129722],
|
|
376
|
-
[1288260, 6129821],
|
|
377
|
-
[1288603, 6130075]
|
|
378
|
-
]]
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
// Create focus area effect
|
|
382
|
-
const focusArea = new FocusArea({
|
|
383
|
-
title: "Area of Interest",
|
|
384
|
-
id: "focus-1",
|
|
385
|
-
outline: { color: [255, 128, 128, 0.55] },
|
|
386
|
-
geometries: new Collection([focusGeometry])
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
// Add to view
|
|
390
|
-
viewElement.focusAreas.areas.add(focusArea);
|
|
391
|
-
viewElement.focusAreas.style = "bright"; // or "dark"
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
### Focus Area Styles
|
|
395
|
-
```javascript
|
|
396
|
-
// Bright style - highlights focus area
|
|
397
|
-
viewElement.focusAreas.style = "bright";
|
|
398
|
-
|
|
399
|
-
// Dark style - darkens surrounding area
|
|
400
|
-
viewElement.focusAreas.style = "dark";
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
### Toggle Focus Area
|
|
404
|
-
```javascript
|
|
405
|
-
// Disable focus area
|
|
406
|
-
focusArea.enabled = false;
|
|
407
|
-
|
|
408
|
-
// Enable focus area
|
|
409
|
-
focusArea.enabled = true;
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
### Update Focus Area Geometry
|
|
413
|
-
```javascript
|
|
414
|
-
import SketchViewModel from "@arcgis/core/widgets/Sketch/SketchViewModel.js";
|
|
415
|
-
|
|
416
|
-
const sketchVM = new SketchViewModel({
|
|
417
|
-
view: view,
|
|
418
|
-
layer: graphicsLayer
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
sketchVM.on("update", (event) => {
|
|
422
|
-
// Update focus area with new geometry
|
|
423
|
-
focusArea.geometries = new Collection([event.graphics[0].geometry]);
|
|
424
|
-
});
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
## Complete Example
|
|
428
|
-
|
|
429
|
-
```html
|
|
430
|
-
<!DOCTYPE html>
|
|
431
|
-
<html>
|
|
432
|
-
<head>
|
|
433
|
-
<script type="module" src="https://js.arcgis.com/calcite-components/3.3.3/calcite.esm.js"></script>
|
|
434
|
-
<script src="https://js.arcgis.com/4.34/"></script>
|
|
435
|
-
<script type="module" src="https://js.arcgis.com/4.34/map-components/"></script>
|
|
436
|
-
<style>
|
|
437
|
-
html, body { height: 100%; margin: 0; }
|
|
438
|
-
</style>
|
|
439
|
-
</head>
|
|
440
|
-
<body>
|
|
441
|
-
<arcgis-scene item-id="YOUR_WEBSCENE_ID">
|
|
442
|
-
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
443
|
-
</arcgis-scene>
|
|
444
|
-
|
|
445
|
-
<script type="module">
|
|
446
|
-
const viewElement = document.querySelector("arcgis-scene");
|
|
447
|
-
await viewElement.viewOnReady();
|
|
448
|
-
|
|
449
|
-
// Configure environment
|
|
450
|
-
viewElement.environment = {
|
|
451
|
-
lighting: {
|
|
452
|
-
directShadowsEnabled: true,
|
|
453
|
-
date: new Date()
|
|
454
|
-
},
|
|
455
|
-
atmosphereEnabled: true,
|
|
456
|
-
starsEnabled: true
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
// Enable underground navigation
|
|
460
|
-
viewElement.map.ground.navigationConstraint = { type: "none" };
|
|
461
|
-
viewElement.map.ground.opacity = 0.6;
|
|
462
|
-
|
|
463
|
-
// Configure layer elevation
|
|
464
|
-
const layer = viewElement.map.layers.getItemAt(0);
|
|
465
|
-
layer.elevationInfo = {
|
|
466
|
-
mode: "relative-to-ground",
|
|
467
|
-
offset: 50,
|
|
468
|
-
unit: "meters"
|
|
469
|
-
};
|
|
470
|
-
</script>
|
|
471
|
-
</body>
|
|
472
|
-
</html>
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
## TypeScript Usage
|
|
476
|
-
|
|
477
|
-
Scene environment configurations use autocasting. For TypeScript safety, use `as const`:
|
|
478
|
-
|
|
479
|
-
```typescript
|
|
480
|
-
// Use 'as const' for environment settings
|
|
481
|
-
view.environment = {
|
|
482
|
-
lighting: {
|
|
483
|
-
date: new Date("2024-06-21T12:00:00"),
|
|
484
|
-
directShadowsEnabled: true
|
|
485
|
-
},
|
|
486
|
-
weather: {
|
|
487
|
-
type: "sunny",
|
|
488
|
-
cloudCover: 0.3
|
|
489
|
-
} as const,
|
|
490
|
-
background: {
|
|
491
|
-
type: "color",
|
|
492
|
-
color: [0, 0, 0, 1]
|
|
493
|
-
} as const
|
|
494
|
-
};
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
> **Tip:** See [arcgis-core-maps skill](../arcgis-core-maps/SKILL.md) for detailed guidance on autocasting vs explicit classes.
|
|
498
|
-
|
|
499
|
-
## Common Pitfalls
|
|
500
|
-
|
|
501
|
-
1. **Alpha compositing**: Must set `alphaCompositingEnabled: true` for transparent backgrounds
|
|
502
|
-
|
|
503
|
-
2. **Local scenes**: Require clipping area and typically disable atmosphere/stars
|
|
504
|
-
|
|
505
|
-
3. **Underground navigation**: Must set `ground.navigationConstraint.type = "none"`
|
|
506
|
-
|
|
507
|
-
4. **Shadow performance**: `directShadowsEnabled` can impact performance
|
|
508
|
-
|
|
509
|
-
5. **Elevation modes**: "on-the-ground" ignores offset and expression settings
|
|
510
|
-
|
|
511
|
-
6. **Screenshot CORS**: External layers may block screenshot capture
|
|
512
|
-
|
|
1
|
+
---
|
|
2
|
+
name: arcgis-scene-effects
|
|
3
|
+
description: Configure SceneView environment settings including shadows, lighting, backgrounds, underground navigation, and elevation modes. Use for realistic 3D visualizations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ArcGIS Scene Effects
|
|
7
|
+
|
|
8
|
+
Use this skill for configuring SceneView environment, shadows, backgrounds, underground navigation, and elevation settings.
|
|
9
|
+
|
|
10
|
+
## Environment Settings
|
|
11
|
+
|
|
12
|
+
### Basic Environment Configuration
|
|
13
|
+
```javascript
|
|
14
|
+
const view = new SceneView({
|
|
15
|
+
container: "viewDiv",
|
|
16
|
+
map: scene,
|
|
17
|
+
environment: {
|
|
18
|
+
lighting: {
|
|
19
|
+
directShadowsEnabled: true,
|
|
20
|
+
date: new Date("Sun Mar 15 2019 16:00:00 GMT+0100")
|
|
21
|
+
},
|
|
22
|
+
atmosphereEnabled: true,
|
|
23
|
+
starsEnabled: true
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Map Component Environment
|
|
29
|
+
```html
|
|
30
|
+
<arcgis-scene item-id="YOUR_WEBSCENE_ID">
|
|
31
|
+
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
32
|
+
</arcgis-scene>
|
|
33
|
+
|
|
34
|
+
<script type="module">
|
|
35
|
+
const viewElement = document.querySelector("arcgis-scene");
|
|
36
|
+
await viewElement.viewOnReady();
|
|
37
|
+
|
|
38
|
+
viewElement.environment = {
|
|
39
|
+
lighting: {
|
|
40
|
+
directShadowsEnabled: true,
|
|
41
|
+
date: new Date()
|
|
42
|
+
},
|
|
43
|
+
atmosphereEnabled: true,
|
|
44
|
+
starsEnabled: true
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Shadows and Lighting
|
|
50
|
+
|
|
51
|
+
### Enable Direct Shadows
|
|
52
|
+
```javascript
|
|
53
|
+
view.environment = {
|
|
54
|
+
lighting: {
|
|
55
|
+
directShadowsEnabled: true,
|
|
56
|
+
date: new Date("Sun Mar 15 2019 16:00:00 GMT+0100")
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Update time of day dynamically
|
|
61
|
+
function updateTimeOfDay(dateString) {
|
|
62
|
+
view.environment.lighting.date = new Date(dateString);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Toggle Shadows on Symbols
|
|
67
|
+
```javascript
|
|
68
|
+
// Clone renderer and toggle castShadows
|
|
69
|
+
const clone = layer.renderer.clone();
|
|
70
|
+
clone.symbol.symbolLayers.getItemAt(0).castShadows = true;
|
|
71
|
+
layer.renderer = clone;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Highlight Shadow Color
|
|
75
|
+
```javascript
|
|
76
|
+
import HighlightOptions from "@arcgis/core/views/support/HighlightOptions.js";
|
|
77
|
+
|
|
78
|
+
const highlightOptions = new HighlightOptions({
|
|
79
|
+
name: "default",
|
|
80
|
+
color: "cyan",
|
|
81
|
+
shadowColor: "cyan"
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
view.highlights = [highlightOptions];
|
|
85
|
+
|
|
86
|
+
// Change shadow color dynamically
|
|
87
|
+
highlightOptions.shadowColor = "#ff0000";
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Virtual Lighting
|
|
91
|
+
```javascript
|
|
92
|
+
view.environment = {
|
|
93
|
+
lighting: {
|
|
94
|
+
type: "virtual" // Consistent lighting without sun position
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Transparent Background
|
|
100
|
+
|
|
101
|
+
### Configure Transparent Background
|
|
102
|
+
```javascript
|
|
103
|
+
const view = new SceneView({
|
|
104
|
+
container: "viewDiv",
|
|
105
|
+
map: scene,
|
|
106
|
+
alphaCompositingEnabled: true, // Required for transparency
|
|
107
|
+
environment: {
|
|
108
|
+
background: {
|
|
109
|
+
type: "color",
|
|
110
|
+
color: [255, 252, 244, 0] // RGBA with 0 alpha = transparent
|
|
111
|
+
},
|
|
112
|
+
starsEnabled: false,
|
|
113
|
+
atmosphereEnabled: false
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Toggle Background Transparency
|
|
119
|
+
```javascript
|
|
120
|
+
// Make background transparent
|
|
121
|
+
const backgroundColor = view.environment.background.color.clone();
|
|
122
|
+
backgroundColor.a = 0; // 0 = transparent, 1 = opaque
|
|
123
|
+
view.environment.background.color = backgroundColor;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Underground Navigation
|
|
127
|
+
|
|
128
|
+
### Enable Underground Navigation (Map Component)
|
|
129
|
+
```html
|
|
130
|
+
<arcgis-scene item-id="YOUR_WEBSCENE_ID">
|
|
131
|
+
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
132
|
+
</arcgis-scene>
|
|
133
|
+
|
|
134
|
+
<script type="module">
|
|
135
|
+
const viewElement = document.querySelector("arcgis-scene");
|
|
136
|
+
await viewElement.viewOnReady();
|
|
137
|
+
|
|
138
|
+
// Allow navigation below ground
|
|
139
|
+
viewElement.map.ground.navigationConstraint = {
|
|
140
|
+
type: "none"
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// Set ground opacity to see through
|
|
144
|
+
viewElement.map.ground.opacity = 0.4;
|
|
145
|
+
|
|
146
|
+
// Optional: set surface color when no basemap
|
|
147
|
+
viewElement.map.ground.surfaceColor = "#fff";
|
|
148
|
+
</script>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Underground Navigation (Core API)
|
|
152
|
+
```javascript
|
|
153
|
+
const view = new SceneView({
|
|
154
|
+
container: "viewDiv",
|
|
155
|
+
map: scene
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
view.when(() => {
|
|
159
|
+
// Allow camera below ground
|
|
160
|
+
view.map.ground.navigationConstraint = {
|
|
161
|
+
type: "none"
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// Make ground semi-transparent
|
|
165
|
+
view.map.ground.opacity = 0.4;
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Navigate to underground viewpoint
|
|
169
|
+
view.goTo({
|
|
170
|
+
position: {
|
|
171
|
+
x: -122.4,
|
|
172
|
+
y: 37.8,
|
|
173
|
+
z: -500, // Negative z = underground
|
|
174
|
+
spatialReference: { wkid: 4326 }
|
|
175
|
+
},
|
|
176
|
+
tilt: 80
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Local Scene Mode
|
|
181
|
+
|
|
182
|
+
### Create Local Scene
|
|
183
|
+
```html
|
|
184
|
+
<arcgis-scene basemap="topo-vector" viewing-mode="local">
|
|
185
|
+
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
186
|
+
</arcgis-scene>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Local Scene with Clipping Area
|
|
190
|
+
```javascript
|
|
191
|
+
const viewElement = document.querySelector("arcgis-scene");
|
|
192
|
+
await viewElement.viewOnReady();
|
|
193
|
+
|
|
194
|
+
// Define clipping extent
|
|
195
|
+
const clippingExtent = {
|
|
196
|
+
xmax: -10834217,
|
|
197
|
+
xmin: -10932882,
|
|
198
|
+
ymax: 4493918,
|
|
199
|
+
ymin: 4432667,
|
|
200
|
+
spatialReference: { wkid: 3857 }
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// Set clipping area
|
|
204
|
+
viewElement.clippingArea = clippingExtent;
|
|
205
|
+
viewElement.extent = clippingExtent;
|
|
206
|
+
|
|
207
|
+
// Disable atmosphere for local scenes
|
|
208
|
+
viewElement.environment = {
|
|
209
|
+
atmosphereEnabled: false,
|
|
210
|
+
starsEnabled: false
|
|
211
|
+
};
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Elevation Info
|
|
215
|
+
|
|
216
|
+
### Elevation Modes
|
|
217
|
+
```javascript
|
|
218
|
+
// Feature placement relative to ground/scene
|
|
219
|
+
layer.elevationInfo = {
|
|
220
|
+
mode: "on-the-ground" // Features draped on ground
|
|
221
|
+
// mode: "relative-to-ground" // Features offset from ground
|
|
222
|
+
// mode: "relative-to-scene" // Features offset from scene
|
|
223
|
+
// mode: "absolute-height" // Features at absolute Z values
|
|
224
|
+
};
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Elevation with Offset
|
|
228
|
+
```javascript
|
|
229
|
+
layer.elevationInfo = {
|
|
230
|
+
mode: "relative-to-ground",
|
|
231
|
+
offset: 100, // Meters above ground
|
|
232
|
+
unit: "meters"
|
|
233
|
+
};
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Elevation with Expression
|
|
237
|
+
```javascript
|
|
238
|
+
layer.elevationInfo = {
|
|
239
|
+
mode: "relative-to-ground",
|
|
240
|
+
featureExpressionInfo: {
|
|
241
|
+
expression: "Geometry($feature).z * 10" // Exaggerate Z values
|
|
242
|
+
},
|
|
243
|
+
unit: "meters"
|
|
244
|
+
};
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Dynamic Elevation Configuration
|
|
248
|
+
```javascript
|
|
249
|
+
function updateElevationInfo(mode, offset, expression, unit) {
|
|
250
|
+
layer.elevationInfo = {
|
|
251
|
+
mode: mode,
|
|
252
|
+
offset: Number(offset),
|
|
253
|
+
featureExpressionInfo: {
|
|
254
|
+
expression: expression || "0"
|
|
255
|
+
},
|
|
256
|
+
unit: unit
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Screenshot Capture
|
|
262
|
+
|
|
263
|
+
### Take Screenshot
|
|
264
|
+
```javascript
|
|
265
|
+
const viewElement = document.querySelector("arcgis-scene");
|
|
266
|
+
|
|
267
|
+
// Take full view screenshot
|
|
268
|
+
const screenshot = await viewElement.takeScreenshot({
|
|
269
|
+
format: "png"
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// Display screenshot
|
|
273
|
+
const img = document.createElement("img");
|
|
274
|
+
img.src = screenshot.dataUrl;
|
|
275
|
+
document.body.appendChild(img);
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Screenshot of Specific Area
|
|
279
|
+
```javascript
|
|
280
|
+
const screenshot = await viewElement.takeScreenshot({
|
|
281
|
+
area: {
|
|
282
|
+
x: 100,
|
|
283
|
+
y: 100,
|
|
284
|
+
width: 500,
|
|
285
|
+
height: 400
|
|
286
|
+
},
|
|
287
|
+
format: "png"
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Screenshot with Drag Selection
|
|
292
|
+
```javascript
|
|
293
|
+
viewElement.addEventListener("arcgisViewDrag", (event) => {
|
|
294
|
+
event.detail.stopPropagation(); // Prevent navigation
|
|
295
|
+
|
|
296
|
+
if (event.detail.action === "end") {
|
|
297
|
+
const area = {
|
|
298
|
+
x: Math.min(event.detail.origin.x, event.detail.x),
|
|
299
|
+
y: Math.min(event.detail.origin.y, event.detail.y),
|
|
300
|
+
width: Math.abs(event.detail.x - event.detail.origin.x),
|
|
301
|
+
height: Math.abs(event.detail.y - event.detail.origin.y)
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
viewElement.takeScreenshot({ area, format: "png" })
|
|
305
|
+
.then(screenshot => {
|
|
306
|
+
// Use screenshot.dataUrl or screenshot.data
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Download Screenshot
|
|
313
|
+
```javascript
|
|
314
|
+
function downloadImage(filename, dataUrl) {
|
|
315
|
+
const element = document.createElement("a");
|
|
316
|
+
element.href = dataUrl;
|
|
317
|
+
element.download = filename;
|
|
318
|
+
element.click();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const screenshot = await view.takeScreenshot({ format: "png" });
|
|
322
|
+
downloadImage("scene-screenshot.png", screenshot.dataUrl);
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Atmosphere and Stars
|
|
326
|
+
|
|
327
|
+
### Configure Atmosphere
|
|
328
|
+
```javascript
|
|
329
|
+
view.environment = {
|
|
330
|
+
atmosphereEnabled: true, // Show atmosphere haze
|
|
331
|
+
starsEnabled: true, // Show stars at night
|
|
332
|
+
lighting: {
|
|
333
|
+
date: new Date() // Current sun position
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Disable for Clean Visualization
|
|
339
|
+
```javascript
|
|
340
|
+
view.environment = {
|
|
341
|
+
atmosphereEnabled: false,
|
|
342
|
+
starsEnabled: false
|
|
343
|
+
};
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
## View Constraints
|
|
347
|
+
|
|
348
|
+
### Altitude Constraints
|
|
349
|
+
```javascript
|
|
350
|
+
const view = new SceneView({
|
|
351
|
+
container: "viewDiv",
|
|
352
|
+
map: scene,
|
|
353
|
+
constraints: {
|
|
354
|
+
altitude: {
|
|
355
|
+
min: 20000000, // Minimum camera altitude
|
|
356
|
+
max: 25000000 // Maximum camera altitude
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
## Focus Area
|
|
363
|
+
|
|
364
|
+
### Create Focus Area
|
|
365
|
+
```javascript
|
|
366
|
+
import FocusArea from "@arcgis/core/effects/FocusArea.js";
|
|
367
|
+
import Polygon from "@arcgis/core/geometry/Polygon.js";
|
|
368
|
+
import Collection from "@arcgis/core/core/Collection.js";
|
|
369
|
+
|
|
370
|
+
// Define focus area geometry
|
|
371
|
+
const focusGeometry = new Polygon({
|
|
372
|
+
spatialReference: { wkid: 102100 },
|
|
373
|
+
rings: [[
|
|
374
|
+
[1288603, 6130075],
|
|
375
|
+
[1288506, 6129722],
|
|
376
|
+
[1288260, 6129821],
|
|
377
|
+
[1288603, 6130075]
|
|
378
|
+
]]
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
// Create focus area effect
|
|
382
|
+
const focusArea = new FocusArea({
|
|
383
|
+
title: "Area of Interest",
|
|
384
|
+
id: "focus-1",
|
|
385
|
+
outline: { color: [255, 128, 128, 0.55] },
|
|
386
|
+
geometries: new Collection([focusGeometry])
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
// Add to view
|
|
390
|
+
viewElement.focusAreas.areas.add(focusArea);
|
|
391
|
+
viewElement.focusAreas.style = "bright"; // or "dark"
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Focus Area Styles
|
|
395
|
+
```javascript
|
|
396
|
+
// Bright style - highlights focus area
|
|
397
|
+
viewElement.focusAreas.style = "bright";
|
|
398
|
+
|
|
399
|
+
// Dark style - darkens surrounding area
|
|
400
|
+
viewElement.focusAreas.style = "dark";
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Toggle Focus Area
|
|
404
|
+
```javascript
|
|
405
|
+
// Disable focus area
|
|
406
|
+
focusArea.enabled = false;
|
|
407
|
+
|
|
408
|
+
// Enable focus area
|
|
409
|
+
focusArea.enabled = true;
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### Update Focus Area Geometry
|
|
413
|
+
```javascript
|
|
414
|
+
import SketchViewModel from "@arcgis/core/widgets/Sketch/SketchViewModel.js";
|
|
415
|
+
|
|
416
|
+
const sketchVM = new SketchViewModel({
|
|
417
|
+
view: view,
|
|
418
|
+
layer: graphicsLayer
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
sketchVM.on("update", (event) => {
|
|
422
|
+
// Update focus area with new geometry
|
|
423
|
+
focusArea.geometries = new Collection([event.graphics[0].geometry]);
|
|
424
|
+
});
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
## Complete Example
|
|
428
|
+
|
|
429
|
+
```html
|
|
430
|
+
<!DOCTYPE html>
|
|
431
|
+
<html>
|
|
432
|
+
<head>
|
|
433
|
+
<script type="module" src="https://js.arcgis.com/calcite-components/3.3.3/calcite.esm.js"></script>
|
|
434
|
+
<script src="https://js.arcgis.com/4.34/"></script>
|
|
435
|
+
<script type="module" src="https://js.arcgis.com/4.34/map-components/"></script>
|
|
436
|
+
<style>
|
|
437
|
+
html, body { height: 100%; margin: 0; }
|
|
438
|
+
</style>
|
|
439
|
+
</head>
|
|
440
|
+
<body>
|
|
441
|
+
<arcgis-scene item-id="YOUR_WEBSCENE_ID">
|
|
442
|
+
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
443
|
+
</arcgis-scene>
|
|
444
|
+
|
|
445
|
+
<script type="module">
|
|
446
|
+
const viewElement = document.querySelector("arcgis-scene");
|
|
447
|
+
await viewElement.viewOnReady();
|
|
448
|
+
|
|
449
|
+
// Configure environment
|
|
450
|
+
viewElement.environment = {
|
|
451
|
+
lighting: {
|
|
452
|
+
directShadowsEnabled: true,
|
|
453
|
+
date: new Date()
|
|
454
|
+
},
|
|
455
|
+
atmosphereEnabled: true,
|
|
456
|
+
starsEnabled: true
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
// Enable underground navigation
|
|
460
|
+
viewElement.map.ground.navigationConstraint = { type: "none" };
|
|
461
|
+
viewElement.map.ground.opacity = 0.6;
|
|
462
|
+
|
|
463
|
+
// Configure layer elevation
|
|
464
|
+
const layer = viewElement.map.layers.getItemAt(0);
|
|
465
|
+
layer.elevationInfo = {
|
|
466
|
+
mode: "relative-to-ground",
|
|
467
|
+
offset: 50,
|
|
468
|
+
unit: "meters"
|
|
469
|
+
};
|
|
470
|
+
</script>
|
|
471
|
+
</body>
|
|
472
|
+
</html>
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
## TypeScript Usage
|
|
476
|
+
|
|
477
|
+
Scene environment configurations use autocasting. For TypeScript safety, use `as const`:
|
|
478
|
+
|
|
479
|
+
```typescript
|
|
480
|
+
// Use 'as const' for environment settings
|
|
481
|
+
view.environment = {
|
|
482
|
+
lighting: {
|
|
483
|
+
date: new Date("2024-06-21T12:00:00"),
|
|
484
|
+
directShadowsEnabled: true
|
|
485
|
+
},
|
|
486
|
+
weather: {
|
|
487
|
+
type: "sunny",
|
|
488
|
+
cloudCover: 0.3
|
|
489
|
+
} as const,
|
|
490
|
+
background: {
|
|
491
|
+
type: "color",
|
|
492
|
+
color: [0, 0, 0, 1]
|
|
493
|
+
} as const
|
|
494
|
+
};
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
> **Tip:** See [arcgis-core-maps skill](../arcgis-core-maps/SKILL.md) for detailed guidance on autocasting vs explicit classes.
|
|
498
|
+
|
|
499
|
+
## Common Pitfalls
|
|
500
|
+
|
|
501
|
+
1. **Alpha compositing**: Must set `alphaCompositingEnabled: true` for transparent backgrounds
|
|
502
|
+
|
|
503
|
+
2. **Local scenes**: Require clipping area and typically disable atmosphere/stars
|
|
504
|
+
|
|
505
|
+
3. **Underground navigation**: Must set `ground.navigationConstraint.type = "none"`
|
|
506
|
+
|
|
507
|
+
4. **Shadow performance**: `directShadowsEnabled` can impact performance
|
|
508
|
+
|
|
509
|
+
5. **Elevation modes**: "on-the-ground" ignores offset and expression settings
|
|
510
|
+
|
|
511
|
+
6. **Screenshot CORS**: External layers may block screenshot capture
|
|
512
|
+
|