@saschabrunnerch/arcgis-maps-sdk-js-ai-context 0.0.1 → 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 -201
- 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/skills/arcgis-starter-app/SKILL.md +273 -0
- package/contexts/4.34/skills/arcgis-starter-app-extended/SKILL.md +649 -0
- 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 +294 -379
- 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-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
|
@@ -1,290 +1,290 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: arcgis-media-layers
|
|
3
|
-
description: Overlay images, videos, and animated GIFs on maps using MediaLayer. Use for historical imagery, plan overlays, and georeferenced media content.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# ArcGIS Media Layers
|
|
7
|
-
|
|
8
|
-
Use this skill for overlaying images, videos, and animated content on maps.
|
|
9
|
-
|
|
10
|
-
## MediaLayer Basics
|
|
11
|
-
|
|
12
|
-
### Create MediaLayer with Images
|
|
13
|
-
```javascript
|
|
14
|
-
import MediaLayer from "@arcgis/core/layers/MediaLayer.js";
|
|
15
|
-
import ImageElement from "@arcgis/core/layers/support/ImageElement.js";
|
|
16
|
-
import ExtentAndRotationGeoreference from "@arcgis/core/layers/support/ExtentAndRotationGeoreference.js";
|
|
17
|
-
import Extent from "@arcgis/core/geometry/Extent.js";
|
|
18
|
-
|
|
19
|
-
const imageElement = new ImageElement({
|
|
20
|
-
image: "https://example.com/historical-map.png",
|
|
21
|
-
georeference: new ExtentAndRotationGeoreference({
|
|
22
|
-
extent: new Extent({
|
|
23
|
-
xmin: -10047456,
|
|
24
|
-
ymin: 3486722,
|
|
25
|
-
xmax: -10006982,
|
|
26
|
-
ymax: 3514468,
|
|
27
|
-
spatialReference: { wkid: 102100 }
|
|
28
|
-
})
|
|
29
|
-
})
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const mediaLayer = new MediaLayer({
|
|
33
|
-
source: [imageElement],
|
|
34
|
-
title: "Historical Map"
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
map.add(mediaLayer);
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Multiple Images
|
|
41
|
-
```javascript
|
|
42
|
-
const imageInfos = [
|
|
43
|
-
{
|
|
44
|
-
url: "image1.png",
|
|
45
|
-
extent: { xmin: -100, ymin: 30, xmax: -90, ymax: 40 }
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
url: "image2.png",
|
|
49
|
-
extent: { xmin: -95, ymin: 35, xmax: -85, ymax: 45 }
|
|
50
|
-
}
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const imageElements = imageInfos.map(info => new ImageElement({
|
|
54
|
-
image: info.url,
|
|
55
|
-
georeference: new ExtentAndRotationGeoreference({
|
|
56
|
-
extent: new Extent({
|
|
57
|
-
...info.extent,
|
|
58
|
-
spatialReference: { wkid: 4326 }
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
}));
|
|
62
|
-
|
|
63
|
-
const mediaLayer = new MediaLayer({
|
|
64
|
-
source: imageElements
|
|
65
|
-
});
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Georeferencing Methods
|
|
69
|
-
|
|
70
|
-
### Extent and Rotation
|
|
71
|
-
```javascript
|
|
72
|
-
const georeference = new ExtentAndRotationGeoreference({
|
|
73
|
-
extent: new Extent({
|
|
74
|
-
xmin: -122.5,
|
|
75
|
-
ymin: 37.5,
|
|
76
|
-
xmax: -122.0,
|
|
77
|
-
ymax: 38.0,
|
|
78
|
-
spatialReference: { wkid: 4326 }
|
|
79
|
-
}),
|
|
80
|
-
rotation: 15 // Degrees clockwise
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Control Points (Corners)
|
|
85
|
-
```javascript
|
|
86
|
-
import ControlPointsGeoreference from "@arcgis/core/layers/support/ControlPointsGeoreference.js";
|
|
87
|
-
|
|
88
|
-
const georeference = new ControlPointsGeoreference({
|
|
89
|
-
controlPoints: [
|
|
90
|
-
{
|
|
91
|
-
sourcePoint: { x: 0, y: 0 }, // Top-left of image (pixels)
|
|
92
|
-
mapPoint: { x: -122.5, y: 38.0 } // Map coordinates
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
sourcePoint: { x: 1000, y: 0 }, // Top-right
|
|
96
|
-
mapPoint: { x: -122.0, y: 38.0 }
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
sourcePoint: { x: 1000, y: 800 }, // Bottom-right
|
|
100
|
-
mapPoint: { x: -122.0, y: 37.5 }
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
sourcePoint: { x: 0, y: 800 }, // Bottom-left
|
|
104
|
-
mapPoint: { x: -122.5, y: 37.5 }
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
width: 1000, // Image width in pixels
|
|
108
|
-
height: 800 // Image height in pixels
|
|
109
|
-
});
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Video Elements
|
|
113
|
-
|
|
114
|
-
```javascript
|
|
115
|
-
import VideoElement from "@arcgis/core/layers/support/VideoElement.js";
|
|
116
|
-
|
|
117
|
-
const videoElement = new VideoElement({
|
|
118
|
-
video: "https://example.com/timelapse.mp4",
|
|
119
|
-
georeference: new ExtentAndRotationGeoreference({
|
|
120
|
-
extent: new Extent({
|
|
121
|
-
xmin: -122.5,
|
|
122
|
-
ymin: 37.5,
|
|
123
|
-
xmax: -122.0,
|
|
124
|
-
ymax: 38.0,
|
|
125
|
-
spatialReference: { wkid: 4326 }
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
const mediaLayer = new MediaLayer({
|
|
131
|
-
source: [videoElement]
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// Control video playback
|
|
135
|
-
videoElement.content.play();
|
|
136
|
-
videoElement.content.pause();
|
|
137
|
-
videoElement.content.currentTime = 30; // Seek to 30 seconds
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Animated GIF
|
|
141
|
-
|
|
142
|
-
```javascript
|
|
143
|
-
// Animated GIFs work like regular images
|
|
144
|
-
const gifElement = new ImageElement({
|
|
145
|
-
image: "https://example.com/weather-animation.gif",
|
|
146
|
-
georeference: new ExtentAndRotationGeoreference({
|
|
147
|
-
extent: new Extent({
|
|
148
|
-
xmin: -130,
|
|
149
|
-
ymin: 25,
|
|
150
|
-
xmax: -65,
|
|
151
|
-
ymax: 50,
|
|
152
|
-
spatialReference: { wkid: 4326 }
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
const mediaLayer = new MediaLayer({
|
|
158
|
-
source: [gifElement]
|
|
159
|
-
});
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## Layer Configuration
|
|
163
|
-
|
|
164
|
-
### Opacity and Blend Mode
|
|
165
|
-
```javascript
|
|
166
|
-
const mediaLayer = new MediaLayer({
|
|
167
|
-
source: [imageElement],
|
|
168
|
-
opacity: 0.7,
|
|
169
|
-
blendMode: "multiply" // normal, multiply, luminosity, etc.
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
// Change opacity dynamically
|
|
173
|
-
mediaLayer.opacity = 0.5;
|
|
174
|
-
|
|
175
|
-
// Change blend mode
|
|
176
|
-
mediaLayer.blendMode = "luminosity";
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
### Element Opacity
|
|
180
|
-
```javascript
|
|
181
|
-
// Individual element opacity
|
|
182
|
-
imageElement.opacity = 0.8;
|
|
183
|
-
|
|
184
|
-
// Update dynamically
|
|
185
|
-
document.getElementById("opacitySlider").addEventListener("input", (e) => {
|
|
186
|
-
imageElement.opacity = e.target.value / 100;
|
|
187
|
-
});
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## Managing Source Elements
|
|
191
|
-
|
|
192
|
-
```javascript
|
|
193
|
-
// Access source
|
|
194
|
-
const source = mediaLayer.source;
|
|
195
|
-
|
|
196
|
-
// Add elements
|
|
197
|
-
source.elements.add(newImageElement);
|
|
198
|
-
source.elements.addMany([element1, element2]);
|
|
199
|
-
|
|
200
|
-
// Remove elements
|
|
201
|
-
source.elements.remove(imageElement);
|
|
202
|
-
source.elements.removeAll();
|
|
203
|
-
|
|
204
|
-
// Get all elements
|
|
205
|
-
source.elements.forEach(element => {
|
|
206
|
-
console.log(element.image || element.video);
|
|
207
|
-
});
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Interactive Control Points
|
|
211
|
-
|
|
212
|
-
```javascript
|
|
213
|
-
// Enable editing of georeference control points
|
|
214
|
-
const mediaLayerView = await view.whenLayerView(mediaLayer);
|
|
215
|
-
|
|
216
|
-
// Start editing
|
|
217
|
-
mediaLayerView.startEditing(imageElement);
|
|
218
|
-
|
|
219
|
-
// Stop editing
|
|
220
|
-
mediaLayerView.stopEditing();
|
|
221
|
-
|
|
222
|
-
// Listen for georeference changes
|
|
223
|
-
imageElement.watch("georeference", (newGeoreference) => {
|
|
224
|
-
console.log("Georeference updated:", newGeoreference);
|
|
225
|
-
});
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Complete Example
|
|
229
|
-
|
|
230
|
-
```html
|
|
231
|
-
<arcgis-map center="-89.93, 29.97" zoom="10">
|
|
232
|
-
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
233
|
-
</arcgis-map>
|
|
234
|
-
|
|
235
|
-
<script type="module">
|
|
236
|
-
import MediaLayer from "@arcgis/core/layers/MediaLayer.js";
|
|
237
|
-
import ImageElement from "@arcgis/core/layers/support/ImageElement.js";
|
|
238
|
-
import ExtentAndRotationGeoreference from "@arcgis/core/layers/support/ExtentAndRotationGeoreference.js";
|
|
239
|
-
import Extent from "@arcgis/core/geometry/Extent.js";
|
|
240
|
-
import Map from "@arcgis/core/Map.js";
|
|
241
|
-
|
|
242
|
-
const viewElement = document.querySelector("arcgis-map");
|
|
243
|
-
|
|
244
|
-
// Create image elements for historical maps
|
|
245
|
-
const imageElements = [
|
|
246
|
-
{
|
|
247
|
-
name: "1891 Map",
|
|
248
|
-
url: "https://example.com/map-1891.png",
|
|
249
|
-
extent: { xmin: -10047456, ymin: 3486722, xmax: -10006982, ymax: 3514468 }
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
name: "1920 Map",
|
|
253
|
-
url: "https://example.com/map-1920.png",
|
|
254
|
-
extent: { xmin: -10045000, ymin: 3488000, xmax: -10008000, ymax: 3516000 }
|
|
255
|
-
}
|
|
256
|
-
].map(info => new ImageElement({
|
|
257
|
-
image: info.url,
|
|
258
|
-
georeference: new ExtentAndRotationGeoreference({
|
|
259
|
-
extent: new Extent({
|
|
260
|
-
...info.extent,
|
|
261
|
-
spatialReference: { wkid: 102100 }
|
|
262
|
-
})
|
|
263
|
-
})
|
|
264
|
-
}));
|
|
265
|
-
|
|
266
|
-
const mediaLayer = new MediaLayer({
|
|
267
|
-
source: imageElements,
|
|
268
|
-
title: "Historical Maps",
|
|
269
|
-
blendMode: "normal"
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
viewElement.map = new Map({
|
|
273
|
-
basemap: "topo-vector",
|
|
274
|
-
layers: [mediaLayer]
|
|
275
|
-
});
|
|
276
|
-
</script>
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
## Common Pitfalls
|
|
280
|
-
|
|
281
|
-
1. **Coordinate systems**: Ensure extent coordinates match the spatial reference
|
|
282
|
-
|
|
283
|
-
2. **Image loading**: Large images may take time to load - consider using smaller/optimized images
|
|
284
|
-
|
|
285
|
-
3. **Control point order**: Control points must be in correct order (top-left, top-right, bottom-right, bottom-left)
|
|
286
|
-
|
|
287
|
-
4. **CORS**: Images from external servers need CORS headers
|
|
288
|
-
|
|
289
|
-
5. **Video autoplay**: Browsers may block autoplay - require user interaction first
|
|
290
|
-
|
|
1
|
+
---
|
|
2
|
+
name: arcgis-media-layers
|
|
3
|
+
description: Overlay images, videos, and animated GIFs on maps using MediaLayer. Use for historical imagery, plan overlays, and georeferenced media content.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ArcGIS Media Layers
|
|
7
|
+
|
|
8
|
+
Use this skill for overlaying images, videos, and animated content on maps.
|
|
9
|
+
|
|
10
|
+
## MediaLayer Basics
|
|
11
|
+
|
|
12
|
+
### Create MediaLayer with Images
|
|
13
|
+
```javascript
|
|
14
|
+
import MediaLayer from "@arcgis/core/layers/MediaLayer.js";
|
|
15
|
+
import ImageElement from "@arcgis/core/layers/support/ImageElement.js";
|
|
16
|
+
import ExtentAndRotationGeoreference from "@arcgis/core/layers/support/ExtentAndRotationGeoreference.js";
|
|
17
|
+
import Extent from "@arcgis/core/geometry/Extent.js";
|
|
18
|
+
|
|
19
|
+
const imageElement = new ImageElement({
|
|
20
|
+
image: "https://example.com/historical-map.png",
|
|
21
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
22
|
+
extent: new Extent({
|
|
23
|
+
xmin: -10047456,
|
|
24
|
+
ymin: 3486722,
|
|
25
|
+
xmax: -10006982,
|
|
26
|
+
ymax: 3514468,
|
|
27
|
+
spatialReference: { wkid: 102100 }
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const mediaLayer = new MediaLayer({
|
|
33
|
+
source: [imageElement],
|
|
34
|
+
title: "Historical Map"
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
map.add(mediaLayer);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Multiple Images
|
|
41
|
+
```javascript
|
|
42
|
+
const imageInfos = [
|
|
43
|
+
{
|
|
44
|
+
url: "image1.png",
|
|
45
|
+
extent: { xmin: -100, ymin: 30, xmax: -90, ymax: 40 }
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
url: "image2.png",
|
|
49
|
+
extent: { xmin: -95, ymin: 35, xmax: -85, ymax: 45 }
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const imageElements = imageInfos.map(info => new ImageElement({
|
|
54
|
+
image: info.url,
|
|
55
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
56
|
+
extent: new Extent({
|
|
57
|
+
...info.extent,
|
|
58
|
+
spatialReference: { wkid: 4326 }
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
const mediaLayer = new MediaLayer({
|
|
64
|
+
source: imageElements
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Georeferencing Methods
|
|
69
|
+
|
|
70
|
+
### Extent and Rotation
|
|
71
|
+
```javascript
|
|
72
|
+
const georeference = new ExtentAndRotationGeoreference({
|
|
73
|
+
extent: new Extent({
|
|
74
|
+
xmin: -122.5,
|
|
75
|
+
ymin: 37.5,
|
|
76
|
+
xmax: -122.0,
|
|
77
|
+
ymax: 38.0,
|
|
78
|
+
spatialReference: { wkid: 4326 }
|
|
79
|
+
}),
|
|
80
|
+
rotation: 15 // Degrees clockwise
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Control Points (Corners)
|
|
85
|
+
```javascript
|
|
86
|
+
import ControlPointsGeoreference from "@arcgis/core/layers/support/ControlPointsGeoreference.js";
|
|
87
|
+
|
|
88
|
+
const georeference = new ControlPointsGeoreference({
|
|
89
|
+
controlPoints: [
|
|
90
|
+
{
|
|
91
|
+
sourcePoint: { x: 0, y: 0 }, // Top-left of image (pixels)
|
|
92
|
+
mapPoint: { x: -122.5, y: 38.0 } // Map coordinates
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
sourcePoint: { x: 1000, y: 0 }, // Top-right
|
|
96
|
+
mapPoint: { x: -122.0, y: 38.0 }
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
sourcePoint: { x: 1000, y: 800 }, // Bottom-right
|
|
100
|
+
mapPoint: { x: -122.0, y: 37.5 }
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
sourcePoint: { x: 0, y: 800 }, // Bottom-left
|
|
104
|
+
mapPoint: { x: -122.5, y: 37.5 }
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
width: 1000, // Image width in pixels
|
|
108
|
+
height: 800 // Image height in pixels
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Video Elements
|
|
113
|
+
|
|
114
|
+
```javascript
|
|
115
|
+
import VideoElement from "@arcgis/core/layers/support/VideoElement.js";
|
|
116
|
+
|
|
117
|
+
const videoElement = new VideoElement({
|
|
118
|
+
video: "https://example.com/timelapse.mp4",
|
|
119
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
120
|
+
extent: new Extent({
|
|
121
|
+
xmin: -122.5,
|
|
122
|
+
ymin: 37.5,
|
|
123
|
+
xmax: -122.0,
|
|
124
|
+
ymax: 38.0,
|
|
125
|
+
spatialReference: { wkid: 4326 }
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const mediaLayer = new MediaLayer({
|
|
131
|
+
source: [videoElement]
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Control video playback
|
|
135
|
+
videoElement.content.play();
|
|
136
|
+
videoElement.content.pause();
|
|
137
|
+
videoElement.content.currentTime = 30; // Seek to 30 seconds
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Animated GIF
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
// Animated GIFs work like regular images
|
|
144
|
+
const gifElement = new ImageElement({
|
|
145
|
+
image: "https://example.com/weather-animation.gif",
|
|
146
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
147
|
+
extent: new Extent({
|
|
148
|
+
xmin: -130,
|
|
149
|
+
ymin: 25,
|
|
150
|
+
xmax: -65,
|
|
151
|
+
ymax: 50,
|
|
152
|
+
spatialReference: { wkid: 4326 }
|
|
153
|
+
})
|
|
154
|
+
})
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const mediaLayer = new MediaLayer({
|
|
158
|
+
source: [gifElement]
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Layer Configuration
|
|
163
|
+
|
|
164
|
+
### Opacity and Blend Mode
|
|
165
|
+
```javascript
|
|
166
|
+
const mediaLayer = new MediaLayer({
|
|
167
|
+
source: [imageElement],
|
|
168
|
+
opacity: 0.7,
|
|
169
|
+
blendMode: "multiply" // normal, multiply, luminosity, etc.
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// Change opacity dynamically
|
|
173
|
+
mediaLayer.opacity = 0.5;
|
|
174
|
+
|
|
175
|
+
// Change blend mode
|
|
176
|
+
mediaLayer.blendMode = "luminosity";
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Element Opacity
|
|
180
|
+
```javascript
|
|
181
|
+
// Individual element opacity
|
|
182
|
+
imageElement.opacity = 0.8;
|
|
183
|
+
|
|
184
|
+
// Update dynamically
|
|
185
|
+
document.getElementById("opacitySlider").addEventListener("input", (e) => {
|
|
186
|
+
imageElement.opacity = e.target.value / 100;
|
|
187
|
+
});
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Managing Source Elements
|
|
191
|
+
|
|
192
|
+
```javascript
|
|
193
|
+
// Access source
|
|
194
|
+
const source = mediaLayer.source;
|
|
195
|
+
|
|
196
|
+
// Add elements
|
|
197
|
+
source.elements.add(newImageElement);
|
|
198
|
+
source.elements.addMany([element1, element2]);
|
|
199
|
+
|
|
200
|
+
// Remove elements
|
|
201
|
+
source.elements.remove(imageElement);
|
|
202
|
+
source.elements.removeAll();
|
|
203
|
+
|
|
204
|
+
// Get all elements
|
|
205
|
+
source.elements.forEach(element => {
|
|
206
|
+
console.log(element.image || element.video);
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Interactive Control Points
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
// Enable editing of georeference control points
|
|
214
|
+
const mediaLayerView = await view.whenLayerView(mediaLayer);
|
|
215
|
+
|
|
216
|
+
// Start editing
|
|
217
|
+
mediaLayerView.startEditing(imageElement);
|
|
218
|
+
|
|
219
|
+
// Stop editing
|
|
220
|
+
mediaLayerView.stopEditing();
|
|
221
|
+
|
|
222
|
+
// Listen for georeference changes
|
|
223
|
+
imageElement.watch("georeference", (newGeoreference) => {
|
|
224
|
+
console.log("Georeference updated:", newGeoreference);
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Complete Example
|
|
229
|
+
|
|
230
|
+
```html
|
|
231
|
+
<arcgis-map center="-89.93, 29.97" zoom="10">
|
|
232
|
+
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
233
|
+
</arcgis-map>
|
|
234
|
+
|
|
235
|
+
<script type="module">
|
|
236
|
+
import MediaLayer from "@arcgis/core/layers/MediaLayer.js";
|
|
237
|
+
import ImageElement from "@arcgis/core/layers/support/ImageElement.js";
|
|
238
|
+
import ExtentAndRotationGeoreference from "@arcgis/core/layers/support/ExtentAndRotationGeoreference.js";
|
|
239
|
+
import Extent from "@arcgis/core/geometry/Extent.js";
|
|
240
|
+
import Map from "@arcgis/core/Map.js";
|
|
241
|
+
|
|
242
|
+
const viewElement = document.querySelector("arcgis-map");
|
|
243
|
+
|
|
244
|
+
// Create image elements for historical maps
|
|
245
|
+
const imageElements = [
|
|
246
|
+
{
|
|
247
|
+
name: "1891 Map",
|
|
248
|
+
url: "https://example.com/map-1891.png",
|
|
249
|
+
extent: { xmin: -10047456, ymin: 3486722, xmax: -10006982, ymax: 3514468 }
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: "1920 Map",
|
|
253
|
+
url: "https://example.com/map-1920.png",
|
|
254
|
+
extent: { xmin: -10045000, ymin: 3488000, xmax: -10008000, ymax: 3516000 }
|
|
255
|
+
}
|
|
256
|
+
].map(info => new ImageElement({
|
|
257
|
+
image: info.url,
|
|
258
|
+
georeference: new ExtentAndRotationGeoreference({
|
|
259
|
+
extent: new Extent({
|
|
260
|
+
...info.extent,
|
|
261
|
+
spatialReference: { wkid: 102100 }
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
}));
|
|
265
|
+
|
|
266
|
+
const mediaLayer = new MediaLayer({
|
|
267
|
+
source: imageElements,
|
|
268
|
+
title: "Historical Maps",
|
|
269
|
+
blendMode: "normal"
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
viewElement.map = new Map({
|
|
273
|
+
basemap: "topo-vector",
|
|
274
|
+
layers: [mediaLayer]
|
|
275
|
+
});
|
|
276
|
+
</script>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Common Pitfalls
|
|
280
|
+
|
|
281
|
+
1. **Coordinate systems**: Ensure extent coordinates match the spatial reference
|
|
282
|
+
|
|
283
|
+
2. **Image loading**: Large images may take time to load - consider using smaller/optimized images
|
|
284
|
+
|
|
285
|
+
3. **Control point order**: Control points must be in correct order (top-left, top-right, bottom-right, bottom-left)
|
|
286
|
+
|
|
287
|
+
4. **CORS**: Images from external servers need CORS headers
|
|
288
|
+
|
|
289
|
+
5. **Video autoplay**: Browsers may block autoplay - require user interaction first
|
|
290
|
+
|