@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,234 +0,0 @@
1
- ---
2
- applyTo: "**/*.{js,ts,jsx,tsx,html}"
3
- ---
4
-
5
- # ArcGIS Maps SDK - Arcade Expressions
6
-
7
- ## Arcade Basics
8
-
9
- Arcade is used for:
10
- - Dynamic popup content
11
- - Data-driven rendering
12
- - Custom labels
13
- - Field calculations
14
- - Form validation
15
-
16
- ### Basic Syntax
17
- ```arcade
18
- var population = $feature.population;
19
- var area = $feature.area_sqkm;
20
- var density = population / area;
21
- return Round(density, 2);
22
- ```
23
-
24
- ## Arcade in PopupTemplates
25
-
26
- ```javascript
27
- layer.popupTemplate = {
28
- title: "{name}",
29
- expressionInfos: [
30
- {
31
- name: "density",
32
- title: "Population Density",
33
- expression: "Round($feature.population / $feature.area, 2)"
34
- }
35
- ],
36
- content: "Density: {expression/density} people/km²"
37
- };
38
- ```
39
-
40
- ## Arcade in Renderers
41
-
42
- ```javascript
43
- layer.renderer = {
44
- type: "unique-value",
45
- valueExpression: `
46
- if ($feature.value > 100) {
47
- return "High";
48
- } else {
49
- return "Low";
50
- }
51
- `,
52
- uniqueValueInfos: [
53
- { value: "High", symbol: { type: "simple-fill", color: "red" } },
54
- { value: "Low", symbol: { type: "simple-fill", color: "blue" } }
55
- ]
56
- };
57
- ```
58
-
59
- ### Visual Variable Expression
60
- ```javascript
61
- visualVariables: [{
62
- type: "size",
63
- valueExpression: "Sqrt($feature.population) * 0.1",
64
- stops: [
65
- { value: 10, size: 4 },
66
- { value: 100, size: 40 }
67
- ]
68
- }]
69
- ```
70
-
71
- ## Arcade in Labels
72
-
73
- ```javascript
74
- layer.labelingInfo = [{
75
- symbol: { type: "text", color: "black", font: { size: 10 } },
76
- labelExpressionInfo: {
77
- expression: `
78
- var pop = $feature.population;
79
- if (pop > 1000000) {
80
- return $feature.name + " (" + Round(pop/1000000, 1) + "M)";
81
- }
82
- return $feature.name;
83
- `
84
- }
85
- }];
86
- ```
87
-
88
- ## Math Functions
89
-
90
- ```arcade
91
- Round(3.14159, 2) // 3.14
92
- Floor(3.9) // 3
93
- Ceil(3.1) // 4
94
- Abs(-5) // 5
95
- Sqrt(16) // 4
96
- Pow(2, 3) // 8
97
- Min(1, 2, 3) // 1
98
- Max(1, 2, 3) // 3
99
- Sum([1, 2, 3]) // 6
100
- Mean([1, 2, 3]) // 2
101
- ```
102
-
103
- ## Text Functions
104
-
105
- ```arcade
106
- Upper("hello") // "HELLO"
107
- Lower("HELLO") // "hello"
108
- Trim(" hello ") // "hello"
109
- Left("hello", 2) // "he"
110
- Right("hello", 2) // "lo"
111
- Find("l", "hello") // 2
112
- Replace("hello", "l", "L") // "heLLo"
113
- Split("a,b,c", ",") // ["a", "b", "c"]
114
- Concatenate(["a", "b"]) // "ab"
115
- ```
116
-
117
- ## Date Functions
118
-
119
- ```arcade
120
- Now() // Current date/time
121
- Today() // Current date
122
- Year($feature.date_field) // Extract year
123
- Month($feature.date_field) // Extract month
124
- Day($feature.date_field) // Extract day
125
- DateDiff(Now(), $feature.date, "days") // Days between
126
- Text($feature.date, "MMMM D, YYYY") // Format date
127
- ```
128
-
129
- ## Geometry Functions
130
-
131
- ```arcade
132
- Area($feature, "square-kilometers")
133
- Length($feature, "kilometers")
134
- Centroid($feature)
135
- Buffer($feature, 100, "meters")
136
- Intersects($feature, $otherFeature)
137
- Contains($feature, $point)
138
- ```
139
-
140
- ## Conditional Functions
141
-
142
- ```arcade
143
- // IIf (inline if)
144
- IIf($feature.value > 100, "High", "Low")
145
-
146
- // When (multiple conditions)
147
- When(
148
- $feature.type == "A", "Type A",
149
- $feature.type == "B", "Type B",
150
- "Other"
151
- )
152
-
153
- // Decode (value matching)
154
- Decode($feature.code,
155
- 1, "One",
156
- 2, "Two",
157
- "Unknown"
158
- )
159
- ```
160
-
161
- ## Array Functions
162
-
163
- ```arcade
164
- var arr = [1, 2, 3, 4, 5];
165
- Count(arr) // 5
166
- First(arr) // 1
167
- Last(arr) // 5
168
- IndexOf(arr, 3) // 2
169
- Includes(arr, 3) // true
170
- Push(arr, 6) // adds 6
171
- Reverse(arr) // reverses
172
- Sort(arr) // sorts
173
- Slice(arr, 1, 3) // [2, 3]
174
- ```
175
-
176
- ## Feature Access
177
-
178
- ```arcade
179
- // Current feature
180
- $feature.fieldName
181
-
182
- // All features in layer
183
- var allFeatures = FeatureSet($layer);
184
- var filtered = Filter(allFeatures, "type = 'A'");
185
- var total = Sum(filtered, "value");
186
-
187
- // Related records
188
- var related = FeatureSetByRelationshipName($feature, "relationshipName");
189
-
190
- // Global variables
191
- $map, $view, $datastore
192
- ```
193
-
194
- ## Execute Programmatically
195
-
196
- ```javascript
197
- import Arcade from "@arcgis/core/arcade/Arcade.js";
198
-
199
- const profile = {
200
- variables: [{ name: "$feature", type: "feature" }]
201
- };
202
-
203
- const executor = await Arcade.createArcadeExecutor(
204
- "Round($feature.value * 100, 2)",
205
- profile
206
- );
207
-
208
- const result = executor.execute({ $feature: graphic });
209
- ```
210
-
211
- ## Arcade in HTML
212
-
213
- ```html
214
- <script type="text/plain" id="my-expression">
215
- var total = $feature.value_a + $feature.value_b;
216
- return Round(total, 1);
217
- </script>
218
-
219
- <script type="module">
220
- const expression = document.getElementById("my-expression").text;
221
- layer.popupTemplate = {
222
- expressionInfos: [{ name: "calc", expression }],
223
- content: "Value: {expression/calc}"
224
- };
225
- </script>
226
- ```
227
-
228
- ## Common Pitfalls
229
-
230
- 1. **Null values** - Check with `IsEmpty($feature.field)`
231
- 2. **Type coercion** - Use `Number()` or `Text()` for conversion
232
- 3. **Case sensitivity** - Functions case-insensitive, field names exact
233
- 4. **Performance** - Complex expressions slow down rendering
234
- 5. **Debugging** - Use `Console()` function
@@ -1,187 +0,0 @@
1
- ---
2
- applyTo: "**/*.{js,ts,jsx,tsx,html}"
3
- ---
4
-
5
- # ArcGIS Maps SDK - Authentication
6
-
7
- ## OAuth 2.0 Authentication
8
-
9
- ### Basic OAuth Setup
10
- ```javascript
11
- import OAuthInfo from "@arcgis/core/identity/OAuthInfo.js";
12
- import esriId from "@arcgis/core/identity/IdentityManager.js";
13
-
14
- const oauthInfo = new OAuthInfo({
15
- appId: "YOUR_APP_ID",
16
- popup: false // false = redirect, true = popup
17
- });
18
-
19
- esriId.registerOAuthInfos([oauthInfo]);
20
- ```
21
-
22
- ### Check Sign-In Status
23
- ```javascript
24
- async function checkSignIn() {
25
- try {
26
- await esriId.checkSignInStatus(oauthInfo.portalUrl + "/sharing");
27
- const portal = new Portal({ authMode: "immediate" });
28
- await portal.load();
29
- console.log("Signed in as:", portal.user.username);
30
- return portal;
31
- } catch {
32
- console.log("Not signed in");
33
- return null;
34
- }
35
- }
36
- ```
37
-
38
- ### Sign In
39
- ```javascript
40
- async function signIn() {
41
- const credential = await esriId.getCredential(
42
- oauthInfo.portalUrl + "/sharing"
43
- );
44
- return credential;
45
- }
46
- ```
47
-
48
- ### Sign Out
49
- ```javascript
50
- function signOut() {
51
- esriId.destroyCredentials();
52
- window.location.reload();
53
- }
54
- ```
55
-
56
- ### OAuth Component
57
- ```html
58
- <arcgis-oauth app-id="YOUR_APP_ID"></arcgis-oauth>
59
-
60
- <script type="module">
61
- const oauth = document.querySelector("arcgis-oauth");
62
- oauth.addEventListener("arcgisSignIn", (e) => console.log(e.detail.credential));
63
- oauth.addEventListener("arcgisSignOut", () => console.log("Signed out"));
64
- </script>
65
- ```
66
-
67
- ## API Keys
68
-
69
- ```javascript
70
- import esriConfig from "@arcgis/core/config.js";
71
-
72
- esriConfig.apiKey = "YOUR_API_KEY";
73
-
74
- const map = new Map({
75
- basemap: "arcgis/streets" // Requires API key
76
- });
77
- ```
78
-
79
- ### API Key in HTML
80
- ```html
81
- <script>
82
- window.esriConfig = { apiKey: "YOUR_API_KEY" };
83
- </script>
84
- <script src="https://js.arcgis.com/4.34/"></script>
85
- ```
86
-
87
- ## Enterprise Portal
88
-
89
- ```javascript
90
- const oauthInfo = new OAuthInfo({
91
- appId: "YOUR_APP_ID",
92
- portalUrl: "https://your-portal.com/portal",
93
- popup: true
94
- });
95
-
96
- // Or set globally
97
- import esriConfig from "@arcgis/core/config.js";
98
- esriConfig.portalUrl = "https://your-portal.com/portal";
99
- ```
100
-
101
- ## Portal User Information
102
-
103
- ```javascript
104
- import Portal from "@arcgis/core/portal/Portal.js";
105
-
106
- const portal = new Portal({ authMode: "immediate" });
107
- await portal.load();
108
-
109
- console.log("Username:", portal.user.username);
110
- console.log("Full name:", portal.user.fullName);
111
- console.log("Email:", portal.user.email);
112
- console.log("Role:", portal.user.role);
113
- console.log("Org:", portal.name);
114
- ```
115
-
116
- ## Query User Items
117
-
118
- ```javascript
119
- import PortalQueryParams from "@arcgis/core/portal/PortalQueryParams.js";
120
-
121
- const queryParams = new PortalQueryParams({
122
- query: `owner:${portal.user.username}`,
123
- sortField: "modified",
124
- sortOrder: "desc",
125
- num: 20
126
- });
127
-
128
- const result = await portal.queryItems(queryParams);
129
- result.results.forEach(item => console.log(item.title, item.type));
130
- ```
131
-
132
- ## Token Management
133
-
134
- ```javascript
135
- // Get token
136
- const credential = await esriId.getCredential("https://services.arcgis.com/...");
137
- console.log("Token:", credential.token);
138
- console.log("Expires:", new Date(credential.expires));
139
-
140
- // Register token
141
- esriId.registerToken({
142
- server: "https://services.arcgis.com/",
143
- token: "YOUR_TOKEN"
144
- });
145
- ```
146
-
147
- ## Trusted Servers
148
-
149
- ```javascript
150
- import esriConfig from "@arcgis/core/config.js";
151
-
152
- esriConfig.request.trustedServers.push("https://services.arcgis.com");
153
- esriConfig.request.trustedServers.push("https://your-server.com");
154
- ```
155
-
156
- ## CORS and Proxy
157
-
158
- ```javascript
159
- esriConfig.request.proxyUrl = "/proxy/";
160
-
161
- esriConfig.request.proxyRules.push({
162
- urlPrefix: "https://services.arcgis.com",
163
- proxyUrl: "/proxy/"
164
- });
165
- ```
166
-
167
- ## Error Handling
168
-
169
- ```javascript
170
- esriId.on("credential-create", (event) => {
171
- console.log("New credential:", event.credential);
172
- });
173
-
174
- layer.on("layerview-create-error", (event) => {
175
- if (event.error.name === "identity-manager:not-authorized") {
176
- signIn();
177
- }
178
- });
179
- ```
180
-
181
- ## Common Pitfalls
182
-
183
- 1. **App ID registration** - Must be registered with correct redirect URIs
184
- 2. **Popup blockers** - Use redirect flow as fallback
185
- 3. **Token expiration** - Handle refresh or re-authentication
186
- 4. **CORS errors** - Configure trusted servers or use proxy
187
- 5. **Portal URL mismatch** - Trailing slashes matter
@@ -1,177 +0,0 @@
1
- ---
2
- applyTo: "**/*.{js,ts,jsx,tsx,html}"
3
- ---
4
-
5
- # ArcGIS Maps SDK - CIM Symbols
6
-
7
- Advanced cartographic symbols using CIM (Cartographic Information Model).
8
-
9
- ## Basic CIM Symbol
10
-
11
- ```javascript
12
- const graphic = new Graphic({
13
- geometry: point,
14
- symbol: {
15
- type: "cim",
16
- data: {
17
- type: "CIMSymbolReference",
18
- symbol: {
19
- type: "CIMPointSymbol",
20
- symbolLayers: [{
21
- type: "CIMVectorMarker",
22
- enable: true,
23
- size: 20,
24
- frame: { xmin: 0, ymin: 0, xmax: 10, ymax: 10 },
25
- markerGraphics: [{
26
- type: "CIMMarkerGraphic",
27
- geometry: { rings: [[[0,0], [10,0], [10,10], [0,10], [0,0]]] },
28
- symbol: {
29
- type: "CIMPolygonSymbol",
30
- symbolLayers: [{
31
- type: "CIMSolidFill",
32
- enable: true,
33
- color: [255, 0, 0, 255]
34
- }]
35
- }
36
- }]
37
- }]
38
- }
39
- }
40
- }
41
- });
42
- ```
43
-
44
- ## CIM Line Symbol (Arrow)
45
-
46
- ```javascript
47
- const arrowLineCIM = {
48
- type: "CIMSymbolReference",
49
- symbol: {
50
- type: "CIMLineSymbol",
51
- symbolLayers: [
52
- {
53
- type: "CIMVectorMarker",
54
- enable: true,
55
- size: 12,
56
- markerPlacement: {
57
- type: "CIMMarkerPlacementAtExtremities",
58
- extremityPlacement: "JustEnd",
59
- angleToLine: true
60
- },
61
- frame: { xmin: 0, ymin: 0, xmax: 10, ymax: 10 },
62
- markerGraphics: [{
63
- type: "CIMMarkerGraphic",
64
- geometry: { rings: [[[0, 0], [10, 5], [0, 10], [3, 5], [0, 0]]] },
65
- symbol: {
66
- type: "CIMPolygonSymbol",
67
- symbolLayers: [{ type: "CIMSolidFill", enable: true, color: [0, 0, 0, 255] }]
68
- }
69
- }]
70
- },
71
- { type: "CIMSolidStroke", enable: true, width: 2, color: [0, 0, 0, 255] }
72
- ]
73
- }
74
- };
75
- ```
76
-
77
- ## CIM Polygon Symbol (Hatched)
78
-
79
- ```javascript
80
- const hatchedFillCIM = {
81
- type: "CIMSymbolReference",
82
- symbol: {
83
- type: "CIMPolygonSymbol",
84
- symbolLayers: [
85
- {
86
- type: "CIMHatchFill",
87
- enable: true,
88
- lineSymbol: {
89
- type: "CIMLineSymbol",
90
- symbolLayers: [{ type: "CIMSolidStroke", enable: true, width: 1, color: [0, 0, 0, 255] }]
91
- },
92
- rotation: 45,
93
- separation: 5
94
- },
95
- { type: "CIMSolidFill", enable: true, color: [255, 255, 200, 255] },
96
- { type: "CIMSolidStroke", enable: true, width: 2, color: [0, 0, 0, 255] }
97
- ]
98
- }
99
- };
100
- ```
101
-
102
- ## Data-Driven CIM
103
-
104
- ```javascript
105
- const dataDrivenCIM = {
106
- type: "CIMSymbolReference",
107
- primitiveOverrides: [{
108
- type: "CIMPrimitiveOverride",
109
- primitiveName: "fillLayer",
110
- propertyName: "Color",
111
- valueExpressionInfo: {
112
- type: "CIMExpressionInfo",
113
- expression: `
114
- var val = $feature.value;
115
- if (val < 50) return [255, 0, 0, 255];
116
- return [0, 255, 0, 255];
117
- `,
118
- returnType: "Default"
119
- }
120
- }],
121
- symbol: {
122
- type: "CIMPointSymbol",
123
- symbolLayers: [{
124
- type: "CIMVectorMarker",
125
- markerGraphics: [{
126
- type: "CIMMarkerGraphic",
127
- symbol: {
128
- type: "CIMPolygonSymbol",
129
- symbolLayers: [{
130
- type: "CIMSolidFill",
131
- primitiveName: "fillLayer",
132
- color: [128, 128, 128, 255]
133
- }]
134
- }
135
- }]
136
- }]
137
- }
138
- };
139
- ```
140
-
141
- ## Marker Placement
142
-
143
- ```javascript
144
- // Along line
145
- markerPlacement: {
146
- type: "CIMMarkerPlacementAlongLineSameSize",
147
- placementTemplate: [20],
148
- angleToLine: true
149
- }
150
-
151
- // At vertices
152
- markerPlacement: {
153
- type: "CIMMarkerPlacementAtRatioPositions",
154
- positionArray: [0, 0.5, 1],
155
- angleToLine: true
156
- }
157
- ```
158
-
159
- ## CIM Properties
160
-
161
- ```javascript
162
- // Colors: [R, G, B, A] where each is 0-255
163
- color: [255, 0, 0, 255]
164
-
165
- // Stroke
166
- { type: "CIMSolidStroke", width: 2, color: [0, 0, 0, 255], capStyle: "Round", joinStyle: "Round" }
167
-
168
- // Anchor
169
- { anchorPoint: { x: 0, y: -0.5 }, anchorPointUnits: "Relative" }
170
- ```
171
-
172
- ## Common Pitfalls
173
-
174
- 1. **Frame coordinates** - Frame defines coordinate space for graphics
175
- 2. **Layer order** - Renders bottom to top
176
- 3. **Primitive names** - Must be unique for overrides
177
- 4. **Closed rings** - First point must equal last point