@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.
Files changed (52) hide show
  1. package/README.md +163 -203
  2. package/bin/cli.js +157 -173
  3. package/contexts/4.34/{claude → skills}/arcgis-3d-advanced/SKILL.md +586 -586
  4. package/contexts/4.34/{claude → skills}/arcgis-advanced-layers/SKILL.md +431 -431
  5. package/contexts/4.34/{claude → skills}/arcgis-analysis-services/SKILL.md +607 -607
  6. package/contexts/4.34/{claude → skills}/arcgis-authentication/SKILL.md +301 -301
  7. package/contexts/4.34/{claude → skills}/arcgis-cim-symbols/SKILL.md +486 -486
  8. package/contexts/4.34/{claude → skills}/arcgis-coordinates-projection/SKILL.md +406 -406
  9. package/contexts/4.34/{claude → skills}/arcgis-core-maps/SKILL.md +739 -739
  10. package/contexts/4.34/{claude → skills}/arcgis-core-utilities/SKILL.md +732 -732
  11. package/contexts/4.34/{claude → skills}/arcgis-custom-rendering/SKILL.md +445 -445
  12. package/contexts/4.34/{claude → skills}/arcgis-editing-advanced/SKILL.md +702 -702
  13. package/contexts/4.34/{claude → skills}/arcgis-feature-effects/SKILL.md +393 -393
  14. package/contexts/4.34/{claude → skills}/arcgis-geometry-operations/SKILL.md +489 -489
  15. package/contexts/4.34/{claude → skills}/arcgis-imagery/SKILL.md +307 -307
  16. package/contexts/4.34/{claude → skills}/arcgis-interaction/SKILL.md +572 -572
  17. package/contexts/4.34/{claude → skills}/arcgis-knowledge-graphs/SKILL.md +582 -582
  18. package/contexts/4.34/{claude → skills}/arcgis-layers/SKILL.md +601 -601
  19. package/contexts/4.34/{claude → skills}/arcgis-map-tools/SKILL.md +668 -668
  20. package/contexts/4.34/{claude → skills}/arcgis-media-layers/SKILL.md +290 -290
  21. package/contexts/4.34/{claude → skills}/arcgis-portal-content/SKILL.md +679 -679
  22. package/contexts/4.34/{claude → skills}/arcgis-scene-effects/SKILL.md +512 -512
  23. package/contexts/4.34/{claude → skills}/arcgis-smart-mapping/SKILL.md +686 -686
  24. package/contexts/4.34/{claude → skills}/arcgis-starter-app-extended/SKILL.md +649 -649
  25. package/contexts/4.34/{claude → skills}/arcgis-tables-forms/SKILL.md +877 -877
  26. package/contexts/4.34/{claude → skills}/arcgis-time-animation/SKILL.md +722 -722
  27. package/contexts/4.34/{claude → skills}/arcgis-utility-networks/SKILL.md +301 -301
  28. package/contexts/4.34/{claude → skills}/arcgis-visualization/SKILL.md +580 -580
  29. package/contexts/4.34/{claude → skills}/arcgis-widgets-ui/SKILL.md +574 -574
  30. package/lib/installer.js +19 -104
  31. package/package.json +45 -45
  32. package/contexts/4.34/copilot/arcgis-3d.instructions.md +0 -267
  33. package/contexts/4.34/copilot/arcgis-analysis.instructions.md +0 -294
  34. package/contexts/4.34/copilot/arcgis-arcade.instructions.md +0 -234
  35. package/contexts/4.34/copilot/arcgis-authentication.instructions.md +0 -187
  36. package/contexts/4.34/copilot/arcgis-cim-symbols.instructions.md +0 -177
  37. package/contexts/4.34/copilot/arcgis-core-maps.instructions.md +0 -246
  38. package/contexts/4.34/copilot/arcgis-core-utilities.instructions.md +0 -247
  39. package/contexts/4.34/copilot/arcgis-editing.instructions.md +0 -262
  40. package/contexts/4.34/copilot/arcgis-geometry.instructions.md +0 -225
  41. package/contexts/4.34/copilot/arcgis-layers.instructions.md +0 -278
  42. package/contexts/4.34/copilot/arcgis-popup-templates.instructions.md +0 -266
  43. package/contexts/4.34/copilot/arcgis-portal-advanced.instructions.md +0 -275
  44. package/contexts/4.34/copilot/arcgis-smart-mapping.instructions.md +0 -184
  45. package/contexts/4.34/copilot/arcgis-starter-app-extended.instructions.md +0 -643
  46. package/contexts/4.34/copilot/arcgis-starter-app.instructions.md +0 -268
  47. package/contexts/4.34/copilot/arcgis-time-animation.instructions.md +0 -112
  48. package/contexts/4.34/copilot/arcgis-visualization.instructions.md +0 -321
  49. package/contexts/4.34/copilot/arcgis-widgets-ui.instructions.md +0 -277
  50. /package/contexts/4.34/{claude → skills}/arcgis-arcade/SKILL.md +0 -0
  51. /package/contexts/4.34/{claude → skills}/arcgis-popup-templates/SKILL.md +0 -0
  52. /package/contexts/4.34/{claude → skills}/arcgis-starter-app/SKILL.md +0 -0
@@ -1,679 +1,679 @@
1
- ---
2
- name: arcgis-portal-content
3
- description: Manage portal content including saving WebMaps/WebScenes, bookmarks, slides, and portal items. Use for content persistence, WebMap/WebScene configuration, and navigation presets.
4
- ---
5
-
6
- # ArcGIS Portal Content
7
-
8
- Use this skill for saving maps, managing bookmarks, slides, working with portal items, and configuring WebMap/WebScene structure.
9
-
10
- ## WebMap Structure
11
-
12
- ### WebMap Properties
13
-
14
- ```javascript
15
- import WebMap from "@arcgis/core/WebMap.js";
16
-
17
- const webMap = new WebMap({
18
- // Portal item reference
19
- portalItem: {
20
- id: "WEBMAP_ID",
21
- portal: { url: "https://www.arcgis.com" }
22
- },
23
-
24
- // Or create from scratch
25
- basemap: "topo-vector",
26
- ground: "world-elevation",
27
-
28
- // Layers
29
- layers: [featureLayer, graphicsLayer],
30
-
31
- // Tables (non-spatial)
32
- tables: [tableLayer],
33
-
34
- // Initial viewpoint
35
- initialViewProperties: {
36
- center: [-118.805, 34.027],
37
- zoom: 13,
38
- rotation: 0
39
- },
40
-
41
- // Bookmarks
42
- bookmarks: [bookmark1, bookmark2],
43
-
44
- // Application properties
45
- applicationProperties: {
46
- viewing: {
47
- search: {
48
- enabled: true,
49
- hintText: "Search for places"
50
- }
51
- }
52
- }
53
- });
54
- ```
55
-
56
- ### WebMap from JSON
57
-
58
- ```javascript
59
- import WebMap from "@arcgis/core/WebMap.js";
60
-
61
- // Create WebMap from JSON specification
62
- const webMap = WebMap.fromJSON({
63
- operationalLayers: [{
64
- id: "layer1",
65
- layerType: "ArcGISFeatureLayer",
66
- url: "https://services.arcgis.com/.../FeatureServer/0",
67
- title: "My Layer",
68
- visibility: true,
69
- opacity: 1
70
- }],
71
- baseMap: {
72
- baseMapLayers: [{
73
- id: "basemap",
74
- layerType: "VectorTileLayer",
75
- styleUrl: "https://basemaps-api.arcgis.com/arcgis/rest/services/styles/v2/styles/arcgis/topographic"
76
- }],
77
- title: "Topographic"
78
- },
79
- initialState: {
80
- viewpoint: {
81
- targetGeometry: {
82
- xmin: -118.9, ymin: 33.8, xmax: -118.1, ymax: 34.3,
83
- spatialReference: { wkid: 4326 }
84
- }
85
- }
86
- },
87
- version: "2.31"
88
- });
89
- ```
90
-
91
- ### WebMap Initial State
92
-
93
- ```javascript
94
- const webMap = new WebMap({
95
- basemap: "streets-vector",
96
- initialViewProperties: {
97
- // Viewpoint
98
- viewpoint: {
99
- targetGeometry: {
100
- type: "extent",
101
- xmin: -13050000, ymin: 3980000,
102
- xmax: -13000000, ymax: 4050000,
103
- spatialReference: { wkid: 102100 }
104
- },
105
- rotation: 45
106
- },
107
- // Or simpler
108
- center: [-118.805, 34.027],
109
- zoom: 12,
110
- scale: 50000,
111
-
112
- // Constraints
113
- constraints: {
114
- minZoom: 8,
115
- maxZoom: 18,
116
- minScale: 5000000,
117
- maxScale: 1000,
118
- rotationEnabled: false
119
- },
120
-
121
- // Time extent
122
- timeExtent: {
123
- start: new Date("2024-01-01"),
124
- end: new Date("2024-12-31")
125
- }
126
- }
127
- });
128
- ```
129
-
130
- ## WebScene Structure
131
-
132
- ### WebScene Properties
133
-
134
- ```javascript
135
- import WebScene from "@arcgis/core/WebScene.js";
136
-
137
- const webScene = new WebScene({
138
- // Portal item
139
- portalItem: { id: "WEBSCENE_ID" },
140
-
141
- // Or create from scratch
142
- basemap: "satellite",
143
- ground: "world-elevation",
144
-
145
- // Layers
146
- layers: [sceneLayer, featureLayer],
147
-
148
- // Initial viewpoint
149
- initialViewProperties: {
150
- viewpoint: {
151
- camera: {
152
- position: {
153
- x: -118.805,
154
- y: 34.027,
155
- z: 1500,
156
- spatialReference: { wkid: 4326 }
157
- },
158
- heading: 45,
159
- tilt: 65
160
- }
161
- }
162
- },
163
-
164
- // Presentation (slides)
165
- presentation: {
166
- slides: [slide1, slide2]
167
- },
168
-
169
- // Clipping area (local scenes)
170
- clippingArea: extent,
171
- clippingEnabled: true
172
- });
173
- ```
174
-
175
- ### WebScene Environment
176
-
177
- ```javascript
178
- const webScene = new WebScene({
179
- basemap: "satellite",
180
- ground: "world-elevation",
181
-
182
- // Environment settings
183
- environment: {
184
- // Lighting
185
- lighting: {
186
- type: "sun", // sun, virtual
187
- date: new Date("2024-06-21T12:00:00"),
188
- directShadowsEnabled: true,
189
- ambientOcclusionEnabled: true
190
- },
191
-
192
- // Atmosphere
193
- atmosphere: {
194
- quality: "high" // low, high
195
- },
196
-
197
- // Background
198
- background: {
199
- type: "color",
200
- color: [0, 0, 0, 1]
201
- },
202
-
203
- // Stars
204
- starsEnabled: true,
205
-
206
- // Weather
207
- weather: {
208
- type: "sunny", // sunny, cloudy, rainy, snowy, foggy
209
- cloudCover: 0.3
210
- }
211
- }
212
- });
213
- ```
214
-
215
- ### WebScene Presentation
216
-
217
- ```javascript
218
- import Slide from "@arcgis/core/webscene/Slide.js";
219
-
220
- // Access existing slides
221
- const slides = webScene.presentation.slides;
222
-
223
- // Create new slide
224
- const slide = await Slide.createFrom(sceneView);
225
- slide.title = { text: "Downtown View" };
226
- slide.description = { text: "Overview of downtown area" };
227
-
228
- // Slide properties captured
229
- console.log(slide.viewpoint); // Camera position
230
- console.log(slide.visibleLayers); // Layer visibility
231
- console.log(slide.environment); // Environment settings
232
- console.log(slide.thumbnail); // Auto-generated thumbnail
233
-
234
- // Add to presentation
235
- webScene.presentation.slides.add(slide);
236
-
237
- // Reorder slides
238
- webScene.presentation.slides.reorder(slide, 0);
239
- ```
240
-
241
- ### Local vs Global Scene
242
-
243
- ```javascript
244
- // Global scene (default)
245
- const globalScene = new WebScene({
246
- basemap: "satellite",
247
- ground: "world-elevation",
248
- viewingMode: "global"
249
- });
250
-
251
- // Local scene (with clipping)
252
- const localScene = new WebScene({
253
- basemap: "satellite",
254
- ground: "world-elevation",
255
- viewingMode: "local",
256
- clippingArea: {
257
- type: "extent",
258
- xmin: -118.9, ymin: 33.8, xmax: -118.1, ymax: 34.3,
259
- spatialReference: { wkid: 4326 }
260
- },
261
- clippingEnabled: true
262
- });
263
- ```
264
-
265
- ## Application Properties
266
-
267
- ### WebMap Application Properties
268
-
269
- ```javascript
270
- const webMap = new WebMap({
271
- applicationProperties: {
272
- // Viewing properties
273
- viewing: {
274
- // Search configuration
275
- search: {
276
- enabled: true,
277
- disablePlaceFinder: false,
278
- hintText: "Find address or place",
279
- layers: [{
280
- id: "search-layer",
281
- field: { name: "Name", exactMatch: false }
282
- }]
283
- }
284
- }
285
- }
286
- });
287
-
288
- // Access application properties
289
- const searchEnabled = webMap.applicationProperties?.viewing?.search?.enabled;
290
- ```
291
-
292
- ### WebScene Application Properties
293
-
294
- ```javascript
295
- const webScene = new WebScene({
296
- applicationProperties: {
297
- viewing: {
298
- search: {
299
- enabled: true
300
- }
301
- }
302
- },
303
-
304
- // Presentation settings
305
- presentation: {
306
- slides: [],
307
- useViewFor: "slideshow" // slideshow, comparison
308
- }
309
- });
310
- ```
311
-
312
- ## Saving WebMaps
313
-
314
- ### Save WebMap As New Item
315
- ```javascript
316
- import WebMap from "@arcgis/core/WebMap.js";
317
-
318
- const map = new WebMap({
319
- portalItem: { id: "EXISTING_WEBMAP_ID" }
320
- });
321
-
322
- // Update map properties from view before saving
323
- await map.updateFrom(view);
324
-
325
- // Save as new item
326
- const item = {
327
- title: "My New WebMap",
328
- snippet: "Description of the map",
329
- tags: ["tag1", "tag2"]
330
- };
331
-
332
- const savedItem = await map.saveAs(item);
333
- console.log("Saved to:", savedItem.portal.url + "/home/item.html?id=" + savedItem.id);
334
- ```
335
-
336
- ### Save Existing WebMap
337
- ```javascript
338
- // Update and save existing webmap
339
- await map.updateFrom(view);
340
- await map.save();
341
- console.log("WebMap saved");
342
- ```
343
-
344
- ### Map Component Save Example
345
- ```html
346
- <arcgis-map>
347
- <arcgis-zoom slot="top-left"></arcgis-zoom>
348
- <calcite-panel slot="top-right">
349
- <calcite-input id="webMapTitle" value="My WebMap"></calcite-input>
350
- <calcite-button id="saveWebMap">Save</calcite-button>
351
- </calcite-panel>
352
- </arcgis-map>
353
-
354
- <script type="module">
355
- import WebMap from "@arcgis/core/WebMap.js";
356
-
357
- const viewElement = document.querySelector("arcgis-map");
358
- const map = new WebMap({ portalItem: { id: "YOUR_WEBMAP_ID" } });
359
- viewElement.map = map;
360
-
361
- await viewElement.viewOnReady();
362
-
363
- document.getElementById("saveWebMap").onclick = async () => {
364
- const title = document.getElementById("webMapTitle").value;
365
-
366
- await map.updateFrom(viewElement.view);
367
- const item = await map.saveAs({ title });
368
-
369
- alert(`Saved as: ${item.id}`);
370
- };
371
- </script>
372
- ```
373
-
374
- ## Saving WebScenes
375
-
376
- ### Save WebScene
377
- ```javascript
378
- import WebScene from "@arcgis/core/WebScene.js";
379
-
380
- const scene = new WebScene({
381
- portalItem: { id: "EXISTING_WEBSCENE_ID" }
382
- });
383
-
384
- await scene.updateFrom(sceneView);
385
- await scene.saveAs({
386
- title: "My New WebScene",
387
- snippet: "3D scene description"
388
- });
389
- ```
390
-
391
- ## Bookmarks
392
-
393
- ### Bookmarks Component
394
- ```html
395
- <arcgis-map item-id="YOUR_WEBMAP_ID">
396
- <arcgis-expand slot="top-right" expanded>
397
- <arcgis-bookmarks
398
- drag-enabled
399
- show-add-bookmark-button
400
- show-edit-bookmark-button
401
- hide-time>
402
- </arcgis-bookmarks>
403
- </arcgis-expand>
404
- </arcgis-map>
405
-
406
- <script type="module">
407
- const bookmarks = document.querySelector("arcgis-bookmarks");
408
-
409
- bookmarks.addEventListener("arcgisSelect", (event) => {
410
- const bookmark = event.detail.bookmark;
411
- console.log("Selected bookmark:", bookmark.name);
412
- });
413
- </script>
414
- ```
415
-
416
- ### Bookmarks Widget (Core API)
417
- ```javascript
418
- import Bookmarks from "@arcgis/core/widgets/Bookmarks.js";
419
-
420
- const bookmarks = new Bookmarks({
421
- view: view,
422
- editingEnabled: true,
423
- visibleElements: {
424
- addBookmarkButton: true,
425
- editBookmarkButton: true,
426
- time: false
427
- }
428
- });
429
-
430
- view.ui.add(bookmarks, "top-right");
431
-
432
- // Listen for bookmark selection
433
- bookmarks.on("bookmark-select", (event) => {
434
- console.log("Selected:", event.bookmark.name);
435
- });
436
- ```
437
-
438
- ### Create Bookmarks Programmatically
439
- ```javascript
440
- import Bookmark from "@arcgis/core/webmap/Bookmark.js";
441
-
442
- // Create bookmark from current view
443
- const bookmark = new Bookmark({
444
- name: "My Location",
445
- viewpoint: view.viewpoint.clone()
446
- });
447
-
448
- // Add to map's bookmarks
449
- map.bookmarks.add(bookmark);
450
-
451
- // Go to bookmark
452
- view.goTo(bookmark.viewpoint);
453
- ```
454
-
455
- ### Bookmarks with Feature Effect
456
- ```javascript
457
- const bookmarks = document.querySelector("arcgis-bookmarks");
458
-
459
- bookmarks.addEventListener("arcgisSelect", (event) => {
460
- const bookmarkName = event.detail.bookmark.name.toUpperCase();
461
-
462
- layer.featureEffect = {
463
- filter: {
464
- where: `Name = '${bookmarkName}'`
465
- },
466
- excludedEffect: "grayscale(100%) opacity(30%)"
467
- };
468
- });
469
- ```
470
-
471
- ## WebScene Slides
472
-
473
- ### Slides Component Example
474
- ```html
475
- <arcgis-scene item-id="YOUR_WEBSCENE_ID">
476
- <arcgis-zoom slot="top-left"></arcgis-zoom>
477
- <calcite-panel slot="top-right" heading="Slides">
478
- <calcite-list id="slidesDiv"></calcite-list>
479
- </calcite-panel>
480
- </arcgis-scene>
481
-
482
- <script type="module">
483
- import Slide from "@arcgis/core/webscene/Slide.js";
484
-
485
- const viewElement = document.querySelector("arcgis-scene");
486
- await viewElement.viewOnReady();
487
-
488
- const slides = viewElement.map.presentation.slides;
489
-
490
- // Render existing slides
491
- slides.forEach(slide => createSlideUI(slide));
492
-
493
- function createSlideUI(slide) {
494
- const item = document.createElement("calcite-list-item");
495
- item.label = slide.title.text;
496
- item.innerHTML = `<img slot="content-start" src="${slide.thumbnail.url}">`;
497
-
498
- item.addEventListener("calciteListItemSelect", () => {
499
- slide.applyTo(viewElement.view, {
500
- maxDuration: 3000,
501
- easing: "in-out-coast-cubic"
502
- });
503
- });
504
-
505
- document.getElementById("slidesDiv").appendChild(item);
506
- }
507
- </script>
508
- ```
509
-
510
- ### Create Slide Programmatically
511
- ```javascript
512
- import Slide from "@arcgis/core/webscene/Slide.js";
513
-
514
- // Create slide from current view
515
- const slide = await Slide.createFrom(sceneView);
516
- slide.title.text = "My Slide";
517
-
518
- // Add to presentation
519
- scene.presentation.slides.add(slide);
520
- ```
521
-
522
- ### Apply Slide to View
523
- ```javascript
524
- const slide = scene.presentation.slides.getItemAt(0);
525
-
526
- slide.applyTo(sceneView, {
527
- maxDuration: 3000,
528
- easing: "in-out-coast-cubic"
529
- });
530
- ```
531
-
532
- ### Remove Slide
533
- ```javascript
534
- scene.presentation.slides.remove(slide);
535
- ```
536
-
537
- ## Portal Items
538
-
539
- ### Load Portal Item
540
- ```javascript
541
- import PortalItem from "@arcgis/core/portal/PortalItem.js";
542
-
543
- const item = new PortalItem({
544
- id: "ITEM_ID"
545
- });
546
-
547
- await item.load();
548
-
549
- console.log("Title:", item.title);
550
- console.log("Type:", item.type);
551
- console.log("Owner:", item.owner);
552
- console.log("Created:", item.created);
553
- ```
554
-
555
- ### Query Portal Items
556
- ```javascript
557
- import Portal from "@arcgis/core/portal/Portal.js";
558
- import PortalQueryParams from "@arcgis/core/portal/PortalQueryParams.js";
559
-
560
- const portal = new Portal({ authMode: "immediate" });
561
- await portal.load();
562
-
563
- const queryParams = new PortalQueryParams({
564
- query: `owner:${portal.user.username} type:"Web Map"`,
565
- sortField: "modified",
566
- sortOrder: "desc",
567
- num: 20
568
- });
569
-
570
- const result = await portal.queryItems(queryParams);
571
-
572
- result.results.forEach(item => {
573
- console.log(item.title, item.id);
574
- });
575
- ```
576
-
577
- ### Update Portal Item
578
- ```javascript
579
- const item = new PortalItem({ id: "ITEM_ID" });
580
- await item.load();
581
-
582
- item.title = "Updated Title";
583
- item.snippet = "Updated description";
584
- item.tags = ["new", "tags"];
585
-
586
- await item.update();
587
- ```
588
-
589
- ### Share Portal Item
590
- ```javascript
591
- await item.shareWith({
592
- everyone: false,
593
- org: true,
594
- groups: ["GROUP_ID_1", "GROUP_ID_2"]
595
- });
596
- ```
597
-
598
- ## Portal Groups
599
-
600
- ### Query Groups
601
- ```javascript
602
- import Portal from "@arcgis/core/portal/Portal.js";
603
-
604
- const portal = new Portal();
605
- await portal.load();
606
-
607
- const groups = await portal.queryGroups({
608
- query: "title:GIS"
609
- });
610
-
611
- groups.results.forEach(group => {
612
- console.log(group.title, group.id);
613
- });
614
- ```
615
-
616
- ### Query Group Content
617
- ```javascript
618
- const group = await portal.queryGroups({
619
- query: `id:GROUP_ID`
620
- });
621
-
622
- const content = await group.results[0].queryItems();
623
- content.results.forEach(item => {
624
- console.log(item.title);
625
- });
626
- ```
627
-
628
- ## Complete Example
629
-
630
- ```html
631
- <!DOCTYPE html>
632
- <html>
633
- <head>
634
- <script type="module" src="https://js.arcgis.com/calcite-components/3.3.3/calcite.esm.js"></script>
635
- <script src="https://js.arcgis.com/4.34/"></script>
636
- <script type="module" src="https://js.arcgis.com/4.34/map-components/"></script>
637
- <style>
638
- html, body { height: 100%; margin: 0; }
639
- </style>
640
- </head>
641
- <body>
642
- <arcgis-map item-id="YOUR_WEBMAP_ID">
643
- <arcgis-zoom slot="top-left"></arcgis-zoom>
644
- <arcgis-expand slot="top-right" expanded>
645
- <arcgis-bookmarks
646
- drag-enabled
647
- show-add-bookmark-button
648
- show-edit-bookmark-button>
649
- </arcgis-bookmarks>
650
- </arcgis-expand>
651
- <calcite-button slot="bottom-right" id="saveBtn">Save Map</calcite-button>
652
- </arcgis-map>
653
-
654
- <script type="module">
655
- const viewElement = document.querySelector("arcgis-map");
656
- await viewElement.viewOnReady();
657
-
658
- document.getElementById("saveBtn").onclick = async () => {
659
- await viewElement.map.updateFrom(viewElement.view);
660
- await viewElement.map.save();
661
- alert("Map saved!");
662
- };
663
- </script>
664
- </body>
665
- </html>
666
- ```
667
-
668
- ## Common Pitfalls
669
-
670
- 1. **Authentication required**: Saving requires user authentication
671
-
672
- 2. **updateFrom before save**: Always call `updateFrom(view)` before saving
673
-
674
- 3. **Portal URL**: Enterprise portals need explicit portal URL configuration
675
-
676
- 4. **Ownership**: Can only update items you own
677
-
678
- 5. **Slide thumbnails**: Generated automatically but may take time
679
-
1
+ ---
2
+ name: arcgis-portal-content
3
+ description: Manage portal content including saving WebMaps/WebScenes, bookmarks, slides, and portal items. Use for content persistence, WebMap/WebScene configuration, and navigation presets.
4
+ ---
5
+
6
+ # ArcGIS Portal Content
7
+
8
+ Use this skill for saving maps, managing bookmarks, slides, working with portal items, and configuring WebMap/WebScene structure.
9
+
10
+ ## WebMap Structure
11
+
12
+ ### WebMap Properties
13
+
14
+ ```javascript
15
+ import WebMap from "@arcgis/core/WebMap.js";
16
+
17
+ const webMap = new WebMap({
18
+ // Portal item reference
19
+ portalItem: {
20
+ id: "WEBMAP_ID",
21
+ portal: { url: "https://www.arcgis.com" }
22
+ },
23
+
24
+ // Or create from scratch
25
+ basemap: "topo-vector",
26
+ ground: "world-elevation",
27
+
28
+ // Layers
29
+ layers: [featureLayer, graphicsLayer],
30
+
31
+ // Tables (non-spatial)
32
+ tables: [tableLayer],
33
+
34
+ // Initial viewpoint
35
+ initialViewProperties: {
36
+ center: [-118.805, 34.027],
37
+ zoom: 13,
38
+ rotation: 0
39
+ },
40
+
41
+ // Bookmarks
42
+ bookmarks: [bookmark1, bookmark2],
43
+
44
+ // Application properties
45
+ applicationProperties: {
46
+ viewing: {
47
+ search: {
48
+ enabled: true,
49
+ hintText: "Search for places"
50
+ }
51
+ }
52
+ }
53
+ });
54
+ ```
55
+
56
+ ### WebMap from JSON
57
+
58
+ ```javascript
59
+ import WebMap from "@arcgis/core/WebMap.js";
60
+
61
+ // Create WebMap from JSON specification
62
+ const webMap = WebMap.fromJSON({
63
+ operationalLayers: [{
64
+ id: "layer1",
65
+ layerType: "ArcGISFeatureLayer",
66
+ url: "https://services.arcgis.com/.../FeatureServer/0",
67
+ title: "My Layer",
68
+ visibility: true,
69
+ opacity: 1
70
+ }],
71
+ baseMap: {
72
+ baseMapLayers: [{
73
+ id: "basemap",
74
+ layerType: "VectorTileLayer",
75
+ styleUrl: "https://basemaps-api.arcgis.com/arcgis/rest/services/styles/v2/styles/arcgis/topographic"
76
+ }],
77
+ title: "Topographic"
78
+ },
79
+ initialState: {
80
+ viewpoint: {
81
+ targetGeometry: {
82
+ xmin: -118.9, ymin: 33.8, xmax: -118.1, ymax: 34.3,
83
+ spatialReference: { wkid: 4326 }
84
+ }
85
+ }
86
+ },
87
+ version: "2.31"
88
+ });
89
+ ```
90
+
91
+ ### WebMap Initial State
92
+
93
+ ```javascript
94
+ const webMap = new WebMap({
95
+ basemap: "streets-vector",
96
+ initialViewProperties: {
97
+ // Viewpoint
98
+ viewpoint: {
99
+ targetGeometry: {
100
+ type: "extent",
101
+ xmin: -13050000, ymin: 3980000,
102
+ xmax: -13000000, ymax: 4050000,
103
+ spatialReference: { wkid: 102100 }
104
+ },
105
+ rotation: 45
106
+ },
107
+ // Or simpler
108
+ center: [-118.805, 34.027],
109
+ zoom: 12,
110
+ scale: 50000,
111
+
112
+ // Constraints
113
+ constraints: {
114
+ minZoom: 8,
115
+ maxZoom: 18,
116
+ minScale: 5000000,
117
+ maxScale: 1000,
118
+ rotationEnabled: false
119
+ },
120
+
121
+ // Time extent
122
+ timeExtent: {
123
+ start: new Date("2024-01-01"),
124
+ end: new Date("2024-12-31")
125
+ }
126
+ }
127
+ });
128
+ ```
129
+
130
+ ## WebScene Structure
131
+
132
+ ### WebScene Properties
133
+
134
+ ```javascript
135
+ import WebScene from "@arcgis/core/WebScene.js";
136
+
137
+ const webScene = new WebScene({
138
+ // Portal item
139
+ portalItem: { id: "WEBSCENE_ID" },
140
+
141
+ // Or create from scratch
142
+ basemap: "satellite",
143
+ ground: "world-elevation",
144
+
145
+ // Layers
146
+ layers: [sceneLayer, featureLayer],
147
+
148
+ // Initial viewpoint
149
+ initialViewProperties: {
150
+ viewpoint: {
151
+ camera: {
152
+ position: {
153
+ x: -118.805,
154
+ y: 34.027,
155
+ z: 1500,
156
+ spatialReference: { wkid: 4326 }
157
+ },
158
+ heading: 45,
159
+ tilt: 65
160
+ }
161
+ }
162
+ },
163
+
164
+ // Presentation (slides)
165
+ presentation: {
166
+ slides: [slide1, slide2]
167
+ },
168
+
169
+ // Clipping area (local scenes)
170
+ clippingArea: extent,
171
+ clippingEnabled: true
172
+ });
173
+ ```
174
+
175
+ ### WebScene Environment
176
+
177
+ ```javascript
178
+ const webScene = new WebScene({
179
+ basemap: "satellite",
180
+ ground: "world-elevation",
181
+
182
+ // Environment settings
183
+ environment: {
184
+ // Lighting
185
+ lighting: {
186
+ type: "sun", // sun, virtual
187
+ date: new Date("2024-06-21T12:00:00"),
188
+ directShadowsEnabled: true,
189
+ ambientOcclusionEnabled: true
190
+ },
191
+
192
+ // Atmosphere
193
+ atmosphere: {
194
+ quality: "high" // low, high
195
+ },
196
+
197
+ // Background
198
+ background: {
199
+ type: "color",
200
+ color: [0, 0, 0, 1]
201
+ },
202
+
203
+ // Stars
204
+ starsEnabled: true,
205
+
206
+ // Weather
207
+ weather: {
208
+ type: "sunny", // sunny, cloudy, rainy, snowy, foggy
209
+ cloudCover: 0.3
210
+ }
211
+ }
212
+ });
213
+ ```
214
+
215
+ ### WebScene Presentation
216
+
217
+ ```javascript
218
+ import Slide from "@arcgis/core/webscene/Slide.js";
219
+
220
+ // Access existing slides
221
+ const slides = webScene.presentation.slides;
222
+
223
+ // Create new slide
224
+ const slide = await Slide.createFrom(sceneView);
225
+ slide.title = { text: "Downtown View" };
226
+ slide.description = { text: "Overview of downtown area" };
227
+
228
+ // Slide properties captured
229
+ console.log(slide.viewpoint); // Camera position
230
+ console.log(slide.visibleLayers); // Layer visibility
231
+ console.log(slide.environment); // Environment settings
232
+ console.log(slide.thumbnail); // Auto-generated thumbnail
233
+
234
+ // Add to presentation
235
+ webScene.presentation.slides.add(slide);
236
+
237
+ // Reorder slides
238
+ webScene.presentation.slides.reorder(slide, 0);
239
+ ```
240
+
241
+ ### Local vs Global Scene
242
+
243
+ ```javascript
244
+ // Global scene (default)
245
+ const globalScene = new WebScene({
246
+ basemap: "satellite",
247
+ ground: "world-elevation",
248
+ viewingMode: "global"
249
+ });
250
+
251
+ // Local scene (with clipping)
252
+ const localScene = new WebScene({
253
+ basemap: "satellite",
254
+ ground: "world-elevation",
255
+ viewingMode: "local",
256
+ clippingArea: {
257
+ type: "extent",
258
+ xmin: -118.9, ymin: 33.8, xmax: -118.1, ymax: 34.3,
259
+ spatialReference: { wkid: 4326 }
260
+ },
261
+ clippingEnabled: true
262
+ });
263
+ ```
264
+
265
+ ## Application Properties
266
+
267
+ ### WebMap Application Properties
268
+
269
+ ```javascript
270
+ const webMap = new WebMap({
271
+ applicationProperties: {
272
+ // Viewing properties
273
+ viewing: {
274
+ // Search configuration
275
+ search: {
276
+ enabled: true,
277
+ disablePlaceFinder: false,
278
+ hintText: "Find address or place",
279
+ layers: [{
280
+ id: "search-layer",
281
+ field: { name: "Name", exactMatch: false }
282
+ }]
283
+ }
284
+ }
285
+ }
286
+ });
287
+
288
+ // Access application properties
289
+ const searchEnabled = webMap.applicationProperties?.viewing?.search?.enabled;
290
+ ```
291
+
292
+ ### WebScene Application Properties
293
+
294
+ ```javascript
295
+ const webScene = new WebScene({
296
+ applicationProperties: {
297
+ viewing: {
298
+ search: {
299
+ enabled: true
300
+ }
301
+ }
302
+ },
303
+
304
+ // Presentation settings
305
+ presentation: {
306
+ slides: [],
307
+ useViewFor: "slideshow" // slideshow, comparison
308
+ }
309
+ });
310
+ ```
311
+
312
+ ## Saving WebMaps
313
+
314
+ ### Save WebMap As New Item
315
+ ```javascript
316
+ import WebMap from "@arcgis/core/WebMap.js";
317
+
318
+ const map = new WebMap({
319
+ portalItem: { id: "EXISTING_WEBMAP_ID" }
320
+ });
321
+
322
+ // Update map properties from view before saving
323
+ await map.updateFrom(view);
324
+
325
+ // Save as new item
326
+ const item = {
327
+ title: "My New WebMap",
328
+ snippet: "Description of the map",
329
+ tags: ["tag1", "tag2"]
330
+ };
331
+
332
+ const savedItem = await map.saveAs(item);
333
+ console.log("Saved to:", savedItem.portal.url + "/home/item.html?id=" + savedItem.id);
334
+ ```
335
+
336
+ ### Save Existing WebMap
337
+ ```javascript
338
+ // Update and save existing webmap
339
+ await map.updateFrom(view);
340
+ await map.save();
341
+ console.log("WebMap saved");
342
+ ```
343
+
344
+ ### Map Component Save Example
345
+ ```html
346
+ <arcgis-map>
347
+ <arcgis-zoom slot="top-left"></arcgis-zoom>
348
+ <calcite-panel slot="top-right">
349
+ <calcite-input id="webMapTitle" value="My WebMap"></calcite-input>
350
+ <calcite-button id="saveWebMap">Save</calcite-button>
351
+ </calcite-panel>
352
+ </arcgis-map>
353
+
354
+ <script type="module">
355
+ import WebMap from "@arcgis/core/WebMap.js";
356
+
357
+ const viewElement = document.querySelector("arcgis-map");
358
+ const map = new WebMap({ portalItem: { id: "YOUR_WEBMAP_ID" } });
359
+ viewElement.map = map;
360
+
361
+ await viewElement.viewOnReady();
362
+
363
+ document.getElementById("saveWebMap").onclick = async () => {
364
+ const title = document.getElementById("webMapTitle").value;
365
+
366
+ await map.updateFrom(viewElement.view);
367
+ const item = await map.saveAs({ title });
368
+
369
+ alert(`Saved as: ${item.id}`);
370
+ };
371
+ </script>
372
+ ```
373
+
374
+ ## Saving WebScenes
375
+
376
+ ### Save WebScene
377
+ ```javascript
378
+ import WebScene from "@arcgis/core/WebScene.js";
379
+
380
+ const scene = new WebScene({
381
+ portalItem: { id: "EXISTING_WEBSCENE_ID" }
382
+ });
383
+
384
+ await scene.updateFrom(sceneView);
385
+ await scene.saveAs({
386
+ title: "My New WebScene",
387
+ snippet: "3D scene description"
388
+ });
389
+ ```
390
+
391
+ ## Bookmarks
392
+
393
+ ### Bookmarks Component
394
+ ```html
395
+ <arcgis-map item-id="YOUR_WEBMAP_ID">
396
+ <arcgis-expand slot="top-right" expanded>
397
+ <arcgis-bookmarks
398
+ drag-enabled
399
+ show-add-bookmark-button
400
+ show-edit-bookmark-button
401
+ hide-time>
402
+ </arcgis-bookmarks>
403
+ </arcgis-expand>
404
+ </arcgis-map>
405
+
406
+ <script type="module">
407
+ const bookmarks = document.querySelector("arcgis-bookmarks");
408
+
409
+ bookmarks.addEventListener("arcgisSelect", (event) => {
410
+ const bookmark = event.detail.bookmark;
411
+ console.log("Selected bookmark:", bookmark.name);
412
+ });
413
+ </script>
414
+ ```
415
+
416
+ ### Bookmarks Widget (Core API)
417
+ ```javascript
418
+ import Bookmarks from "@arcgis/core/widgets/Bookmarks.js";
419
+
420
+ const bookmarks = new Bookmarks({
421
+ view: view,
422
+ editingEnabled: true,
423
+ visibleElements: {
424
+ addBookmarkButton: true,
425
+ editBookmarkButton: true,
426
+ time: false
427
+ }
428
+ });
429
+
430
+ view.ui.add(bookmarks, "top-right");
431
+
432
+ // Listen for bookmark selection
433
+ bookmarks.on("bookmark-select", (event) => {
434
+ console.log("Selected:", event.bookmark.name);
435
+ });
436
+ ```
437
+
438
+ ### Create Bookmarks Programmatically
439
+ ```javascript
440
+ import Bookmark from "@arcgis/core/webmap/Bookmark.js";
441
+
442
+ // Create bookmark from current view
443
+ const bookmark = new Bookmark({
444
+ name: "My Location",
445
+ viewpoint: view.viewpoint.clone()
446
+ });
447
+
448
+ // Add to map's bookmarks
449
+ map.bookmarks.add(bookmark);
450
+
451
+ // Go to bookmark
452
+ view.goTo(bookmark.viewpoint);
453
+ ```
454
+
455
+ ### Bookmarks with Feature Effect
456
+ ```javascript
457
+ const bookmarks = document.querySelector("arcgis-bookmarks");
458
+
459
+ bookmarks.addEventListener("arcgisSelect", (event) => {
460
+ const bookmarkName = event.detail.bookmark.name.toUpperCase();
461
+
462
+ layer.featureEffect = {
463
+ filter: {
464
+ where: `Name = '${bookmarkName}'`
465
+ },
466
+ excludedEffect: "grayscale(100%) opacity(30%)"
467
+ };
468
+ });
469
+ ```
470
+
471
+ ## WebScene Slides
472
+
473
+ ### Slides Component Example
474
+ ```html
475
+ <arcgis-scene item-id="YOUR_WEBSCENE_ID">
476
+ <arcgis-zoom slot="top-left"></arcgis-zoom>
477
+ <calcite-panel slot="top-right" heading="Slides">
478
+ <calcite-list id="slidesDiv"></calcite-list>
479
+ </calcite-panel>
480
+ </arcgis-scene>
481
+
482
+ <script type="module">
483
+ import Slide from "@arcgis/core/webscene/Slide.js";
484
+
485
+ const viewElement = document.querySelector("arcgis-scene");
486
+ await viewElement.viewOnReady();
487
+
488
+ const slides = viewElement.map.presentation.slides;
489
+
490
+ // Render existing slides
491
+ slides.forEach(slide => createSlideUI(slide));
492
+
493
+ function createSlideUI(slide) {
494
+ const item = document.createElement("calcite-list-item");
495
+ item.label = slide.title.text;
496
+ item.innerHTML = `<img slot="content-start" src="${slide.thumbnail.url}">`;
497
+
498
+ item.addEventListener("calciteListItemSelect", () => {
499
+ slide.applyTo(viewElement.view, {
500
+ maxDuration: 3000,
501
+ easing: "in-out-coast-cubic"
502
+ });
503
+ });
504
+
505
+ document.getElementById("slidesDiv").appendChild(item);
506
+ }
507
+ </script>
508
+ ```
509
+
510
+ ### Create Slide Programmatically
511
+ ```javascript
512
+ import Slide from "@arcgis/core/webscene/Slide.js";
513
+
514
+ // Create slide from current view
515
+ const slide = await Slide.createFrom(sceneView);
516
+ slide.title.text = "My Slide";
517
+
518
+ // Add to presentation
519
+ scene.presentation.slides.add(slide);
520
+ ```
521
+
522
+ ### Apply Slide to View
523
+ ```javascript
524
+ const slide = scene.presentation.slides.getItemAt(0);
525
+
526
+ slide.applyTo(sceneView, {
527
+ maxDuration: 3000,
528
+ easing: "in-out-coast-cubic"
529
+ });
530
+ ```
531
+
532
+ ### Remove Slide
533
+ ```javascript
534
+ scene.presentation.slides.remove(slide);
535
+ ```
536
+
537
+ ## Portal Items
538
+
539
+ ### Load Portal Item
540
+ ```javascript
541
+ import PortalItem from "@arcgis/core/portal/PortalItem.js";
542
+
543
+ const item = new PortalItem({
544
+ id: "ITEM_ID"
545
+ });
546
+
547
+ await item.load();
548
+
549
+ console.log("Title:", item.title);
550
+ console.log("Type:", item.type);
551
+ console.log("Owner:", item.owner);
552
+ console.log("Created:", item.created);
553
+ ```
554
+
555
+ ### Query Portal Items
556
+ ```javascript
557
+ import Portal from "@arcgis/core/portal/Portal.js";
558
+ import PortalQueryParams from "@arcgis/core/portal/PortalQueryParams.js";
559
+
560
+ const portal = new Portal({ authMode: "immediate" });
561
+ await portal.load();
562
+
563
+ const queryParams = new PortalQueryParams({
564
+ query: `owner:${portal.user.username} type:"Web Map"`,
565
+ sortField: "modified",
566
+ sortOrder: "desc",
567
+ num: 20
568
+ });
569
+
570
+ const result = await portal.queryItems(queryParams);
571
+
572
+ result.results.forEach(item => {
573
+ console.log(item.title, item.id);
574
+ });
575
+ ```
576
+
577
+ ### Update Portal Item
578
+ ```javascript
579
+ const item = new PortalItem({ id: "ITEM_ID" });
580
+ await item.load();
581
+
582
+ item.title = "Updated Title";
583
+ item.snippet = "Updated description";
584
+ item.tags = ["new", "tags"];
585
+
586
+ await item.update();
587
+ ```
588
+
589
+ ### Share Portal Item
590
+ ```javascript
591
+ await item.shareWith({
592
+ everyone: false,
593
+ org: true,
594
+ groups: ["GROUP_ID_1", "GROUP_ID_2"]
595
+ });
596
+ ```
597
+
598
+ ## Portal Groups
599
+
600
+ ### Query Groups
601
+ ```javascript
602
+ import Portal from "@arcgis/core/portal/Portal.js";
603
+
604
+ const portal = new Portal();
605
+ await portal.load();
606
+
607
+ const groups = await portal.queryGroups({
608
+ query: "title:GIS"
609
+ });
610
+
611
+ groups.results.forEach(group => {
612
+ console.log(group.title, group.id);
613
+ });
614
+ ```
615
+
616
+ ### Query Group Content
617
+ ```javascript
618
+ const group = await portal.queryGroups({
619
+ query: `id:GROUP_ID`
620
+ });
621
+
622
+ const content = await group.results[0].queryItems();
623
+ content.results.forEach(item => {
624
+ console.log(item.title);
625
+ });
626
+ ```
627
+
628
+ ## Complete Example
629
+
630
+ ```html
631
+ <!DOCTYPE html>
632
+ <html>
633
+ <head>
634
+ <script type="module" src="https://js.arcgis.com/calcite-components/3.3.3/calcite.esm.js"></script>
635
+ <script src="https://js.arcgis.com/4.34/"></script>
636
+ <script type="module" src="https://js.arcgis.com/4.34/map-components/"></script>
637
+ <style>
638
+ html, body { height: 100%; margin: 0; }
639
+ </style>
640
+ </head>
641
+ <body>
642
+ <arcgis-map item-id="YOUR_WEBMAP_ID">
643
+ <arcgis-zoom slot="top-left"></arcgis-zoom>
644
+ <arcgis-expand slot="top-right" expanded>
645
+ <arcgis-bookmarks
646
+ drag-enabled
647
+ show-add-bookmark-button
648
+ show-edit-bookmark-button>
649
+ </arcgis-bookmarks>
650
+ </arcgis-expand>
651
+ <calcite-button slot="bottom-right" id="saveBtn">Save Map</calcite-button>
652
+ </arcgis-map>
653
+
654
+ <script type="module">
655
+ const viewElement = document.querySelector("arcgis-map");
656
+ await viewElement.viewOnReady();
657
+
658
+ document.getElementById("saveBtn").onclick = async () => {
659
+ await viewElement.map.updateFrom(viewElement.view);
660
+ await viewElement.map.save();
661
+ alert("Map saved!");
662
+ };
663
+ </script>
664
+ </body>
665
+ </html>
666
+ ```
667
+
668
+ ## Common Pitfalls
669
+
670
+ 1. **Authentication required**: Saving requires user authentication
671
+
672
+ 2. **updateFrom before save**: Always call `updateFrom(view)` before saving
673
+
674
+ 3. **Portal URL**: Enterprise portals need explicit portal URL configuration
675
+
676
+ 4. **Ownership**: Can only update items you own
677
+
678
+ 5. **Slide thumbnails**: Generated automatically but may take time
679
+