@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.
Files changed (50) hide show
  1. package/README.md +163 -201
  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/skills/arcgis-starter-app/SKILL.md +273 -0
  25. package/contexts/4.34/skills/arcgis-starter-app-extended/SKILL.md +649 -0
  26. package/contexts/4.34/{claude → skills}/arcgis-tables-forms/SKILL.md +877 -877
  27. package/contexts/4.34/{claude → skills}/arcgis-time-animation/SKILL.md +722 -722
  28. package/contexts/4.34/{claude → skills}/arcgis-utility-networks/SKILL.md +301 -301
  29. package/contexts/4.34/{claude → skills}/arcgis-visualization/SKILL.md +580 -580
  30. package/contexts/4.34/{claude → skills}/arcgis-widgets-ui/SKILL.md +574 -574
  31. package/lib/installer.js +294 -379
  32. package/package.json +45 -45
  33. package/contexts/4.34/copilot/arcgis-3d.instructions.md +0 -267
  34. package/contexts/4.34/copilot/arcgis-analysis.instructions.md +0 -294
  35. package/contexts/4.34/copilot/arcgis-arcade.instructions.md +0 -234
  36. package/contexts/4.34/copilot/arcgis-authentication.instructions.md +0 -187
  37. package/contexts/4.34/copilot/arcgis-cim-symbols.instructions.md +0 -177
  38. package/contexts/4.34/copilot/arcgis-core-maps.instructions.md +0 -246
  39. package/contexts/4.34/copilot/arcgis-core-utilities.instructions.md +0 -247
  40. package/contexts/4.34/copilot/arcgis-editing.instructions.md +0 -262
  41. package/contexts/4.34/copilot/arcgis-geometry.instructions.md +0 -225
  42. package/contexts/4.34/copilot/arcgis-layers.instructions.md +0 -278
  43. package/contexts/4.34/copilot/arcgis-popup-templates.instructions.md +0 -266
  44. package/contexts/4.34/copilot/arcgis-portal-advanced.instructions.md +0 -275
  45. package/contexts/4.34/copilot/arcgis-smart-mapping.instructions.md +0 -184
  46. package/contexts/4.34/copilot/arcgis-time-animation.instructions.md +0 -112
  47. package/contexts/4.34/copilot/arcgis-visualization.instructions.md +0 -321
  48. package/contexts/4.34/copilot/arcgis-widgets-ui.instructions.md +0 -277
  49. /package/contexts/4.34/{claude → skills}/arcgis-arcade/SKILL.md +0 -0
  50. /package/contexts/4.34/{claude → skills}/arcgis-popup-templates/SKILL.md +0 -0
@@ -1,246 +0,0 @@
1
- ---
2
- applyTo: "**/*.{js,ts,jsx,tsx,html}"
3
- ---
4
-
5
- # ArcGIS Maps SDK - Core Maps & Views
6
-
7
- ## SDK Version
8
- Use ArcGIS Maps SDK for JavaScript version 4.x (currently 4.34).
9
-
10
- ## Import Patterns
11
-
12
- ### Direct ESM Imports (Recommended for Build Tools)
13
- ```javascript
14
- import Map from "@arcgis/core/Map.js";
15
- import MapView from "@arcgis/core/views/MapView.js";
16
- import SceneView from "@arcgis/core/views/SceneView.js";
17
- import WebMap from "@arcgis/core/WebMap.js";
18
- import WebScene from "@arcgis/core/WebScene.js";
19
- ```
20
-
21
- ### Dynamic Imports (CDN / No Build Tools)
22
- ```javascript
23
- const Map = await $arcgis.import("@arcgis/core/Map.js");
24
- const MapView = await $arcgis.import("@arcgis/core/views/MapView.js");
25
- ```
26
-
27
- ## Two Approaches: Map Components vs Core API
28
-
29
- ### Map Components (Modern - Recommended)
30
- ```html
31
- <arcgis-map basemap="topo-vector" center="-118.24,34.05" zoom="12">
32
- <arcgis-zoom slot="top-left"></arcgis-zoom>
33
- <arcgis-compass slot="top-left"></arcgis-compass>
34
- </arcgis-map>
35
-
36
- <script type="module">
37
- const mapElement = document.querySelector("arcgis-map");
38
- await mapElement.viewOnReady();
39
- const view = mapElement.view;
40
- const map = mapElement.map;
41
- </script>
42
- ```
43
-
44
- ### Core API
45
- ```javascript
46
- import Map from "@arcgis/core/Map.js";
47
- import MapView from "@arcgis/core/views/MapView.js";
48
-
49
- const map = new Map({ basemap: "topo-vector" });
50
-
51
- const view = new MapView({
52
- container: "viewDiv",
53
- map: map,
54
- center: [-118.24, 34.05], // [longitude, latitude]
55
- zoom: 12
56
- });
57
- ```
58
-
59
- ## CDN Setup
60
-
61
- ### Map Components
62
- ```html
63
- <script type="module" src="https://js.arcgis.com/calcite-components/3.3.3/calcite.esm.js"></script>
64
- <script src="https://js.arcgis.com/4.34/"></script>
65
- <script type="module" src="https://js.arcgis.com/4.34/map-components/"></script>
66
- ```
67
-
68
- ### Core API (requires CSS)
69
- ```html
70
- <link rel="stylesheet" href="https://js.arcgis.com/4.34/esri/themes/light/main.css" />
71
- <script src="https://js.arcgis.com/4.34/"></script>
72
- ```
73
-
74
- ## 2D Maps
75
-
76
- ```javascript
77
- const map = new Map({ basemap: "streets-vector" });
78
-
79
- const view = new MapView({
80
- container: "viewDiv",
81
- map: map,
82
- center: [-118.24, 34.05],
83
- zoom: 12,
84
- constraints: {
85
- minZoom: 5,
86
- maxZoom: 18,
87
- rotationEnabled: false
88
- }
89
- });
90
- ```
91
-
92
- ## 3D Scenes
93
-
94
- ```javascript
95
- import SceneView from "@arcgis/core/views/SceneView.js";
96
-
97
- const map = new Map({
98
- basemap: "topo-3d",
99
- ground: "world-elevation"
100
- });
101
-
102
- const view = new SceneView({
103
- container: "viewDiv",
104
- map: map,
105
- camera: {
106
- position: {
107
- longitude: -118.24,
108
- latitude: 34.05,
109
- z: 25000
110
- },
111
- heading: 0,
112
- tilt: 45
113
- }
114
- });
115
- ```
116
-
117
- ## Loading WebMaps and WebScenes
118
-
119
- ```javascript
120
- import WebMap from "@arcgis/core/WebMap.js";
121
- import WebScene from "@arcgis/core/WebScene.js";
122
-
123
- // WebMap
124
- const webmap = new WebMap({
125
- portalItem: { id: "f2e9b762544945f390ca4ac3671cfa72" }
126
- });
127
-
128
- // WebScene
129
- const webscene = new WebScene({
130
- portalItem: { id: "YOUR_WEBSCENE_ID" }
131
- });
132
- ```
133
-
134
- ## Navigation
135
-
136
- ```javascript
137
- // Go to location
138
- await view.goTo({
139
- center: [-118.24, 34.05],
140
- zoom: 15
141
- });
142
-
143
- // Animated navigation
144
- await view.goTo(
145
- { center: [-118.24, 34.05], zoom: 15 },
146
- { duration: 2000, easing: "ease-in-out" }
147
- );
148
-
149
- // Go to extent or features
150
- await view.goTo(layer.fullExtent);
151
- await view.goTo(featureSet.features);
152
- ```
153
-
154
- ## View Constraints
155
-
156
- ```javascript
157
- view.constraints = {
158
- minZoom: 5,
159
- maxZoom: 18,
160
- geometry: layer.fullExtent,
161
- rotationEnabled: false
162
- };
163
- ```
164
-
165
- ## Event Handling
166
-
167
- ```javascript
168
- // View ready
169
- view.when(() => console.log("View is ready"));
170
-
171
- // Click event
172
- view.on("click", (event) => {
173
- console.log("Clicked at:", event.mapPoint);
174
- });
175
-
176
- // Pointer move
177
- view.on("pointer-move", (event) => {
178
- const point = view.toMap(event);
179
- });
180
-
181
- // Watch properties
182
- view.watch("extent", (extent) => console.log("Extent changed"));
183
- view.watch("stationary", (isStationary) => {
184
- if (isStationary) console.log("Navigation complete");
185
- });
186
- ```
187
-
188
- ## Common Basemaps
189
-
190
- | ID | Description |
191
- |----|-------------|
192
- | `streets-vector` | Street map |
193
- | `topo-vector` | Topographic |
194
- | `satellite` | Satellite imagery |
195
- | `hybrid` | Satellite with labels |
196
- | `dark-gray-vector` | Dark gray canvas |
197
- | `gray-vector` | Light gray canvas |
198
- | `topo-3d` | 3D topographic |
199
-
200
- ## reactiveUtils (Property Watching)
201
-
202
- ```javascript
203
- import reactiveUtils from "@arcgis/core/core/reactiveUtils.js";
204
-
205
- reactiveUtils.watch(
206
- () => view.scale,
207
- (scale) => console.log("Scale:", scale)
208
- );
209
-
210
- reactiveUtils.when(
211
- () => layer.loaded,
212
- () => console.log("Layer loaded")
213
- );
214
- ```
215
-
216
- ## Autocasting vs Explicit Classes
217
-
218
- ### Use Autocasting for Configuration
219
- ```javascript
220
- layer.renderer = {
221
- type: "simple",
222
- symbol: { type: "simple-marker", color: "red" }
223
- };
224
- ```
225
-
226
- ### Use Explicit Classes for Instance Methods
227
- ```javascript
228
- import SimpleRenderer from "@arcgis/core/renderers/SimpleRenderer.js";
229
- const renderer = new SimpleRenderer({ ... });
230
- ```
231
-
232
- ### TypeScript: Use `as const`
233
- ```typescript
234
- layer.renderer = {
235
- type: "simple",
236
- symbol: { type: "simple-marker", color: "red" }
237
- } as const;
238
- ```
239
-
240
- ## Common Pitfalls
241
-
242
- 1. **Missing CSS for Core API** - Always include main.css
243
- 2. **Not awaiting viewOnReady()** - Wait before accessing view properties
244
- 3. **Coordinate order** - ArcGIS uses [longitude, latitude], not [lat, lon]
245
- 4. **Missing container height** - Ensure `#viewDiv { height: 100%; }`
246
- 5. **Script type** - Use `type="module"` for async/await
@@ -1,247 +0,0 @@
1
- ---
2
- applyTo: "**/*.{js,ts,jsx,tsx,html}"
3
- ---
4
-
5
- # ArcGIS Maps SDK - Core Utilities & Interaction
6
-
7
- ## reactiveUtils (Property Watching)
8
-
9
- ```javascript
10
- import reactiveUtils from "@arcgis/core/core/reactiveUtils.js";
11
-
12
- // Watch property
13
- const handle = reactiveUtils.watch(
14
- () => view.scale,
15
- (scale) => console.log("Scale:", scale)
16
- );
17
-
18
- // Watch with initial value
19
- reactiveUtils.watch(
20
- () => view.extent,
21
- (extent) => console.log("Extent:", extent),
22
- { initial: true }
23
- );
24
-
25
- // Wait for condition
26
- await reactiveUtils.when(() => view.ready);
27
-
28
- // One-time watch
29
- await reactiveUtils.once(() => layer.loaded);
30
-
31
- // Watch multiple
32
- reactiveUtils.watch(
33
- () => [view.center, view.zoom],
34
- ([center, zoom]) => console.log(center, zoom)
35
- );
36
-
37
- // Stop watching
38
- handle.remove();
39
- ```
40
-
41
- ## Handles (Cleanup)
42
-
43
- ```javascript
44
- import Handles from "@arcgis/core/core/Handles.js";
45
-
46
- const handles = new Handles();
47
-
48
- handles.add(reactiveUtils.watch(() => view.scale, () => {}));
49
- handles.add(view.on("click", () => {}), "click-group");
50
-
51
- // Remove group
52
- handles.remove("click-group");
53
-
54
- // Remove all
55
- handles.removeAll();
56
- handles.destroy();
57
- ```
58
-
59
- ## promiseUtils
60
-
61
- ```javascript
62
- import promiseUtils from "@arcgis/core/core/promiseUtils.js";
63
-
64
- // Debounce
65
- const debouncedSearch = promiseUtils.debounce(async (query) => {
66
- return await searchService.search(query);
67
- });
68
-
69
- // Throttle
70
- const throttledUpdate = promiseUtils.throttle(async (extent) => {
71
- await updateDisplay(extent);
72
- }, 100);
73
-
74
- // Check abort error
75
- try {
76
- await debouncedSearch(query);
77
- } catch (e) {
78
- if (!promiseUtils.isAbortError(e)) throw e;
79
- }
80
-
81
- // Wait for all (regardless of success)
82
- const results = await promiseUtils.eachAlways([promise1, promise2]);
83
- results.forEach(r => console.log(r.error || r.value));
84
- ```
85
-
86
- ## Collection
87
-
88
- ```javascript
89
- import Collection from "@arcgis/core/core/Collection.js";
90
-
91
- const collection = new Collection([item1, item2]);
92
-
93
- // Mutate
94
- collection.add(item);
95
- collection.addMany([item3, item4]);
96
- collection.remove(item);
97
- collection.removeAt(0);
98
- collection.removeAll();
99
- collection.reorder(item, 0);
100
-
101
- // Query
102
- const found = collection.find(item => item.id === 3);
103
- const filtered = collection.filter(item => item.active);
104
- const mapped = collection.map(item => item.name);
105
-
106
- // Events
107
- collection.on("change", (e) => {
108
- console.log("Added:", e.added, "Removed:", e.removed);
109
- });
110
- ```
111
-
112
- ## Hit Testing
113
-
114
- ```javascript
115
- view.on("click", async (event) => {
116
- const response = await view.hitTest(event);
117
- if (response.results.length > 0) {
118
- const graphic = response.results[0].graphic;
119
- console.log("Clicked:", graphic.attributes);
120
- }
121
- });
122
-
123
- // Filter by layer
124
- const response = await view.hitTest(event, {
125
- include: [featureLayer],
126
- exclude: [graphicsLayer]
127
- });
128
- ```
129
-
130
- ## Highlighting
131
-
132
- ```javascript
133
- const layerView = await view.whenLayerView(featureLayer);
134
-
135
- // Highlight
136
- const highlight = layerView.highlight(graphic);
137
- const highlight = layerView.highlight([graphic1, graphic2]);
138
- const highlight = layerView.highlight([objectId1, objectId2]);
139
-
140
- // Remove highlight
141
- highlight.remove();
142
-
143
- // Options
144
- layerView.highlightOptions = {
145
- color: [255, 255, 0, 1],
146
- haloOpacity: 0.9,
147
- fillOpacity: 0.2
148
- };
149
- ```
150
-
151
- ## View Events
152
-
153
- ```javascript
154
- // Click
155
- view.on("click", (event) => {
156
- console.log("Map point:", event.mapPoint);
157
- console.log("Screen:", event.x, event.y);
158
- });
159
-
160
- // Double-click
161
- view.on("double-click", (event) => {
162
- event.stopPropagation(); // Prevent zoom
163
- });
164
-
165
- // Pointer move
166
- view.on("pointer-move", (event) => {
167
- const point = view.toMap(event);
168
- });
169
-
170
- // Key events
171
- view.on("key-down", (event) => {
172
- if (event.key === "Escape") { }
173
- });
174
-
175
- // Stationary (navigation complete)
176
- view.watch("stationary", (isStationary) => {
177
- if (isStationary) console.log("Navigation done");
178
- });
179
- ```
180
-
181
- ## Coordinate Conversion
182
-
183
- ```javascript
184
- // Screen to map
185
- const mapPoint = view.toMap({ x: screenX, y: screenY });
186
-
187
- // Map to screen
188
- const screenPoint = view.toScreen(mapPoint);
189
- ```
190
-
191
- ## Units
192
-
193
- ```javascript
194
- import units from "@arcgis/core/core/units.js";
195
-
196
- const meters = units.convertUnit(100, "feet", "meters");
197
- const sqKm = units.convertUnit(1000, "acres", "square-kilometers");
198
- ```
199
-
200
- ## Scheduling
201
-
202
- ```javascript
203
- import scheduling from "@arcgis/core/core/scheduling.js";
204
-
205
- const handle = scheduling.addFrameTask({
206
- update: (event) => {
207
- console.log("Delta:", event.deltaTime);
208
- }
209
- });
210
-
211
- handle.remove();
212
- ```
213
-
214
- ## Workers (Background Processing)
215
-
216
- ```javascript
217
- import workers from "@arcgis/core/core/workers.js";
218
-
219
- const connection = await workers.open("path/to/worker.js");
220
- const result = await connection.invoke("methodName", { data: "params" });
221
- connection.close();
222
- ```
223
-
224
- ## Accessor (Custom Classes)
225
-
226
- ```javascript
227
- import Accessor from "@arcgis/core/core/Accessor.js";
228
- import { subclass, property } from "@arcgis/core/core/accessorSupport/decorators.js";
229
-
230
- @subclass("myapp.CustomClass")
231
- class CustomClass extends Accessor {
232
- @property()
233
- name = "default";
234
-
235
- @property({ readOnly: true, dependsOn: ["name"] })
236
- get displayName() {
237
- return this.name.toUpperCase();
238
- }
239
- }
240
- ```
241
-
242
- ## Common Pitfalls
243
-
244
- 1. **Memory leaks** - Always remove handles when done
245
- 2. **Initial value** - Use `{ initial: true }` for immediate callback
246
- 3. **Abort errors** - Check with `promiseUtils.isAbortError()`
247
- 4. **Sync vs async** - Default is async batching, `{ sync: true }` for immediate