@saschabrunnerch/arcgis-maps-sdk-js-ai-context 0.1.0 → 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/README.md +28 -24
- package/contexts/4.34/skills/{arcgis-3d-advanced → arcgis-3d-layers}/SKILL.md +41 -145
- package/contexts/4.34/skills/arcgis-advanced-layers/SKILL.md +285 -2
- package/contexts/4.34/skills/arcgis-arcade/SKILL.md +8 -3
- package/contexts/4.34/skills/arcgis-authentication/SKILL.md +7 -6
- package/contexts/4.34/skills/arcgis-cim-symbols/SKILL.md +35 -13
- package/contexts/4.34/skills/arcgis-coordinates-projection/SKILL.md +13 -76
- package/contexts/4.34/skills/arcgis-core-maps/SKILL.md +47 -26
- package/contexts/4.34/skills/arcgis-core-utilities/SKILL.md +116 -66
- package/contexts/4.34/skills/arcgis-custom-rendering/SKILL.md +171 -16
- package/contexts/4.34/skills/{arcgis-editing-advanced → arcgis-editing}/SKILL.md +99 -137
- package/contexts/4.34/skills/arcgis-feature-effects/SKILL.md +10 -2
- package/contexts/4.34/skills/arcgis-geometry-operations/SKILL.md +124 -118
- package/contexts/4.34/skills/arcgis-imagery/SKILL.md +19 -4
- package/contexts/4.34/skills/arcgis-interaction/SKILL.md +11 -149
- package/contexts/4.34/skills/arcgis-knowledge-graphs/SKILL.md +32 -137
- package/contexts/4.34/skills/arcgis-layers/SKILL.md +26 -38
- package/contexts/4.34/skills/arcgis-map-tools/SKILL.md +22 -37
- package/contexts/4.34/skills/arcgis-popup-templates/SKILL.md +8 -0
- package/contexts/4.34/skills/arcgis-portal-content/SKILL.md +16 -6
- package/contexts/4.34/skills/arcgis-rest-services/SKILL.md +684 -0
- package/contexts/4.34/skills/{arcgis-scene-effects → arcgis-scene-environment}/SKILL.md +10 -2
- package/contexts/4.34/skills/arcgis-smart-mapping/SKILL.md +23 -16
- package/contexts/4.34/skills/{arcgis-analysis-services → arcgis-spatial-analysis}/SKILL.md +19 -124
- package/contexts/4.34/skills/arcgis-starter-app/SKILL.md +743 -23
- package/contexts/4.34/skills/arcgis-tables-forms/SKILL.md +35 -71
- package/contexts/4.34/skills/arcgis-time-animation/SKILL.md +9 -8
- package/contexts/4.34/skills/arcgis-utility-networks/SKILL.md +20 -9
- package/contexts/4.34/skills/arcgis-visualization/SKILL.md +11 -61
- package/contexts/4.34/skills/arcgis-widgets-advanced/SKILL.md +777 -0
- package/contexts/4.34/skills/arcgis-widgets-ui/SKILL.md +47 -14
- package/package.json +1 -1
- package/contexts/4.34/skills/arcgis-media-layers/SKILL.md +0 -290
- package/contexts/4.34/skills/arcgis-starter-app-extended/SKILL.md +0 -649
package/README.md
CHANGED
|
@@ -40,11 +40,13 @@ This creates the following structure (all skills are prefixed with `arcgis-` to
|
|
|
40
40
|
your-project/
|
|
41
41
|
└── .github/
|
|
42
42
|
└── skills/
|
|
43
|
+
├── arcgis-starter-app/
|
|
44
|
+
│ └── SKILL.md
|
|
43
45
|
├── arcgis-core-maps/
|
|
44
46
|
│ └── SKILL.md
|
|
45
47
|
├── arcgis-layers/
|
|
46
48
|
│ └── SKILL.md
|
|
47
|
-
├── arcgis-
|
|
49
|
+
├── arcgis-widgets-ui/
|
|
48
50
|
│ └── SKILL.md
|
|
49
51
|
└── ... (30 skill directories total)
|
|
50
52
|
```
|
|
@@ -83,45 +85,47 @@ The package includes 30 comprehensive Agent Skills covering:
|
|
|
83
85
|
|
|
84
86
|
| Skill | Description |
|
|
85
87
|
|-------|-------------|
|
|
86
|
-
| arcgis-starter-app | Scaffold
|
|
87
|
-
| arcgis-
|
|
88
|
-
| arcgis-core-maps | 2D and 3D map creation, views, navigation |
|
|
88
|
+
| arcgis-starter-app | Scaffold TypeScript/Vite apps (minimal and production-ready setups) |
|
|
89
|
+
| arcgis-core-maps | 2D and 3D map creation, views, navigation, arcgis-video |
|
|
89
90
|
| arcgis-layers | FeatureLayer, TileLayer, GeoJSONLayer, and more |
|
|
90
|
-
| arcgis-
|
|
91
|
+
| arcgis-advanced-layers | WMS, WFS, WMTS, OGC, MapImageLayer, CatalogLayer, MediaLayer |
|
|
92
|
+
| arcgis-visualization | Renderers, symbols, labels, and visual variables |
|
|
93
|
+
| arcgis-smart-mapping | Smart mapping and data-driven visualization |
|
|
91
94
|
| arcgis-popup-templates | Popup configuration and content |
|
|
92
95
|
| arcgis-widgets-ui | Built-in widgets and UI components |
|
|
93
|
-
| arcgis-
|
|
96
|
+
| arcgis-widgets-advanced | BuildingExplorer, FloorFilter, Track, Locate, ScaleBar, and more |
|
|
97
|
+
| arcgis-geometry-operations | Geometry operators and spatial operations |
|
|
94
98
|
| arcgis-coordinates-projection | Coordinate systems and projections |
|
|
95
|
-
| arcgis-
|
|
96
|
-
| arcgis-
|
|
97
|
-
| arcgis-
|
|
98
|
-
| arcgis-
|
|
99
|
-
| arcgis-
|
|
100
|
-
| arcgis-3d-advanced | 3D visualization and SceneView |
|
|
101
|
-
| arcgis-scene-effects | 3D effects, lighting, and atmosphere |
|
|
99
|
+
| arcgis-spatial-analysis | Spatial analysis, feature reduction, and analysis objects |
|
|
100
|
+
| arcgis-rest-services | REST service wrappers for routing, geocoding, printing, places |
|
|
101
|
+
| arcgis-3d-layers | VoxelLayer, PointCloudLayer, glTF imports, 3D analysis components |
|
|
102
|
+
| arcgis-scene-environment | SceneView environment, shadows, lighting, atmosphere |
|
|
103
|
+
| arcgis-feature-effects | Feature effects, filters, and blend modes |
|
|
102
104
|
| arcgis-cim-symbols | CIM symbol specification |
|
|
103
105
|
| arcgis-arcade | Arcade expressions |
|
|
104
106
|
| arcgis-time-animation | Time-aware layers and animation |
|
|
105
|
-
| arcgis-
|
|
106
|
-
| arcgis-
|
|
107
|
-
| arcgis-
|
|
108
|
-
| arcgis-map-tools | Measurement, print, and utility tools |
|
|
107
|
+
| arcgis-editing | Editor widget, forms, subtypes, versioning |
|
|
108
|
+
| arcgis-interaction | Hit testing, highlighting, sketching, and events |
|
|
109
|
+
| arcgis-map-tools | Measurement, print, directions, and utility tools |
|
|
109
110
|
| arcgis-tables-forms | Attribute tables and feature forms |
|
|
110
|
-
| arcgis-
|
|
111
|
-
| arcgis-advanced-layers | Specialized layer types |
|
|
111
|
+
| arcgis-custom-rendering | Custom WebGL rendering and LayerView architecture |
|
|
112
112
|
| arcgis-imagery | Imagery and raster analysis |
|
|
113
|
-
| arcgis-
|
|
113
|
+
| arcgis-authentication | OAuth, API keys, and identity management |
|
|
114
|
+
| arcgis-portal-content | Portal items, groups, and content management |
|
|
115
|
+
| arcgis-knowledge-graphs | Knowledge graph integration and link charts |
|
|
114
116
|
| arcgis-utility-networks | Utility network analysis |
|
|
115
|
-
| arcgis-core-utilities |
|
|
117
|
+
| arcgis-core-utilities | Accessor, Collection, reactiveUtils, intl, and workers |
|
|
116
118
|
|
|
117
119
|
## Usage
|
|
118
120
|
|
|
119
121
|
After installing skills, your AI agent will automatically have access to ArcGIS-specific knowledge when working in your project. The skills provide:
|
|
120
122
|
|
|
121
|
-
- Correct import patterns for ESM and
|
|
123
|
+
- Correct import patterns for ESM and Map Components
|
|
122
124
|
- Best practices for TypeScript with autocasting
|
|
123
125
|
- Code examples for common tasks
|
|
124
|
-
-
|
|
126
|
+
- Reference samples linking to official SDK sample code
|
|
127
|
+
- Common pitfalls and how to avoid them
|
|
128
|
+
- Cross-references between related skills
|
|
125
129
|
|
|
126
130
|
### Supported AI Agents
|
|
127
131
|
|
|
@@ -140,7 +144,7 @@ After installing skills, your AI agent will automatically have access to ArcGIS-
|
|
|
140
144
|
The skills in this package are based on the official ArcGIS Maps SDK for JavaScript documentation:
|
|
141
145
|
|
|
142
146
|
- **Documentation:** https://developers.arcgis.com/javascript/latest/downloads/
|
|
143
|
-
- **Folders used:** `api-reference` and `sample-code`
|
|
147
|
+
- **Folders used:** `api-reference` and `sample-code` and `map-components`
|
|
144
148
|
|
|
145
149
|
## AI Assistance Declaration
|
|
146
150
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: arcgis-3d-
|
|
3
|
-
description:
|
|
2
|
+
name: arcgis-3d-layers
|
|
3
|
+
description: 3D layer types including VoxelLayer, PointCloudLayer, IntegratedMeshLayer, glTF model imports, and 3D analysis components. Use for volumetric data, LiDAR visualization, and immersive 3D experiences.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# ArcGIS 3D
|
|
6
|
+
# ArcGIS 3D Layers
|
|
7
7
|
|
|
8
|
-
Use this skill for
|
|
8
|
+
Use this skill for 3D layer types including voxel layers, point clouds, glTF imports, and 3D analysis components.
|
|
9
9
|
|
|
10
10
|
## VoxelLayer (Volumetric 3D Data)
|
|
11
11
|
|
|
@@ -41,7 +41,7 @@ map.add(voxelLayer);
|
|
|
41
41
|
const viewElement = document.querySelector("arcgis-scene");
|
|
42
42
|
viewElement.map = new Map({
|
|
43
43
|
layers: [vxlLayer],
|
|
44
|
-
ground: { navigationConstraint: "none" }
|
|
44
|
+
ground: { navigationConstraint: { type: "none" } }
|
|
45
45
|
});
|
|
46
46
|
</script>
|
|
47
47
|
```
|
|
@@ -54,16 +54,14 @@ const voxelLayer = new VoxelLayer({
|
|
|
54
54
|
currentVariableId: 0,
|
|
55
55
|
// Slicing
|
|
56
56
|
enableDynamicSections: true,
|
|
57
|
-
// Rendering
|
|
58
|
-
|
|
59
|
-
// Quality settings
|
|
60
|
-
qualityFactor: 1.0
|
|
57
|
+
// Rendering mode
|
|
58
|
+
renderMode: "volume" // or "surfaces"
|
|
61
59
|
});
|
|
62
60
|
|
|
63
61
|
// Access voxel-specific properties after load
|
|
64
62
|
await voxelLayer.load();
|
|
65
63
|
console.log("Variables:", voxelLayer.variables);
|
|
66
|
-
console.log("
|
|
64
|
+
console.log("Volumes:", voxelLayer.volumes);
|
|
67
65
|
```
|
|
68
66
|
|
|
69
67
|
### Voxel Slicing
|
|
@@ -165,7 +163,7 @@ const elevResponse = await colorRendererCreator.createPCContinuousRenderer({
|
|
|
165
163
|
```javascript
|
|
166
164
|
pcLayer.filters = [{
|
|
167
165
|
field: "CLASS_CODE",
|
|
168
|
-
|
|
166
|
+
mode: "include",
|
|
169
167
|
values: [2, 6] // Ground and Building only
|
|
170
168
|
}];
|
|
171
169
|
|
|
@@ -173,127 +171,7 @@ pcLayer.filters = [{
|
|
|
173
171
|
pcLayer.filters = [];
|
|
174
172
|
```
|
|
175
173
|
|
|
176
|
-
|
|
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
|
-
```
|
|
174
|
+
> For scene environment settings (atmosphere, lighting, weather, shadows), see [arcgis-scene-environment](../arcgis-scene-environment/SKILL.md).
|
|
297
175
|
|
|
298
176
|
## Importing 3D Models (glTF)
|
|
299
177
|
|
|
@@ -479,7 +357,7 @@ map.ground = {
|
|
|
479
357
|
};
|
|
480
358
|
|
|
481
359
|
// Underground navigation
|
|
482
|
-
map.ground.navigationConstraint = "none"; // Allow underground
|
|
360
|
+
map.ground.navigationConstraint = { type: "none" }; // Allow underground
|
|
483
361
|
map.ground.opacity = 0.5; // Semi-transparent ground
|
|
484
362
|
```
|
|
485
363
|
|
|
@@ -510,23 +388,22 @@ view.environment.background = {
|
|
|
510
388
|
|
|
511
389
|
## Scene Performance
|
|
512
390
|
|
|
513
|
-
###
|
|
391
|
+
### Performance Monitoring
|
|
514
392
|
```javascript
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
393
|
+
import * as reactiveUtils from "@arcgis/core/core/reactiveUtils.js";
|
|
394
|
+
|
|
395
|
+
// Monitor performance
|
|
396
|
+
reactiveUtils.watch(
|
|
397
|
+
() => view.performanceInfo,
|
|
398
|
+
(info) => {
|
|
399
|
+
console.log("Quality:", info.quality);
|
|
400
|
+
}
|
|
401
|
+
);
|
|
519
402
|
|
|
520
403
|
// Reduce quality for performance
|
|
521
404
|
view.qualityProfile = "low";
|
|
522
405
|
```
|
|
523
406
|
|
|
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
407
|
## Viewing Modes
|
|
531
408
|
|
|
532
409
|
```javascript
|
|
@@ -572,6 +449,25 @@ view.environment.weather = {
|
|
|
572
449
|
|
|
573
450
|
> **Tip:** See [arcgis-core-maps skill](../arcgis-core-maps/SKILL.md) for detailed guidance on autocasting vs explicit classes.
|
|
574
451
|
|
|
452
|
+
### 3D Analysis Components
|
|
453
|
+
|
|
454
|
+
| Component | Purpose |
|
|
455
|
+
|-----------|---------|
|
|
456
|
+
| `arcgis-building-explorer` | Explore building scene layers by discipline and floor |
|
|
457
|
+
| `arcgis-elevation-profile` | Generate elevation profiles along a path |
|
|
458
|
+
| `arcgis-line-of-sight` | Analyze line-of-sight visibility |
|
|
459
|
+
| `arcgis-shadow-cast` | Simulate shadow casting at different times |
|
|
460
|
+
| `arcgis-slice` | Slice through 3D content to reveal interior |
|
|
461
|
+
| `arcgis-directional-pad` | Navigate 3D scenes with directional controls |
|
|
462
|
+
|
|
463
|
+
## Reference Samples
|
|
464
|
+
|
|
465
|
+
- `layers-voxel` - Working with VoxelLayer in 3D
|
|
466
|
+
- `weather` - Weather effects in SceneView
|
|
467
|
+
- `daylight` - Daylight widget for sun position
|
|
468
|
+
- `import-gltf` - Importing glTF 3D models
|
|
469
|
+
- `layers-dimension` - DimensionLayer for 3D measurements
|
|
470
|
+
|
|
575
471
|
## Common Pitfalls
|
|
576
472
|
|
|
577
473
|
1. **VoxelLayer requires local viewing mode**: Use `viewing-mode="local"` for best results
|
|
@@ -582,5 +478,5 @@ view.environment.weather = {
|
|
|
582
478
|
|
|
583
479
|
4. **glTF model scale**: Models may need scaling to fit the scene properly
|
|
584
480
|
|
|
585
|
-
5. **Ground navigation constraint**: Set `navigationConstraint: "none"` to allow underground viewing
|
|
481
|
+
5. **Ground navigation constraint**: Set `navigationConstraint: { type: "none" }` to allow underground viewing
|
|
586
482
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: arcgis-advanced-layers
|
|
3
|
-
description: Work with advanced layer types including WMS, WFS, WMTS, OGCFeatureLayer, MapImageLayer, CatalogLayer, and dynamic data layers. Use for OGC services
|
|
3
|
+
description: Work with advanced layer types including WMS, WFS, WMTS, OGCFeatureLayer, MapImageLayer, CatalogLayer, MediaLayer, and dynamic data layers. Use for OGC services, server-side rendering, and georeferenced media content.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# ArcGIS Advanced Layers
|
|
7
7
|
|
|
8
|
-
Use this skill for working with OGC services, MapImageLayer, CatalogLayer, and dynamic data layers.
|
|
8
|
+
Use this skill for working with OGC services, MapImageLayer, CatalogLayer, MediaLayer, and dynamic data layers.
|
|
9
9
|
|
|
10
10
|
## WMSLayer (Web Map Service)
|
|
11
11
|
|
|
@@ -404,6 +404,272 @@ layerList.listItemCreatedFunction = (event) => {
|
|
|
404
404
|
};
|
|
405
405
|
```
|
|
406
406
|
|
|
407
|
+
## MediaLayer
|
|
408
|
+
|
|
409
|
+
### MediaLayer Basics
|
|
410
|
+
|
|
411
|
+
#### Create MediaLayer with Images
|
|
412
|
+
```javascript
|
|
413
|
+
import MediaLayer from "@arcgis/core/layers/MediaLayer.js";
|
|
414
|
+
import ImageElement from "@arcgis/core/layers/support/ImageElement.js";
|
|
415
|
+
import ExtentAndRotationGeoreference from "@arcgis/core/layers/support/ExtentAndRotationGeoreference.js";
|
|
416
|
+
import Extent from "@arcgis/core/geometry/Extent.js";
|
|
417
|
+
|
|
418
|
+
const imageElement = new ImageElement({
|
|
419
|
+
image: "https://example.com/historical-map.png",
|
|
420
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
421
|
+
extent: new Extent({
|
|
422
|
+
xmin: -10047456,
|
|
423
|
+
ymin: 3486722,
|
|
424
|
+
xmax: -10006982,
|
|
425
|
+
ymax: 3514468,
|
|
426
|
+
spatialReference: { wkid: 102100 }
|
|
427
|
+
})
|
|
428
|
+
})
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
const mediaLayer = new MediaLayer({
|
|
432
|
+
source: [imageElement],
|
|
433
|
+
title: "Historical Map"
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
map.add(mediaLayer);
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
#### Multiple Images
|
|
440
|
+
```javascript
|
|
441
|
+
const imageInfos = [
|
|
442
|
+
{
|
|
443
|
+
url: "image1.png",
|
|
444
|
+
extent: { xmin: -100, ymin: 30, xmax: -90, ymax: 40 }
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
url: "image2.png",
|
|
448
|
+
extent: { xmin: -95, ymin: 35, xmax: -85, ymax: 45 }
|
|
449
|
+
}
|
|
450
|
+
];
|
|
451
|
+
|
|
452
|
+
const imageElements = imageInfos.map(info => new ImageElement({
|
|
453
|
+
image: info.url,
|
|
454
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
455
|
+
extent: new Extent({
|
|
456
|
+
...info.extent,
|
|
457
|
+
spatialReference: { wkid: 4326 }
|
|
458
|
+
})
|
|
459
|
+
})
|
|
460
|
+
}));
|
|
461
|
+
|
|
462
|
+
const mediaLayer = new MediaLayer({
|
|
463
|
+
source: imageElements
|
|
464
|
+
});
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Georeferencing Methods
|
|
468
|
+
|
|
469
|
+
#### Extent and Rotation
|
|
470
|
+
```javascript
|
|
471
|
+
const georeference = new ExtentAndRotationGeoreference({
|
|
472
|
+
extent: new Extent({
|
|
473
|
+
xmin: -122.5,
|
|
474
|
+
ymin: 37.5,
|
|
475
|
+
xmax: -122.0,
|
|
476
|
+
ymax: 38.0,
|
|
477
|
+
spatialReference: { wkid: 4326 }
|
|
478
|
+
}),
|
|
479
|
+
rotation: 15 // Degrees clockwise
|
|
480
|
+
});
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
#### Control Points (Corners)
|
|
484
|
+
```javascript
|
|
485
|
+
import ControlPointsGeoreference from "@arcgis/core/layers/support/ControlPointsGeoreference.js";
|
|
486
|
+
|
|
487
|
+
const georeference = new ControlPointsGeoreference({
|
|
488
|
+
controlPoints: [
|
|
489
|
+
{
|
|
490
|
+
sourcePoint: { x: 0, y: 0 }, // Top-left of image (pixels)
|
|
491
|
+
mapPoint: { x: -122.5, y: 38.0 } // Map coordinates
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
sourcePoint: { x: 1000, y: 0 }, // Top-right
|
|
495
|
+
mapPoint: { x: -122.0, y: 38.0 }
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
sourcePoint: { x: 1000, y: 800 }, // Bottom-right
|
|
499
|
+
mapPoint: { x: -122.0, y: 37.5 }
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
sourcePoint: { x: 0, y: 800 }, // Bottom-left
|
|
503
|
+
mapPoint: { x: -122.5, y: 37.5 }
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
width: 1000, // Image width in pixels
|
|
507
|
+
height: 800 // Image height in pixels
|
|
508
|
+
});
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### Video Elements
|
|
512
|
+
|
|
513
|
+
```javascript
|
|
514
|
+
import VideoElement from "@arcgis/core/layers/support/VideoElement.js";
|
|
515
|
+
|
|
516
|
+
const videoElement = new VideoElement({
|
|
517
|
+
video: "https://example.com/timelapse.mp4",
|
|
518
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
519
|
+
extent: new Extent({
|
|
520
|
+
xmin: -122.5,
|
|
521
|
+
ymin: 37.5,
|
|
522
|
+
xmax: -122.0,
|
|
523
|
+
ymax: 38.0,
|
|
524
|
+
spatialReference: { wkid: 4326 }
|
|
525
|
+
})
|
|
526
|
+
})
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
const mediaLayer = new MediaLayer({
|
|
530
|
+
source: [videoElement]
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
// Control video playback
|
|
534
|
+
videoElement.content.play();
|
|
535
|
+
videoElement.content.pause();
|
|
536
|
+
videoElement.content.currentTime = 30; // Seek to 30 seconds
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
### Animated GIF
|
|
540
|
+
|
|
541
|
+
```javascript
|
|
542
|
+
// Animated GIFs work like regular images
|
|
543
|
+
const gifElement = new ImageElement({
|
|
544
|
+
image: "https://example.com/weather-animation.gif",
|
|
545
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
546
|
+
extent: new Extent({
|
|
547
|
+
xmin: -130,
|
|
548
|
+
ymin: 25,
|
|
549
|
+
xmax: -65,
|
|
550
|
+
ymax: 50,
|
|
551
|
+
spatialReference: { wkid: 4326 }
|
|
552
|
+
})
|
|
553
|
+
})
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
const mediaLayer = new MediaLayer({
|
|
557
|
+
source: [gifElement]
|
|
558
|
+
});
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
### Layer Configuration
|
|
562
|
+
|
|
563
|
+
#### Opacity and Blend Mode
|
|
564
|
+
```javascript
|
|
565
|
+
const mediaLayer = new MediaLayer({
|
|
566
|
+
source: [imageElement],
|
|
567
|
+
opacity: 0.7,
|
|
568
|
+
blendMode: "multiply" // normal, multiply, luminosity, etc.
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// Change opacity dynamically
|
|
572
|
+
mediaLayer.opacity = 0.5;
|
|
573
|
+
|
|
574
|
+
// Change blend mode
|
|
575
|
+
mediaLayer.blendMode = "luminosity";
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
#### Element Opacity
|
|
579
|
+
```javascript
|
|
580
|
+
// Individual element opacity
|
|
581
|
+
imageElement.opacity = 0.8;
|
|
582
|
+
|
|
583
|
+
// Update dynamically
|
|
584
|
+
document.getElementById("opacitySlider").addEventListener("input", (e) => {
|
|
585
|
+
imageElement.opacity = e.target.value / 100;
|
|
586
|
+
});
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
### Managing Source Elements
|
|
590
|
+
|
|
591
|
+
```javascript
|
|
592
|
+
// Access source
|
|
593
|
+
const source = mediaLayer.source;
|
|
594
|
+
|
|
595
|
+
// Add elements
|
|
596
|
+
source.elements.push(newImageElement);
|
|
597
|
+
source.elements.push(element1, element2);
|
|
598
|
+
|
|
599
|
+
// Remove elements
|
|
600
|
+
source.elements.splice(source.elements.indexOf(imageElement), 1);
|
|
601
|
+
source.elements.length = 0; // Remove all
|
|
602
|
+
|
|
603
|
+
// Iterate elements
|
|
604
|
+
source.elements.forEach(element => {
|
|
605
|
+
console.log(element.image || element.video);
|
|
606
|
+
});
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
### Interactive Control Points
|
|
610
|
+
|
|
611
|
+
```javascript
|
|
612
|
+
// Enable interactive editing of georeference control points
|
|
613
|
+
const mediaLayerView = await view.whenLayerView(mediaLayer);
|
|
614
|
+
|
|
615
|
+
// Enable interactive mode to allow control point editing
|
|
616
|
+
mediaLayerView.interactive = true;
|
|
617
|
+
|
|
618
|
+
// Disable interactive mode
|
|
619
|
+
mediaLayerView.interactive = false;
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
### Complete Example
|
|
623
|
+
|
|
624
|
+
```html
|
|
625
|
+
<arcgis-map center="-89.93, 29.97" zoom="10">
|
|
626
|
+
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
627
|
+
</arcgis-map>
|
|
628
|
+
|
|
629
|
+
<script type="module">
|
|
630
|
+
import MediaLayer from "@arcgis/core/layers/MediaLayer.js";
|
|
631
|
+
import ImageElement from "@arcgis/core/layers/support/ImageElement.js";
|
|
632
|
+
import ExtentAndRotationGeoreference from "@arcgis/core/layers/support/ExtentAndRotationGeoreference.js";
|
|
633
|
+
import Extent from "@arcgis/core/geometry/Extent.js";
|
|
634
|
+
import Map from "@arcgis/core/Map.js";
|
|
635
|
+
|
|
636
|
+
const viewElement = document.querySelector("arcgis-map");
|
|
637
|
+
|
|
638
|
+
// Create image elements for historical maps
|
|
639
|
+
const imageElements = [
|
|
640
|
+
{
|
|
641
|
+
name: "1891 Map",
|
|
642
|
+
url: "https://example.com/map-1891.png",
|
|
643
|
+
extent: { xmin: -10047456, ymin: 3486722, xmax: -10006982, ymax: 3514468 }
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
name: "1920 Map",
|
|
647
|
+
url: "https://example.com/map-1920.png",
|
|
648
|
+
extent: { xmin: -10045000, ymin: 3488000, xmax: -10008000, ymax: 3516000 }
|
|
649
|
+
}
|
|
650
|
+
].map(info => new ImageElement({
|
|
651
|
+
image: info.url,
|
|
652
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
653
|
+
extent: new Extent({
|
|
654
|
+
...info.extent,
|
|
655
|
+
spatialReference: { wkid: 102100 }
|
|
656
|
+
})
|
|
657
|
+
})
|
|
658
|
+
}));
|
|
659
|
+
|
|
660
|
+
const mediaLayer = new MediaLayer({
|
|
661
|
+
source: imageElements,
|
|
662
|
+
title: "Historical Maps",
|
|
663
|
+
blendMode: "normal"
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
viewElement.map = new Map({
|
|
667
|
+
basemap: "topo-vector",
|
|
668
|
+
layers: [mediaLayer]
|
|
669
|
+
});
|
|
670
|
+
</script>
|
|
671
|
+
```
|
|
672
|
+
|
|
407
673
|
## Layer Comparison
|
|
408
674
|
|
|
409
675
|
| Layer Type | Use Case | Data Source |
|
|
@@ -414,6 +680,19 @@ layerList.listItemCreatedFunction = (event) => {
|
|
|
414
680
|
| OGCFeatureLayer | Vector from OGC API - Features | OGC API |
|
|
415
681
|
| MapImageLayer | Server-rendered imagery | ArcGIS Map Service |
|
|
416
682
|
| CatalogLayer | Collection of layers | ArcGIS Catalog Service |
|
|
683
|
+
| MediaLayer | Georeferenced images, video, GIFs | Local/remote media |
|
|
684
|
+
|
|
685
|
+
## Reference Samples
|
|
686
|
+
|
|
687
|
+
- `layers-wms` - Adding and configuring WMS layers
|
|
688
|
+
- `layers-wfs` - Working with WFS layers
|
|
689
|
+
- `layers-ogcfeaturelayer` - OGC Features API layer usage
|
|
690
|
+
- `layers-mapimagelayer` - Dynamic MapImageLayer configuration
|
|
691
|
+
- `layers-cataloglayer` - Using CatalogLayer to browse portal content
|
|
692
|
+
- `layers-medialayer-images` - Displaying images with MediaLayer
|
|
693
|
+
- `layers-medialayer-video` - Video playback in MediaLayer
|
|
694
|
+
- `layers-medialayer-control-points` - Control point placement for media
|
|
695
|
+
- `layers-medialayer-interactive` - Interactive media layer manipulation
|
|
417
696
|
|
|
418
697
|
## Common Pitfalls
|
|
419
698
|
|
|
@@ -429,3 +708,7 @@ layerList.listItemCreatedFunction = (event) => {
|
|
|
429
708
|
|
|
430
709
|
6. **Field prefixes**: In joined tables, prefix field names with table name (e.g., `ancestry.Norwegian`)
|
|
431
710
|
|
|
711
|
+
7. **Media CORS**: Images and videos from external servers need CORS headers
|
|
712
|
+
|
|
713
|
+
8. **Video autoplay**: Browsers may block autoplay - require user interaction first
|
|
714
|
+
|
|
@@ -284,7 +284,7 @@ $datastore // Reference to data store
|
|
|
284
284
|
## Execute Arcade Programmatically
|
|
285
285
|
|
|
286
286
|
```javascript
|
|
287
|
-
import
|
|
287
|
+
import * as arcade from "@arcgis/core/arcade.js";
|
|
288
288
|
|
|
289
289
|
// Create profile
|
|
290
290
|
const profile = {
|
|
@@ -295,13 +295,13 @@ const profile = {
|
|
|
295
295
|
};
|
|
296
296
|
|
|
297
297
|
// Compile expression
|
|
298
|
-
const executor = await
|
|
298
|
+
const executor = await arcade.createArcadeExecutor(
|
|
299
299
|
"Round($feature.value * 100, 2)",
|
|
300
300
|
profile
|
|
301
301
|
);
|
|
302
302
|
|
|
303
303
|
// Execute with feature
|
|
304
|
-
const result = executor.
|
|
304
|
+
const result = await executor.executeAsync({
|
|
305
305
|
$feature: graphic
|
|
306
306
|
});
|
|
307
307
|
|
|
@@ -352,6 +352,11 @@ layer.renderer = {
|
|
|
352
352
|
|
|
353
353
|
> **Tip:** See [arcgis-core-maps skill](../arcgis-core-maps/SKILL.md) for detailed guidance on autocasting vs explicit classes.
|
|
354
354
|
|
|
355
|
+
## Reference Samples
|
|
356
|
+
|
|
357
|
+
- `popuptemplate-arcade` - Arcade expressions in PopupTemplates
|
|
358
|
+
- `popuptemplate-arcade-expression-content` - Arcade expression content in popups
|
|
359
|
+
|
|
355
360
|
## Common Pitfalls
|
|
356
361
|
|
|
357
362
|
1. **Null values**: Check for nulls with `IsEmpty($feature.field)`
|