@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,586 +1,586 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: arcgis-3d-advanced
|
|
3
|
-
description: Advanced 3D features including VoxelLayer, PointCloudLayer, weather effects, daylight simulation, glTF model imports, and custom WebGL rendering. Use for volumetric data, LiDAR visualization, and immersive 3D experiences.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# ArcGIS 3D Advanced
|
|
7
|
-
|
|
8
|
-
Use this skill for advanced 3D visualization including voxel layers, point clouds, weather, daylight, glTF imports, and custom rendering.
|
|
9
|
-
|
|
10
|
-
## VoxelLayer (Volumetric 3D Data)
|
|
11
|
-
|
|
12
|
-
VoxelLayer displays 3D volumetric data like atmospheric, oceanographic, or geological data.
|
|
13
|
-
|
|
14
|
-
### Basic VoxelLayer
|
|
15
|
-
```javascript
|
|
16
|
-
import VoxelLayer from "@arcgis/core/layers/VoxelLayer.js";
|
|
17
|
-
|
|
18
|
-
const voxelLayer = new VoxelLayer({
|
|
19
|
-
url: "https://tiles.arcgis.com/tiles/.../SceneServer",
|
|
20
|
-
visible: true,
|
|
21
|
-
popupEnabled: true
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
map.add(voxelLayer);
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### VoxelLayer with Map Component
|
|
28
|
-
```html
|
|
29
|
-
<arcgis-scene viewing-mode="local">
|
|
30
|
-
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
31
|
-
<arcgis-legend slot="bottom-right"></arcgis-legend>
|
|
32
|
-
</arcgis-scene>
|
|
33
|
-
|
|
34
|
-
<script type="module">
|
|
35
|
-
import VoxelLayer from "@arcgis/core/layers/VoxelLayer.js";
|
|
36
|
-
|
|
37
|
-
const vxlLayer = new VoxelLayer({
|
|
38
|
-
url: "https://tiles.arcgis.com/tiles/.../SceneServer"
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const viewElement = document.querySelector("arcgis-scene");
|
|
42
|
-
viewElement.map = new Map({
|
|
43
|
-
layers: [vxlLayer],
|
|
44
|
-
ground: { navigationConstraint: "none" }
|
|
45
|
-
});
|
|
46
|
-
</script>
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### VoxelLayer Configuration
|
|
50
|
-
```javascript
|
|
51
|
-
const voxelLayer = new VoxelLayer({
|
|
52
|
-
url: "...",
|
|
53
|
-
// Variable to display
|
|
54
|
-
currentVariableId: 0,
|
|
55
|
-
// Slicing
|
|
56
|
-
enableDynamicSections: true,
|
|
57
|
-
// Rendering style
|
|
58
|
-
renderStyle: "volume", // or "surfaces"
|
|
59
|
-
// Quality settings
|
|
60
|
-
qualityFactor: 1.0
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Access voxel-specific properties after load
|
|
64
|
-
await voxelLayer.load();
|
|
65
|
-
console.log("Variables:", voxelLayer.variables);
|
|
66
|
-
console.log("Dimensions:", voxelLayer.dimensions);
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Voxel Slicing
|
|
70
|
-
```javascript
|
|
71
|
-
// Add dynamic section (slice)
|
|
72
|
-
voxelLayer.enableDynamicSections = true;
|
|
73
|
-
|
|
74
|
-
// Configure slice plane
|
|
75
|
-
const slicePlane = {
|
|
76
|
-
point: { x: 0, y: 0, z: -500 },
|
|
77
|
-
normal: { x: 0, y: 0, z: 1 }
|
|
78
|
-
};
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Voxel Isosurface
|
|
82
|
-
```javascript
|
|
83
|
-
// Create isosurface at specific value
|
|
84
|
-
const isosurface = {
|
|
85
|
-
value: 25,
|
|
86
|
-
enabled: true,
|
|
87
|
-
color: [255, 0, 0, 0.7]
|
|
88
|
-
};
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## PointCloudLayer (LiDAR Data)
|
|
92
|
-
|
|
93
|
-
### Basic PointCloudLayer
|
|
94
|
-
```javascript
|
|
95
|
-
import PointCloudLayer from "@arcgis/core/layers/PointCloudLayer.js";
|
|
96
|
-
|
|
97
|
-
const pcLayer = new PointCloudLayer({
|
|
98
|
-
url: "https://tiles.arcgis.com/tiles/.../SceneServer"
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
map.add(pcLayer);
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### PointCloud Renderers
|
|
105
|
-
|
|
106
|
-
```javascript
|
|
107
|
-
// RGB (True Color) Renderer
|
|
108
|
-
const rgbRenderer = {
|
|
109
|
-
type: "point-cloud-rgb",
|
|
110
|
-
field: "RGB"
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// Class (Classification) Renderer
|
|
114
|
-
const classRenderer = {
|
|
115
|
-
type: "point-cloud-unique-value",
|
|
116
|
-
field: "CLASS_CODE",
|
|
117
|
-
colorUniqueValueInfos: [
|
|
118
|
-
{ values: ["2"], label: "Ground", color: [139, 90, 43] },
|
|
119
|
-
{ values: ["6"], label: "Building", color: [194, 194, 194] },
|
|
120
|
-
{ values: ["5"], label: "High Vegetation", color: [34, 139, 34] }
|
|
121
|
-
]
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// Elevation Renderer (Stretch)
|
|
125
|
-
const elevationRenderer = {
|
|
126
|
-
type: "point-cloud-stretch",
|
|
127
|
-
field: "ELEVATION",
|
|
128
|
-
fieldTransformType: "none",
|
|
129
|
-
colorModulation: null,
|
|
130
|
-
stops: [
|
|
131
|
-
{ value: 0, color: [0, 0, 255] },
|
|
132
|
-
{ value: 50, color: [255, 255, 0] },
|
|
133
|
-
{ value: 100, color: [255, 0, 0] }
|
|
134
|
-
]
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
pcLayer.renderer = rgbRenderer;
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Smart Mapping for PointCloud
|
|
141
|
-
```javascript
|
|
142
|
-
import colorRendererCreator from "@arcgis/core/smartMapping/renderers/color.js";
|
|
143
|
-
import typeRendererCreator from "@arcgis/core/smartMapping/renderers/type.js";
|
|
144
|
-
|
|
145
|
-
// True color renderer
|
|
146
|
-
const rgbResponse = await colorRendererCreator.createPCTrueColorRenderer({
|
|
147
|
-
layer: pcLayer
|
|
148
|
-
});
|
|
149
|
-
pcLayer.renderer = rgbResponse.renderer;
|
|
150
|
-
|
|
151
|
-
// Classification renderer
|
|
152
|
-
const classResponse = await typeRendererCreator.createPCClassRenderer({
|
|
153
|
-
layer: pcLayer,
|
|
154
|
-
field: "CLASS_CODE"
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// Continuous color renderer
|
|
158
|
-
const elevResponse = await colorRendererCreator.createPCContinuousRenderer({
|
|
159
|
-
layer: pcLayer,
|
|
160
|
-
field: "ELEVATION"
|
|
161
|
-
});
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### PointCloud Filters
|
|
165
|
-
```javascript
|
|
166
|
-
pcLayer.filters = [{
|
|
167
|
-
field: "CLASS_CODE",
|
|
168
|
-
operator: "includes",
|
|
169
|
-
values: [2, 6] // Ground and Building only
|
|
170
|
-
}];
|
|
171
|
-
|
|
172
|
-
// Remove filters
|
|
173
|
-
pcLayer.filters = [];
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Weather Effects
|
|
177
|
-
|
|
178
|
-
### Weather Types
|
|
179
|
-
```javascript
|
|
180
|
-
// Sunny (default)
|
|
181
|
-
view.environment.weather = {
|
|
182
|
-
type: "sunny",
|
|
183
|
-
cloudCover: 0.2
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
// Cloudy
|
|
187
|
-
view.environment.weather = {
|
|
188
|
-
type: "cloudy",
|
|
189
|
-
cloudCover: 0.6
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
// Rainy
|
|
193
|
-
view.environment.weather = {
|
|
194
|
-
type: "rainy",
|
|
195
|
-
cloudCover: 0.8,
|
|
196
|
-
precipitation: 0.5 // 0-1
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
// Foggy
|
|
200
|
-
view.environment.weather = {
|
|
201
|
-
type: "foggy",
|
|
202
|
-
fogStrength: 0.5 // 0-1
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
// Snowy
|
|
206
|
-
view.environment.weather = {
|
|
207
|
-
type: "snowy",
|
|
208
|
-
cloudCover: 0.8,
|
|
209
|
-
precipitation: 0.5,
|
|
210
|
-
snowCover: "enabled" // or "disabled"
|
|
211
|
-
};
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### Weather Component
|
|
215
|
-
```html
|
|
216
|
-
<arcgis-scene item-id="...">
|
|
217
|
-
<arcgis-expand slot="top-right" expanded>
|
|
218
|
-
<arcgis-weather></arcgis-weather>
|
|
219
|
-
</arcgis-expand>
|
|
220
|
-
</arcgis-scene>
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### Weather Widget (Core API) - Deprecated
|
|
224
|
-
|
|
225
|
-
> **DEPRECATED since 4.33:** Use the `arcgis-weather` component shown above instead. For information on widget deprecation, see [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
|
|
226
|
-
|
|
227
|
-
```javascript
|
|
228
|
-
// DEPRECATED - Use arcgis-weather component instead
|
|
229
|
-
import Weather from "@arcgis/core/widgets/Weather.js";
|
|
230
|
-
|
|
231
|
-
const weatherWidget = new Weather({
|
|
232
|
-
view: view
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
view.ui.add(weatherWidget, "top-right");
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## Daylight & Lighting
|
|
239
|
-
|
|
240
|
-
### Setting Date/Time
|
|
241
|
-
```javascript
|
|
242
|
-
// Set lighting date and time
|
|
243
|
-
view.environment.lighting = {
|
|
244
|
-
date: new Date("2024-06-21T12:00:00"),
|
|
245
|
-
directShadowsEnabled: true,
|
|
246
|
-
ambientOcclusionEnabled: true
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
// Update time dynamically
|
|
250
|
-
function setTime(hours) {
|
|
251
|
-
const date = new Date(view.environment.lighting.date);
|
|
252
|
-
date.setHours(hours);
|
|
253
|
-
view.environment.lighting.date = date;
|
|
254
|
-
}
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### Daylight Component
|
|
258
|
-
```html
|
|
259
|
-
<arcgis-scene item-id="...">
|
|
260
|
-
<arcgis-expand slot="top-right" expanded>
|
|
261
|
-
<arcgis-daylight hide-timezone play-speed-multiplier="2"></arcgis-daylight>
|
|
262
|
-
</arcgis-expand>
|
|
263
|
-
</arcgis-scene>
|
|
264
|
-
|
|
265
|
-
<script type="module">
|
|
266
|
-
const daylight = document.querySelector("arcgis-daylight");
|
|
267
|
-
|
|
268
|
-
// Toggle sun position vs virtual lighting
|
|
269
|
-
daylight.sunlightingDisabled = false; // Use sun position
|
|
270
|
-
daylight.sunlightingDisabled = true; // Use virtual light
|
|
271
|
-
</script>
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Daylight Widget (Core API)
|
|
275
|
-
```javascript
|
|
276
|
-
import Daylight from "@arcgis/core/widgets/Daylight.js";
|
|
277
|
-
|
|
278
|
-
const daylightWidget = new Daylight({
|
|
279
|
-
view: view,
|
|
280
|
-
playSpeedMultiplier: 2 // Animation speed
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
view.ui.add(daylightWidget, "top-right");
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Shadow Analysis
|
|
287
|
-
```javascript
|
|
288
|
-
// Enable shadows
|
|
289
|
-
view.environment.lighting.directShadowsEnabled = true;
|
|
290
|
-
|
|
291
|
-
// Shadow cast analysis
|
|
292
|
-
import ShadowCastAnalysis from "@arcgis/core/analysis/ShadowCastAnalysis.js";
|
|
293
|
-
|
|
294
|
-
const shadowAnalysis = new ShadowCastAnalysis();
|
|
295
|
-
view.analyses.add(shadowAnalysis);
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
## Importing 3D Models (glTF)
|
|
299
|
-
|
|
300
|
-
### glTF Symbol
|
|
301
|
-
```javascript
|
|
302
|
-
const graphic = new Graphic({
|
|
303
|
-
geometry: {
|
|
304
|
-
type: "point",
|
|
305
|
-
longitude: -122.4,
|
|
306
|
-
latitude: 37.8,
|
|
307
|
-
z: 0
|
|
308
|
-
},
|
|
309
|
-
symbol: {
|
|
310
|
-
type: "point-3d",
|
|
311
|
-
symbolLayers: [{
|
|
312
|
-
type: "object",
|
|
313
|
-
resource: {
|
|
314
|
-
href: "https://example.com/model.glb"
|
|
315
|
-
},
|
|
316
|
-
// Optional: scale and rotate
|
|
317
|
-
width: 10,
|
|
318
|
-
height: 10,
|
|
319
|
-
depth: 10,
|
|
320
|
-
heading: 45,
|
|
321
|
-
tilt: 0,
|
|
322
|
-
roll: 0
|
|
323
|
-
}]
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
graphicsLayer.add(graphic);
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
### Interactive Model Placement
|
|
331
|
-
```javascript
|
|
332
|
-
import SketchViewModel from "@arcgis/core/widgets/Sketch/SketchViewModel.js";
|
|
333
|
-
|
|
334
|
-
const graphicsLayer = new GraphicsLayer({
|
|
335
|
-
elevationInfo: { mode: "on-the-ground" }
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
const sketchVM = new SketchViewModel({
|
|
339
|
-
layer: graphicsLayer,
|
|
340
|
-
view: view,
|
|
341
|
-
pointSymbol: {
|
|
342
|
-
type: "point-3d",
|
|
343
|
-
symbolLayers: [{
|
|
344
|
-
type: "object",
|
|
345
|
-
resource: {
|
|
346
|
-
href: "https://example.com/model.glb"
|
|
347
|
-
}
|
|
348
|
-
}]
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
// Start placing model
|
|
353
|
-
sketchVM.create("point");
|
|
354
|
-
|
|
355
|
-
sketchVM.on("create", (event) => {
|
|
356
|
-
if (event.state === "complete") {
|
|
357
|
-
// Model placed, allow editing
|
|
358
|
-
sketchVM.update(event.graphic);
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
## IntegratedMeshLayer
|
|
364
|
-
|
|
365
|
-
```javascript
|
|
366
|
-
import IntegratedMeshLayer from "@arcgis/core/layers/IntegratedMeshLayer.js";
|
|
367
|
-
|
|
368
|
-
const meshLayer = new IntegratedMeshLayer({
|
|
369
|
-
url: "https://tiles.arcgis.com/tiles/.../IntegratedMeshServer"
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
map.add(meshLayer);
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
## DimensionLayer (Length Dimensioning)
|
|
376
|
-
|
|
377
|
-
### Basic DimensionLayer
|
|
378
|
-
```javascript
|
|
379
|
-
import DimensionLayer from "@arcgis/core/layers/DimensionLayer.js";
|
|
380
|
-
import DimensionAnalysis from "@arcgis/core/analysis/DimensionAnalysis.js";
|
|
381
|
-
import LengthDimension from "@arcgis/core/analysis/LengthDimension.js";
|
|
382
|
-
|
|
383
|
-
// Create dimension analysis with style
|
|
384
|
-
const dimensionAnalysis = new DimensionAnalysis({
|
|
385
|
-
style: {
|
|
386
|
-
type: "simple",
|
|
387
|
-
textBackgroundColor: [0, 0, 0, 0.6],
|
|
388
|
-
textColor: "white",
|
|
389
|
-
fontSize: 12
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
// Create dimension layer
|
|
394
|
-
const dimensionLayer = new DimensionLayer({
|
|
395
|
-
title: "Dimensions",
|
|
396
|
-
source: dimensionAnalysis
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
map.add(dimensionLayer);
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
### Add Length Dimensions
|
|
403
|
-
```javascript
|
|
404
|
-
// Add a dimension between two points
|
|
405
|
-
const dimension = new LengthDimension({
|
|
406
|
-
startPoint: {
|
|
407
|
-
x: -122.4, y: 37.8, z: 0,
|
|
408
|
-
spatialReference: { wkid: 4326 }
|
|
409
|
-
},
|
|
410
|
-
endPoint: {
|
|
411
|
-
x: -122.5, y: 37.8, z: 0,
|
|
412
|
-
spatialReference: { wkid: 4326 }
|
|
413
|
-
},
|
|
414
|
-
orientation: 0, // Rotation in degrees
|
|
415
|
-
offset: 10 // Distance from line
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
dimensionLayer.source.dimensions.push(dimension);
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
### Interactive Dimension Placement
|
|
422
|
-
```javascript
|
|
423
|
-
const layerView = await view.whenLayerView(dimensionLayer);
|
|
424
|
-
|
|
425
|
-
// Start interactive placement
|
|
426
|
-
const abortController = new AbortController();
|
|
427
|
-
|
|
428
|
-
async function startPlacement() {
|
|
429
|
-
try {
|
|
430
|
-
while (!abortController.signal.aborted) {
|
|
431
|
-
await layerView.place({ signal: abortController.signal });
|
|
432
|
-
}
|
|
433
|
-
} catch (error) {
|
|
434
|
-
if (!promiseUtils.isAbortError(error)) throw error;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
startPlacement();
|
|
439
|
-
|
|
440
|
-
// Stop placement
|
|
441
|
-
abortController.abort();
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
## OpenStreetMapLayer (3D Buildings)
|
|
445
|
-
|
|
446
|
-
```javascript
|
|
447
|
-
import OpenStreetMapLayer from "@arcgis/core/layers/OpenStreetMapLayer.js";
|
|
448
|
-
|
|
449
|
-
// OSM tiles in 3D SceneView
|
|
450
|
-
const osmLayer = new OpenStreetMapLayer();
|
|
451
|
-
|
|
452
|
-
const map = new Map({
|
|
453
|
-
ground: "world-elevation",
|
|
454
|
-
layers: [osmLayer]
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
const view = new SceneView({
|
|
458
|
-
map: map,
|
|
459
|
-
container: "viewDiv"
|
|
460
|
-
});
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
## Scene Environment
|
|
464
|
-
|
|
465
|
-
### Ground Configuration
|
|
466
|
-
```javascript
|
|
467
|
-
// World elevation
|
|
468
|
-
map.ground = "world-elevation";
|
|
469
|
-
|
|
470
|
-
// Custom elevation layer
|
|
471
|
-
import ElevationLayer from "@arcgis/core/layers/ElevationLayer.js";
|
|
472
|
-
|
|
473
|
-
map.ground = {
|
|
474
|
-
layers: [
|
|
475
|
-
new ElevationLayer({
|
|
476
|
-
url: "https://elevation.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
|
|
477
|
-
})
|
|
478
|
-
]
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
// Underground navigation
|
|
482
|
-
map.ground.navigationConstraint = "none"; // Allow underground
|
|
483
|
-
map.ground.opacity = 0.5; // Semi-transparent ground
|
|
484
|
-
```
|
|
485
|
-
|
|
486
|
-
### Scene Quality
|
|
487
|
-
```javascript
|
|
488
|
-
view.qualityProfile = "high"; // "low", "medium", "high"
|
|
489
|
-
|
|
490
|
-
// Custom quality settings
|
|
491
|
-
view.environment.atmosphereEnabled = true;
|
|
492
|
-
view.environment.starsEnabled = true;
|
|
493
|
-
view.environment.lighting.ambientOcclusionEnabled = true;
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
### Background
|
|
497
|
-
```javascript
|
|
498
|
-
// Solid color background
|
|
499
|
-
view.environment.background = {
|
|
500
|
-
type: "color",
|
|
501
|
-
color: [0, 0, 0, 1]
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
// Transparent background (for screenshots)
|
|
505
|
-
view.environment.background = {
|
|
506
|
-
type: "color",
|
|
507
|
-
color: [0, 0, 0, 0]
|
|
508
|
-
};
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
## Scene Performance
|
|
512
|
-
|
|
513
|
-
### Memory Management
|
|
514
|
-
```javascript
|
|
515
|
-
// Monitor memory usage
|
|
516
|
-
view.watch("memoryUsage", (memoryUsage) => {
|
|
517
|
-
console.log("Memory:", memoryUsage.total, "bytes");
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
// Reduce quality for performance
|
|
521
|
-
view.qualityProfile = "low";
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
### Level of Detail
|
|
525
|
-
```javascript
|
|
526
|
-
// For SceneLayer
|
|
527
|
-
sceneLayer.lodFactor = 1.0; // 0.5 = lower detail, 2.0 = higher detail
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
## Viewing Modes
|
|
531
|
-
|
|
532
|
-
```javascript
|
|
533
|
-
// Global mode (default) - spherical Earth
|
|
534
|
-
view.viewingMode = "global";
|
|
535
|
-
|
|
536
|
-
// Local mode - flat, for local areas
|
|
537
|
-
view.viewingMode = "local";
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
```html
|
|
541
|
-
<!-- Local mode for indoor/underground -->
|
|
542
|
-
<arcgis-scene viewing-mode="local">
|
|
543
|
-
</arcgis-scene>
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
## TypeScript Usage
|
|
547
|
-
|
|
548
|
-
3D symbols and configurations use autocasting with `type` properties. For TypeScript safety, use `as const`:
|
|
549
|
-
|
|
550
|
-
```typescript
|
|
551
|
-
// Use 'as const' for type safety
|
|
552
|
-
const graphic = new Graphic({
|
|
553
|
-
geometry: point,
|
|
554
|
-
symbol: {
|
|
555
|
-
type: "point-3d",
|
|
556
|
-
symbolLayers: [{
|
|
557
|
-
type: "object",
|
|
558
|
-
resource: { href: "https://example.com/model.glb" },
|
|
559
|
-
width: 10,
|
|
560
|
-
height: 10
|
|
561
|
-
}]
|
|
562
|
-
} as const
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
// Weather configuration
|
|
566
|
-
view.environment.weather = {
|
|
567
|
-
type: "rainy",
|
|
568
|
-
cloudCover: 0.8,
|
|
569
|
-
precipitation: 0.5
|
|
570
|
-
} as const;
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
> **Tip:** See [arcgis-core-maps skill](../arcgis-core-maps/SKILL.md) for detailed guidance on autocasting vs explicit classes.
|
|
574
|
-
|
|
575
|
-
## Common Pitfalls
|
|
576
|
-
|
|
577
|
-
1. **VoxelLayer requires local viewing mode**: Use `viewing-mode="local"` for best results
|
|
578
|
-
|
|
579
|
-
2. **PointCloud renderer fields**: Common fields are `RGB`, `CLASS_CODE`, `ELEVATION`, `INTENSITY`
|
|
580
|
-
|
|
581
|
-
3. **Weather only in SceneView**: Weather effects don't work in MapView
|
|
582
|
-
|
|
583
|
-
4. **glTF model scale**: Models may need scaling to fit the scene properly
|
|
584
|
-
|
|
585
|
-
5. **Ground navigation constraint**: Set `navigationConstraint: "none"` to allow underground viewing
|
|
586
|
-
|
|
1
|
+
---
|
|
2
|
+
name: arcgis-3d-advanced
|
|
3
|
+
description: Advanced 3D features including VoxelLayer, PointCloudLayer, weather effects, daylight simulation, glTF model imports, and custom WebGL rendering. Use for volumetric data, LiDAR visualization, and immersive 3D experiences.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ArcGIS 3D Advanced
|
|
7
|
+
|
|
8
|
+
Use this skill for advanced 3D visualization including voxel layers, point clouds, weather, daylight, glTF imports, and custom rendering.
|
|
9
|
+
|
|
10
|
+
## VoxelLayer (Volumetric 3D Data)
|
|
11
|
+
|
|
12
|
+
VoxelLayer displays 3D volumetric data like atmospheric, oceanographic, or geological data.
|
|
13
|
+
|
|
14
|
+
### Basic VoxelLayer
|
|
15
|
+
```javascript
|
|
16
|
+
import VoxelLayer from "@arcgis/core/layers/VoxelLayer.js";
|
|
17
|
+
|
|
18
|
+
const voxelLayer = new VoxelLayer({
|
|
19
|
+
url: "https://tiles.arcgis.com/tiles/.../SceneServer",
|
|
20
|
+
visible: true,
|
|
21
|
+
popupEnabled: true
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
map.add(voxelLayer);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### VoxelLayer with Map Component
|
|
28
|
+
```html
|
|
29
|
+
<arcgis-scene viewing-mode="local">
|
|
30
|
+
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
31
|
+
<arcgis-legend slot="bottom-right"></arcgis-legend>
|
|
32
|
+
</arcgis-scene>
|
|
33
|
+
|
|
34
|
+
<script type="module">
|
|
35
|
+
import VoxelLayer from "@arcgis/core/layers/VoxelLayer.js";
|
|
36
|
+
|
|
37
|
+
const vxlLayer = new VoxelLayer({
|
|
38
|
+
url: "https://tiles.arcgis.com/tiles/.../SceneServer"
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const viewElement = document.querySelector("arcgis-scene");
|
|
42
|
+
viewElement.map = new Map({
|
|
43
|
+
layers: [vxlLayer],
|
|
44
|
+
ground: { navigationConstraint: "none" }
|
|
45
|
+
});
|
|
46
|
+
</script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### VoxelLayer Configuration
|
|
50
|
+
```javascript
|
|
51
|
+
const voxelLayer = new VoxelLayer({
|
|
52
|
+
url: "...",
|
|
53
|
+
// Variable to display
|
|
54
|
+
currentVariableId: 0,
|
|
55
|
+
// Slicing
|
|
56
|
+
enableDynamicSections: true,
|
|
57
|
+
// Rendering style
|
|
58
|
+
renderStyle: "volume", // or "surfaces"
|
|
59
|
+
// Quality settings
|
|
60
|
+
qualityFactor: 1.0
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Access voxel-specific properties after load
|
|
64
|
+
await voxelLayer.load();
|
|
65
|
+
console.log("Variables:", voxelLayer.variables);
|
|
66
|
+
console.log("Dimensions:", voxelLayer.dimensions);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Voxel Slicing
|
|
70
|
+
```javascript
|
|
71
|
+
// Add dynamic section (slice)
|
|
72
|
+
voxelLayer.enableDynamicSections = true;
|
|
73
|
+
|
|
74
|
+
// Configure slice plane
|
|
75
|
+
const slicePlane = {
|
|
76
|
+
point: { x: 0, y: 0, z: -500 },
|
|
77
|
+
normal: { x: 0, y: 0, z: 1 }
|
|
78
|
+
};
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Voxel Isosurface
|
|
82
|
+
```javascript
|
|
83
|
+
// Create isosurface at specific value
|
|
84
|
+
const isosurface = {
|
|
85
|
+
value: 25,
|
|
86
|
+
enabled: true,
|
|
87
|
+
color: [255, 0, 0, 0.7]
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## PointCloudLayer (LiDAR Data)
|
|
92
|
+
|
|
93
|
+
### Basic PointCloudLayer
|
|
94
|
+
```javascript
|
|
95
|
+
import PointCloudLayer from "@arcgis/core/layers/PointCloudLayer.js";
|
|
96
|
+
|
|
97
|
+
const pcLayer = new PointCloudLayer({
|
|
98
|
+
url: "https://tiles.arcgis.com/tiles/.../SceneServer"
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
map.add(pcLayer);
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### PointCloud Renderers
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
// RGB (True Color) Renderer
|
|
108
|
+
const rgbRenderer = {
|
|
109
|
+
type: "point-cloud-rgb",
|
|
110
|
+
field: "RGB"
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Class (Classification) Renderer
|
|
114
|
+
const classRenderer = {
|
|
115
|
+
type: "point-cloud-unique-value",
|
|
116
|
+
field: "CLASS_CODE",
|
|
117
|
+
colorUniqueValueInfos: [
|
|
118
|
+
{ values: ["2"], label: "Ground", color: [139, 90, 43] },
|
|
119
|
+
{ values: ["6"], label: "Building", color: [194, 194, 194] },
|
|
120
|
+
{ values: ["5"], label: "High Vegetation", color: [34, 139, 34] }
|
|
121
|
+
]
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Elevation Renderer (Stretch)
|
|
125
|
+
const elevationRenderer = {
|
|
126
|
+
type: "point-cloud-stretch",
|
|
127
|
+
field: "ELEVATION",
|
|
128
|
+
fieldTransformType: "none",
|
|
129
|
+
colorModulation: null,
|
|
130
|
+
stops: [
|
|
131
|
+
{ value: 0, color: [0, 0, 255] },
|
|
132
|
+
{ value: 50, color: [255, 255, 0] },
|
|
133
|
+
{ value: 100, color: [255, 0, 0] }
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
pcLayer.renderer = rgbRenderer;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Smart Mapping for PointCloud
|
|
141
|
+
```javascript
|
|
142
|
+
import colorRendererCreator from "@arcgis/core/smartMapping/renderers/color.js";
|
|
143
|
+
import typeRendererCreator from "@arcgis/core/smartMapping/renderers/type.js";
|
|
144
|
+
|
|
145
|
+
// True color renderer
|
|
146
|
+
const rgbResponse = await colorRendererCreator.createPCTrueColorRenderer({
|
|
147
|
+
layer: pcLayer
|
|
148
|
+
});
|
|
149
|
+
pcLayer.renderer = rgbResponse.renderer;
|
|
150
|
+
|
|
151
|
+
// Classification renderer
|
|
152
|
+
const classResponse = await typeRendererCreator.createPCClassRenderer({
|
|
153
|
+
layer: pcLayer,
|
|
154
|
+
field: "CLASS_CODE"
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Continuous color renderer
|
|
158
|
+
const elevResponse = await colorRendererCreator.createPCContinuousRenderer({
|
|
159
|
+
layer: pcLayer,
|
|
160
|
+
field: "ELEVATION"
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### PointCloud Filters
|
|
165
|
+
```javascript
|
|
166
|
+
pcLayer.filters = [{
|
|
167
|
+
field: "CLASS_CODE",
|
|
168
|
+
operator: "includes",
|
|
169
|
+
values: [2, 6] // Ground and Building only
|
|
170
|
+
}];
|
|
171
|
+
|
|
172
|
+
// Remove filters
|
|
173
|
+
pcLayer.filters = [];
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Weather Effects
|
|
177
|
+
|
|
178
|
+
### Weather Types
|
|
179
|
+
```javascript
|
|
180
|
+
// Sunny (default)
|
|
181
|
+
view.environment.weather = {
|
|
182
|
+
type: "sunny",
|
|
183
|
+
cloudCover: 0.2
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// Cloudy
|
|
187
|
+
view.environment.weather = {
|
|
188
|
+
type: "cloudy",
|
|
189
|
+
cloudCover: 0.6
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// Rainy
|
|
193
|
+
view.environment.weather = {
|
|
194
|
+
type: "rainy",
|
|
195
|
+
cloudCover: 0.8,
|
|
196
|
+
precipitation: 0.5 // 0-1
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// Foggy
|
|
200
|
+
view.environment.weather = {
|
|
201
|
+
type: "foggy",
|
|
202
|
+
fogStrength: 0.5 // 0-1
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// Snowy
|
|
206
|
+
view.environment.weather = {
|
|
207
|
+
type: "snowy",
|
|
208
|
+
cloudCover: 0.8,
|
|
209
|
+
precipitation: 0.5,
|
|
210
|
+
snowCover: "enabled" // or "disabled"
|
|
211
|
+
};
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Weather Component
|
|
215
|
+
```html
|
|
216
|
+
<arcgis-scene item-id="...">
|
|
217
|
+
<arcgis-expand slot="top-right" expanded>
|
|
218
|
+
<arcgis-weather></arcgis-weather>
|
|
219
|
+
</arcgis-expand>
|
|
220
|
+
</arcgis-scene>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Weather Widget (Core API) - Deprecated
|
|
224
|
+
|
|
225
|
+
> **DEPRECATED since 4.33:** Use the `arcgis-weather` component shown above instead. For information on widget deprecation, see [Esri's move to web components](https://developers.arcgis.com/javascript/latest/components-transition-plan/).
|
|
226
|
+
|
|
227
|
+
```javascript
|
|
228
|
+
// DEPRECATED - Use arcgis-weather component instead
|
|
229
|
+
import Weather from "@arcgis/core/widgets/Weather.js";
|
|
230
|
+
|
|
231
|
+
const weatherWidget = new Weather({
|
|
232
|
+
view: view
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
view.ui.add(weatherWidget, "top-right");
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Daylight & Lighting
|
|
239
|
+
|
|
240
|
+
### Setting Date/Time
|
|
241
|
+
```javascript
|
|
242
|
+
// Set lighting date and time
|
|
243
|
+
view.environment.lighting = {
|
|
244
|
+
date: new Date("2024-06-21T12:00:00"),
|
|
245
|
+
directShadowsEnabled: true,
|
|
246
|
+
ambientOcclusionEnabled: true
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// Update time dynamically
|
|
250
|
+
function setTime(hours) {
|
|
251
|
+
const date = new Date(view.environment.lighting.date);
|
|
252
|
+
date.setHours(hours);
|
|
253
|
+
view.environment.lighting.date = date;
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Daylight Component
|
|
258
|
+
```html
|
|
259
|
+
<arcgis-scene item-id="...">
|
|
260
|
+
<arcgis-expand slot="top-right" expanded>
|
|
261
|
+
<arcgis-daylight hide-timezone play-speed-multiplier="2"></arcgis-daylight>
|
|
262
|
+
</arcgis-expand>
|
|
263
|
+
</arcgis-scene>
|
|
264
|
+
|
|
265
|
+
<script type="module">
|
|
266
|
+
const daylight = document.querySelector("arcgis-daylight");
|
|
267
|
+
|
|
268
|
+
// Toggle sun position vs virtual lighting
|
|
269
|
+
daylight.sunlightingDisabled = false; // Use sun position
|
|
270
|
+
daylight.sunlightingDisabled = true; // Use virtual light
|
|
271
|
+
</script>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Daylight Widget (Core API)
|
|
275
|
+
```javascript
|
|
276
|
+
import Daylight from "@arcgis/core/widgets/Daylight.js";
|
|
277
|
+
|
|
278
|
+
const daylightWidget = new Daylight({
|
|
279
|
+
view: view,
|
|
280
|
+
playSpeedMultiplier: 2 // Animation speed
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
view.ui.add(daylightWidget, "top-right");
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Shadow Analysis
|
|
287
|
+
```javascript
|
|
288
|
+
// Enable shadows
|
|
289
|
+
view.environment.lighting.directShadowsEnabled = true;
|
|
290
|
+
|
|
291
|
+
// Shadow cast analysis
|
|
292
|
+
import ShadowCastAnalysis from "@arcgis/core/analysis/ShadowCastAnalysis.js";
|
|
293
|
+
|
|
294
|
+
const shadowAnalysis = new ShadowCastAnalysis();
|
|
295
|
+
view.analyses.add(shadowAnalysis);
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Importing 3D Models (glTF)
|
|
299
|
+
|
|
300
|
+
### glTF Symbol
|
|
301
|
+
```javascript
|
|
302
|
+
const graphic = new Graphic({
|
|
303
|
+
geometry: {
|
|
304
|
+
type: "point",
|
|
305
|
+
longitude: -122.4,
|
|
306
|
+
latitude: 37.8,
|
|
307
|
+
z: 0
|
|
308
|
+
},
|
|
309
|
+
symbol: {
|
|
310
|
+
type: "point-3d",
|
|
311
|
+
symbolLayers: [{
|
|
312
|
+
type: "object",
|
|
313
|
+
resource: {
|
|
314
|
+
href: "https://example.com/model.glb"
|
|
315
|
+
},
|
|
316
|
+
// Optional: scale and rotate
|
|
317
|
+
width: 10,
|
|
318
|
+
height: 10,
|
|
319
|
+
depth: 10,
|
|
320
|
+
heading: 45,
|
|
321
|
+
tilt: 0,
|
|
322
|
+
roll: 0
|
|
323
|
+
}]
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
graphicsLayer.add(graphic);
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Interactive Model Placement
|
|
331
|
+
```javascript
|
|
332
|
+
import SketchViewModel from "@arcgis/core/widgets/Sketch/SketchViewModel.js";
|
|
333
|
+
|
|
334
|
+
const graphicsLayer = new GraphicsLayer({
|
|
335
|
+
elevationInfo: { mode: "on-the-ground" }
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const sketchVM = new SketchViewModel({
|
|
339
|
+
layer: graphicsLayer,
|
|
340
|
+
view: view,
|
|
341
|
+
pointSymbol: {
|
|
342
|
+
type: "point-3d",
|
|
343
|
+
symbolLayers: [{
|
|
344
|
+
type: "object",
|
|
345
|
+
resource: {
|
|
346
|
+
href: "https://example.com/model.glb"
|
|
347
|
+
}
|
|
348
|
+
}]
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
// Start placing model
|
|
353
|
+
sketchVM.create("point");
|
|
354
|
+
|
|
355
|
+
sketchVM.on("create", (event) => {
|
|
356
|
+
if (event.state === "complete") {
|
|
357
|
+
// Model placed, allow editing
|
|
358
|
+
sketchVM.update(event.graphic);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## IntegratedMeshLayer
|
|
364
|
+
|
|
365
|
+
```javascript
|
|
366
|
+
import IntegratedMeshLayer from "@arcgis/core/layers/IntegratedMeshLayer.js";
|
|
367
|
+
|
|
368
|
+
const meshLayer = new IntegratedMeshLayer({
|
|
369
|
+
url: "https://tiles.arcgis.com/tiles/.../IntegratedMeshServer"
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
map.add(meshLayer);
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## DimensionLayer (Length Dimensioning)
|
|
376
|
+
|
|
377
|
+
### Basic DimensionLayer
|
|
378
|
+
```javascript
|
|
379
|
+
import DimensionLayer from "@arcgis/core/layers/DimensionLayer.js";
|
|
380
|
+
import DimensionAnalysis from "@arcgis/core/analysis/DimensionAnalysis.js";
|
|
381
|
+
import LengthDimension from "@arcgis/core/analysis/LengthDimension.js";
|
|
382
|
+
|
|
383
|
+
// Create dimension analysis with style
|
|
384
|
+
const dimensionAnalysis = new DimensionAnalysis({
|
|
385
|
+
style: {
|
|
386
|
+
type: "simple",
|
|
387
|
+
textBackgroundColor: [0, 0, 0, 0.6],
|
|
388
|
+
textColor: "white",
|
|
389
|
+
fontSize: 12
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
// Create dimension layer
|
|
394
|
+
const dimensionLayer = new DimensionLayer({
|
|
395
|
+
title: "Dimensions",
|
|
396
|
+
source: dimensionAnalysis
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
map.add(dimensionLayer);
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Add Length Dimensions
|
|
403
|
+
```javascript
|
|
404
|
+
// Add a dimension between two points
|
|
405
|
+
const dimension = new LengthDimension({
|
|
406
|
+
startPoint: {
|
|
407
|
+
x: -122.4, y: 37.8, z: 0,
|
|
408
|
+
spatialReference: { wkid: 4326 }
|
|
409
|
+
},
|
|
410
|
+
endPoint: {
|
|
411
|
+
x: -122.5, y: 37.8, z: 0,
|
|
412
|
+
spatialReference: { wkid: 4326 }
|
|
413
|
+
},
|
|
414
|
+
orientation: 0, // Rotation in degrees
|
|
415
|
+
offset: 10 // Distance from line
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
dimensionLayer.source.dimensions.push(dimension);
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Interactive Dimension Placement
|
|
422
|
+
```javascript
|
|
423
|
+
const layerView = await view.whenLayerView(dimensionLayer);
|
|
424
|
+
|
|
425
|
+
// Start interactive placement
|
|
426
|
+
const abortController = new AbortController();
|
|
427
|
+
|
|
428
|
+
async function startPlacement() {
|
|
429
|
+
try {
|
|
430
|
+
while (!abortController.signal.aborted) {
|
|
431
|
+
await layerView.place({ signal: abortController.signal });
|
|
432
|
+
}
|
|
433
|
+
} catch (error) {
|
|
434
|
+
if (!promiseUtils.isAbortError(error)) throw error;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
startPlacement();
|
|
439
|
+
|
|
440
|
+
// Stop placement
|
|
441
|
+
abortController.abort();
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
## OpenStreetMapLayer (3D Buildings)
|
|
445
|
+
|
|
446
|
+
```javascript
|
|
447
|
+
import OpenStreetMapLayer from "@arcgis/core/layers/OpenStreetMapLayer.js";
|
|
448
|
+
|
|
449
|
+
// OSM tiles in 3D SceneView
|
|
450
|
+
const osmLayer = new OpenStreetMapLayer();
|
|
451
|
+
|
|
452
|
+
const map = new Map({
|
|
453
|
+
ground: "world-elevation",
|
|
454
|
+
layers: [osmLayer]
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
const view = new SceneView({
|
|
458
|
+
map: map,
|
|
459
|
+
container: "viewDiv"
|
|
460
|
+
});
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
## Scene Environment
|
|
464
|
+
|
|
465
|
+
### Ground Configuration
|
|
466
|
+
```javascript
|
|
467
|
+
// World elevation
|
|
468
|
+
map.ground = "world-elevation";
|
|
469
|
+
|
|
470
|
+
// Custom elevation layer
|
|
471
|
+
import ElevationLayer from "@arcgis/core/layers/ElevationLayer.js";
|
|
472
|
+
|
|
473
|
+
map.ground = {
|
|
474
|
+
layers: [
|
|
475
|
+
new ElevationLayer({
|
|
476
|
+
url: "https://elevation.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
|
|
477
|
+
})
|
|
478
|
+
]
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
// Underground navigation
|
|
482
|
+
map.ground.navigationConstraint = "none"; // Allow underground
|
|
483
|
+
map.ground.opacity = 0.5; // Semi-transparent ground
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### Scene Quality
|
|
487
|
+
```javascript
|
|
488
|
+
view.qualityProfile = "high"; // "low", "medium", "high"
|
|
489
|
+
|
|
490
|
+
// Custom quality settings
|
|
491
|
+
view.environment.atmosphereEnabled = true;
|
|
492
|
+
view.environment.starsEnabled = true;
|
|
493
|
+
view.environment.lighting.ambientOcclusionEnabled = true;
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### Background
|
|
497
|
+
```javascript
|
|
498
|
+
// Solid color background
|
|
499
|
+
view.environment.background = {
|
|
500
|
+
type: "color",
|
|
501
|
+
color: [0, 0, 0, 1]
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
// Transparent background (for screenshots)
|
|
505
|
+
view.environment.background = {
|
|
506
|
+
type: "color",
|
|
507
|
+
color: [0, 0, 0, 0]
|
|
508
|
+
};
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
## Scene Performance
|
|
512
|
+
|
|
513
|
+
### Memory Management
|
|
514
|
+
```javascript
|
|
515
|
+
// Monitor memory usage
|
|
516
|
+
view.watch("memoryUsage", (memoryUsage) => {
|
|
517
|
+
console.log("Memory:", memoryUsage.total, "bytes");
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
// Reduce quality for performance
|
|
521
|
+
view.qualityProfile = "low";
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Level of Detail
|
|
525
|
+
```javascript
|
|
526
|
+
// For SceneLayer
|
|
527
|
+
sceneLayer.lodFactor = 1.0; // 0.5 = lower detail, 2.0 = higher detail
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
## Viewing Modes
|
|
531
|
+
|
|
532
|
+
```javascript
|
|
533
|
+
// Global mode (default) - spherical Earth
|
|
534
|
+
view.viewingMode = "global";
|
|
535
|
+
|
|
536
|
+
// Local mode - flat, for local areas
|
|
537
|
+
view.viewingMode = "local";
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
```html
|
|
541
|
+
<!-- Local mode for indoor/underground -->
|
|
542
|
+
<arcgis-scene viewing-mode="local">
|
|
543
|
+
</arcgis-scene>
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
## TypeScript Usage
|
|
547
|
+
|
|
548
|
+
3D symbols and configurations use autocasting with `type` properties. For TypeScript safety, use `as const`:
|
|
549
|
+
|
|
550
|
+
```typescript
|
|
551
|
+
// Use 'as const' for type safety
|
|
552
|
+
const graphic = new Graphic({
|
|
553
|
+
geometry: point,
|
|
554
|
+
symbol: {
|
|
555
|
+
type: "point-3d",
|
|
556
|
+
symbolLayers: [{
|
|
557
|
+
type: "object",
|
|
558
|
+
resource: { href: "https://example.com/model.glb" },
|
|
559
|
+
width: 10,
|
|
560
|
+
height: 10
|
|
561
|
+
}]
|
|
562
|
+
} as const
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
// Weather configuration
|
|
566
|
+
view.environment.weather = {
|
|
567
|
+
type: "rainy",
|
|
568
|
+
cloudCover: 0.8,
|
|
569
|
+
precipitation: 0.5
|
|
570
|
+
} as const;
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
> **Tip:** See [arcgis-core-maps skill](../arcgis-core-maps/SKILL.md) for detailed guidance on autocasting vs explicit classes.
|
|
574
|
+
|
|
575
|
+
## Common Pitfalls
|
|
576
|
+
|
|
577
|
+
1. **VoxelLayer requires local viewing mode**: Use `viewing-mode="local"` for best results
|
|
578
|
+
|
|
579
|
+
2. **PointCloud renderer fields**: Common fields are `RGB`, `CLASS_CODE`, `ELEVATION`, `INTENSITY`
|
|
580
|
+
|
|
581
|
+
3. **Weather only in SceneView**: Weather effects don't work in MapView
|
|
582
|
+
|
|
583
|
+
4. **glTF model scale**: Models may need scaling to fit the scene properly
|
|
584
|
+
|
|
585
|
+
5. **Ground navigation constraint**: Set `navigationConstraint: "none"` to allow underground viewing
|
|
586
|
+
|