@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
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@saschabrunnerch/arcgis-maps-sdk-js-ai-context",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "Install
|
|
5
|
-
"main": "lib/installer.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"arcgis-maps-sdk-js-ai-context": "bin/cli.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"bin",
|
|
11
|
-
"contexts",
|
|
12
|
-
"lib"
|
|
13
|
-
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"test": "node bin/cli.js --help"
|
|
16
|
-
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"arcgis",
|
|
19
|
-
"esri",
|
|
20
|
-
"gis",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"anthropic"
|
|
31
|
-
],
|
|
32
|
-
"author": "Sascha Brunner",
|
|
33
|
-
"license": "MIT",
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "git+https://github.com/SaschaBrunnerCH/arcgis-maps-sdk-js-ai-context.git"
|
|
37
|
-
},
|
|
38
|
-
"bugs": {
|
|
39
|
-
"url": "https://github.com/SaschaBrunnerCH/arcgis-maps-sdk-js-ai-context/issues"
|
|
40
|
-
},
|
|
41
|
-
"homepage": "https://github.com/SaschaBrunnerCH/arcgis-maps-sdk-js-ai-context#readme",
|
|
42
|
-
"engines": {
|
|
43
|
-
"node": ">=14.0.0"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@saschabrunnerch/arcgis-maps-sdk-js-ai-context",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Install Agent Skills for ArcGIS Maps SDK for JavaScript development. Compatible with Claude, VS Code, Cursor, and other AI agents.",
|
|
5
|
+
"main": "lib/installer.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"arcgis-maps-sdk-js-ai-context": "bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"contexts",
|
|
12
|
+
"lib"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"test": "node bin/cli.js --help"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"arcgis",
|
|
19
|
+
"esri",
|
|
20
|
+
"gis",
|
|
21
|
+
"agent-skills",
|
|
22
|
+
"claude",
|
|
23
|
+
"copilot",
|
|
24
|
+
"ai",
|
|
25
|
+
"skills",
|
|
26
|
+
"maps",
|
|
27
|
+
"javascript",
|
|
28
|
+
"context",
|
|
29
|
+
"assistant",
|
|
30
|
+
"anthropic"
|
|
31
|
+
],
|
|
32
|
+
"author": "Sascha Brunner",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/SaschaBrunnerCH/arcgis-maps-sdk-js-ai-context.git"
|
|
37
|
+
},
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/SaschaBrunnerCH/arcgis-maps-sdk-js-ai-context/issues"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/SaschaBrunnerCH/arcgis-maps-sdk-js-ai-context#readme",
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=14.0.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
applyTo: "**/*.{js,ts,jsx,tsx,html}"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# ArcGIS Maps SDK - 3D Visualization
|
|
6
|
-
|
|
7
|
-
## SceneView
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
import SceneView from "@arcgis/core/views/SceneView.js";
|
|
11
|
-
|
|
12
|
-
const view = new SceneView({
|
|
13
|
-
container: "viewDiv",
|
|
14
|
-
map: map,
|
|
15
|
-
camera: {
|
|
16
|
-
position: {
|
|
17
|
-
longitude: -118.24,
|
|
18
|
-
latitude: 34.05,
|
|
19
|
-
z: 25000
|
|
20
|
-
},
|
|
21
|
-
heading: 0,
|
|
22
|
-
tilt: 45
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
```html
|
|
28
|
-
<arcgis-scene basemap="topo-3d" ground="world-elevation">
|
|
29
|
-
<arcgis-zoom slot="top-left"></arcgis-zoom>
|
|
30
|
-
<arcgis-navigation-toggle slot="top-left"></arcgis-navigation-toggle>
|
|
31
|
-
</arcgis-scene>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## 3D Layers
|
|
35
|
-
|
|
36
|
-
### SceneLayer (Buildings)
|
|
37
|
-
```javascript
|
|
38
|
-
import SceneLayer from "@arcgis/core/layers/SceneLayer.js";
|
|
39
|
-
|
|
40
|
-
const layer = new SceneLayer({
|
|
41
|
-
portalItem: { id: "2e0761b9a4274b8db52c4bf34356911e" }
|
|
42
|
-
});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### IntegratedMeshLayer
|
|
46
|
-
```javascript
|
|
47
|
-
import IntegratedMeshLayer from "@arcgis/core/layers/IntegratedMeshLayer.js";
|
|
48
|
-
|
|
49
|
-
const layer = new IntegratedMeshLayer({
|
|
50
|
-
url: "https://tiles.arcgis.com/tiles/.../IntegratedMeshServer"
|
|
51
|
-
});
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### PointCloudLayer
|
|
55
|
-
```javascript
|
|
56
|
-
import PointCloudLayer from "@arcgis/core/layers/PointCloudLayer.js";
|
|
57
|
-
|
|
58
|
-
const layer = new PointCloudLayer({
|
|
59
|
-
url: "https://tiles.arcgis.com/tiles/.../SceneServer"
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// RGB Renderer
|
|
63
|
-
layer.renderer = { type: "point-cloud-rgb", field: "RGB" };
|
|
64
|
-
|
|
65
|
-
// Classification Renderer
|
|
66
|
-
layer.renderer = {
|
|
67
|
-
type: "point-cloud-unique-value",
|
|
68
|
-
field: "CLASS_CODE",
|
|
69
|
-
colorUniqueValueInfos: [
|
|
70
|
-
{ values: ["2"], label: "Ground", color: [139, 90, 43] },
|
|
71
|
-
{ values: ["6"], label: "Building", color: [194, 194, 194] }
|
|
72
|
-
]
|
|
73
|
-
};
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### VoxelLayer
|
|
77
|
-
```javascript
|
|
78
|
-
import VoxelLayer from "@arcgis/core/layers/VoxelLayer.js";
|
|
79
|
-
|
|
80
|
-
const layer = new VoxelLayer({
|
|
81
|
-
url: "https://tiles.arcgis.com/tiles/.../SceneServer"
|
|
82
|
-
});
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## 3D Symbols
|
|
86
|
-
|
|
87
|
-
### PointSymbol3D
|
|
88
|
-
```javascript
|
|
89
|
-
const symbol = {
|
|
90
|
-
type: "point-3d",
|
|
91
|
-
symbolLayers: [{
|
|
92
|
-
type: "icon",
|
|
93
|
-
resource: { primitive: "circle" },
|
|
94
|
-
material: { color: "red" },
|
|
95
|
-
size: 12
|
|
96
|
-
}]
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// Object symbol
|
|
100
|
-
const symbol = {
|
|
101
|
-
type: "point-3d",
|
|
102
|
-
symbolLayers: [{
|
|
103
|
-
type: "object",
|
|
104
|
-
resource: { primitive: "cylinder" }, // cone, cube, sphere, diamond
|
|
105
|
-
material: { color: "blue" },
|
|
106
|
-
height: 100,
|
|
107
|
-
width: 10
|
|
108
|
-
}]
|
|
109
|
-
};
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### glTF Model
|
|
113
|
-
```javascript
|
|
114
|
-
const graphic = new Graphic({
|
|
115
|
-
geometry: point,
|
|
116
|
-
symbol: {
|
|
117
|
-
type: "point-3d",
|
|
118
|
-
symbolLayers: [{
|
|
119
|
-
type: "object",
|
|
120
|
-
resource: { href: "https://example.com/model.glb" },
|
|
121
|
-
width: 10,
|
|
122
|
-
height: 10
|
|
123
|
-
}]
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### PolygonSymbol3D (Extrusion)
|
|
129
|
-
```javascript
|
|
130
|
-
const symbol = {
|
|
131
|
-
type: "polygon-3d",
|
|
132
|
-
symbolLayers: [{
|
|
133
|
-
type: "extrude",
|
|
134
|
-
material: { color: "blue" },
|
|
135
|
-
size: 100
|
|
136
|
-
}]
|
|
137
|
-
};
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### MeshSymbol3D
|
|
141
|
-
```javascript
|
|
142
|
-
const symbol = {
|
|
143
|
-
type: "mesh-3d",
|
|
144
|
-
symbolLayers: [{
|
|
145
|
-
type: "fill",
|
|
146
|
-
material: { color: [244, 247, 134] }
|
|
147
|
-
}]
|
|
148
|
-
};
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Weather Effects
|
|
152
|
-
|
|
153
|
-
```javascript
|
|
154
|
-
// Sunny
|
|
155
|
-
view.environment.weather = { type: "sunny", cloudCover: 0.2 };
|
|
156
|
-
|
|
157
|
-
// Cloudy
|
|
158
|
-
view.environment.weather = { type: "cloudy", cloudCover: 0.6 };
|
|
159
|
-
|
|
160
|
-
// Rainy
|
|
161
|
-
view.environment.weather = { type: "rainy", cloudCover: 0.8, precipitation: 0.5 };
|
|
162
|
-
|
|
163
|
-
// Foggy
|
|
164
|
-
view.environment.weather = { type: "foggy", fogStrength: 0.5 };
|
|
165
|
-
|
|
166
|
-
// Snowy
|
|
167
|
-
view.environment.weather = { type: "snowy", precipitation: 0.5, snowCover: "enabled" };
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
```html
|
|
171
|
-
<arcgis-expand slot="top-right">
|
|
172
|
-
<arcgis-weather></arcgis-weather>
|
|
173
|
-
</arcgis-expand>
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Daylight & Lighting
|
|
177
|
-
|
|
178
|
-
```javascript
|
|
179
|
-
view.environment.lighting = {
|
|
180
|
-
date: new Date("2024-06-21T12:00:00"),
|
|
181
|
-
directShadowsEnabled: true,
|
|
182
|
-
ambientOcclusionEnabled: true
|
|
183
|
-
};
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
```html
|
|
187
|
-
<arcgis-expand slot="top-right">
|
|
188
|
-
<arcgis-daylight></arcgis-daylight>
|
|
189
|
-
</arcgis-expand>
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
## Ground Configuration
|
|
193
|
-
|
|
194
|
-
```javascript
|
|
195
|
-
// World elevation
|
|
196
|
-
map.ground = "world-elevation";
|
|
197
|
-
|
|
198
|
-
// Custom elevation
|
|
199
|
-
import ElevationLayer from "@arcgis/core/layers/ElevationLayer.js";
|
|
200
|
-
|
|
201
|
-
map.ground = {
|
|
202
|
-
layers: [
|
|
203
|
-
new ElevationLayer({
|
|
204
|
-
url: "https://elevation.arcgis.com/.../Terrain3D/ImageServer"
|
|
205
|
-
})
|
|
206
|
-
]
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
// Underground navigation
|
|
210
|
-
map.ground.navigationConstraint = "none";
|
|
211
|
-
map.ground.opacity = 0.5;
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Scene Environment
|
|
215
|
-
|
|
216
|
-
```javascript
|
|
217
|
-
view.environment.atmosphereEnabled = true;
|
|
218
|
-
view.environment.starsEnabled = true;
|
|
219
|
-
view.qualityProfile = "high"; // low, medium, high
|
|
220
|
-
|
|
221
|
-
// Background
|
|
222
|
-
view.environment.background = {
|
|
223
|
-
type: "color",
|
|
224
|
-
color: [0, 0, 0, 1] // or [0, 0, 0, 0] for transparent
|
|
225
|
-
};
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Viewing Modes
|
|
229
|
-
|
|
230
|
-
```javascript
|
|
231
|
-
view.viewingMode = "global"; // Spherical Earth
|
|
232
|
-
view.viewingMode = "local"; // Flat, for local areas
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
```html
|
|
236
|
-
<arcgis-scene viewing-mode="local"></arcgis-scene>
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
## Elevation Info
|
|
240
|
-
|
|
241
|
-
```javascript
|
|
242
|
-
layer.elevationInfo = {
|
|
243
|
-
mode: "on-the-ground", // Features on ground
|
|
244
|
-
mode: "relative-to-ground", // Height above ground
|
|
245
|
-
mode: "absolute-height", // Height above sea level
|
|
246
|
-
mode: "relative-to-scene", // Height above scene
|
|
247
|
-
offset: 10,
|
|
248
|
-
featureExpressionInfo: {
|
|
249
|
-
expression: "$feature.height"
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
## 3D Measurement
|
|
255
|
-
|
|
256
|
-
```html
|
|
257
|
-
<arcgis-direct-line-measurement-3d slot="top-right"></arcgis-direct-line-measurement-3d>
|
|
258
|
-
<arcgis-area-measurement-3d slot="top-right"></arcgis-area-measurement-3d>
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
## Common Pitfalls
|
|
262
|
-
|
|
263
|
-
1. **VoxelLayer requires local mode** - Use `viewing-mode="local"`
|
|
264
|
-
2. **Weather only in SceneView** - Doesn't work in MapView
|
|
265
|
-
3. **glTF model scale** - May need scaling to fit scene
|
|
266
|
-
4. **Ground navigation** - Set `navigationConstraint: "none"` for underground
|
|
267
|
-
5. **PointCloud fields** - Common: `RGB`, `CLASS_CODE`, `ELEVATION`
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
applyTo: "**/*.{js,ts,jsx,tsx,html}"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# ArcGIS Maps SDK - Analysis & Utilities
|
|
6
|
-
|
|
7
|
-
## Coordinate Conversion
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
import CoordinateFormatter from "@arcgis/core/geometry/coordinateFormatter.js";
|
|
11
|
-
|
|
12
|
-
await CoordinateFormatter.load();
|
|
13
|
-
|
|
14
|
-
// To DMS
|
|
15
|
-
const dms = CoordinateFormatter.toLatitudeLongitude(point, "dms", 2);
|
|
16
|
-
|
|
17
|
-
// To MGRS
|
|
18
|
-
const mgrs = CoordinateFormatter.toMgrs(point, "automatic", 5, false);
|
|
19
|
-
|
|
20
|
-
// To UTM
|
|
21
|
-
const utm = CoordinateFormatter.toUtm(point, "latitude-band-indicators", true);
|
|
22
|
-
|
|
23
|
-
// From string
|
|
24
|
-
const point = CoordinateFormatter.fromLatitudeLongitude("34.05N, 118.24W");
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## esriRequest (HTTP)
|
|
28
|
-
|
|
29
|
-
```javascript
|
|
30
|
-
import esriRequest from "@arcgis/core/request.js";
|
|
31
|
-
|
|
32
|
-
const response = await esriRequest(url, {
|
|
33
|
-
query: { f: "json" },
|
|
34
|
-
responseType: "json"
|
|
35
|
-
});
|
|
36
|
-
console.log(response.data);
|
|
37
|
-
|
|
38
|
-
// POST request
|
|
39
|
-
const response = await esriRequest(url, {
|
|
40
|
-
method: "post",
|
|
41
|
-
body: formData,
|
|
42
|
-
responseType: "json"
|
|
43
|
-
});
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
## Print Task
|
|
47
|
-
|
|
48
|
-
```javascript
|
|
49
|
-
import PrintTask from "@arcgis/core/tasks/PrintTask.js";
|
|
50
|
-
import PrintTemplate from "@arcgis/core/tasks/support/PrintTemplate.js";
|
|
51
|
-
import PrintParameters from "@arcgis/core/tasks/support/PrintParameters.js";
|
|
52
|
-
|
|
53
|
-
const printTask = new PrintTask({
|
|
54
|
-
url: "https://utility.arcgisonline.com/.../PrintingTools/GPServer/Export%20Web%20Map%20Task"
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const template = new PrintTemplate({
|
|
58
|
-
format: "pdf",
|
|
59
|
-
layout: "letter-ansi-a-landscape",
|
|
60
|
-
exportOptions: { dpi: 150 }
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const params = new PrintParameters({
|
|
64
|
-
view: view,
|
|
65
|
-
template: template
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const result = await printTask.execute(params);
|
|
69
|
-
console.log("PDF URL:", result.url);
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
## Route Task
|
|
73
|
-
|
|
74
|
-
```javascript
|
|
75
|
-
import RouteTask from "@arcgis/core/tasks/RouteTask.js";
|
|
76
|
-
import RouteParameters from "@arcgis/core/tasks/support/RouteParameters.js";
|
|
77
|
-
import Stop from "@arcgis/core/tasks/support/Stop.js";
|
|
78
|
-
|
|
79
|
-
const routeTask = new RouteTask({
|
|
80
|
-
url: "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
const params = new RouteParameters({
|
|
84
|
-
stops: new FeatureSet({
|
|
85
|
-
features: [
|
|
86
|
-
new Graphic({ geometry: startPoint }),
|
|
87
|
-
new Graphic({ geometry: endPoint })
|
|
88
|
-
]
|
|
89
|
-
}),
|
|
90
|
-
returnDirections: true
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const result = await routeTask.solve(params);
|
|
94
|
-
const route = result.routeResults[0].route;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Geocoding
|
|
98
|
-
|
|
99
|
-
```javascript
|
|
100
|
-
import Locator from "@arcgis/core/tasks/Locator.js";
|
|
101
|
-
|
|
102
|
-
const locator = new Locator({
|
|
103
|
-
url: "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// Address to location
|
|
107
|
-
const results = await locator.addressToLocations({
|
|
108
|
-
address: { SingleLine: "380 New York St, Redlands, CA" }
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// Location to address
|
|
112
|
-
const result = await locator.locationToAddress({ location: point });
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Feature Clustering
|
|
116
|
-
|
|
117
|
-
```javascript
|
|
118
|
-
layer.featureReduction = {
|
|
119
|
-
type: "cluster",
|
|
120
|
-
clusterRadius: 80,
|
|
121
|
-
clusterMinSize: 16,
|
|
122
|
-
clusterMaxSize: 60,
|
|
123
|
-
popupTemplate: {
|
|
124
|
-
title: "Cluster of {cluster_count}",
|
|
125
|
-
content: [{ type: "fields", fieldInfos: [{ fieldName: "cluster_count" }] }]
|
|
126
|
-
},
|
|
127
|
-
fields: [{
|
|
128
|
-
name: "cluster_avg_value",
|
|
129
|
-
alias: "Average",
|
|
130
|
-
onStatisticField: "value",
|
|
131
|
-
statisticType: "avg"
|
|
132
|
-
}]
|
|
133
|
-
};
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Measurement
|
|
137
|
-
|
|
138
|
-
```html
|
|
139
|
-
<arcgis-distance-measurement-2d slot="top-right"></arcgis-distance-measurement-2d>
|
|
140
|
-
<arcgis-area-measurement-2d slot="top-right"></arcgis-area-measurement-2d>
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
```javascript
|
|
144
|
-
import Measurement from "@arcgis/core/widgets/Measurement.js";
|
|
145
|
-
|
|
146
|
-
const measurement = new Measurement({
|
|
147
|
-
view: view,
|
|
148
|
-
activeTool: "distance" // distance, area
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
view.ui.add(measurement, "top-right");
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Swipe
|
|
155
|
-
|
|
156
|
-
```html
|
|
157
|
-
<arcgis-map basemap="streets-vector">
|
|
158
|
-
<arcgis-swipe slot="top-right" position="50"></arcgis-swipe>
|
|
159
|
-
</arcgis-map>
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
import Swipe from "@arcgis/core/widgets/Swipe.js";
|
|
164
|
-
|
|
165
|
-
const swipe = new Swipe({
|
|
166
|
-
view: view,
|
|
167
|
-
leadingLayers: [layer1],
|
|
168
|
-
trailingLayers: [layer2],
|
|
169
|
-
position: 50
|
|
170
|
-
});
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Bookmarks
|
|
174
|
-
|
|
175
|
-
```html
|
|
176
|
-
<arcgis-bookmarks slot="top-right"></arcgis-bookmarks>
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
```javascript
|
|
180
|
-
import Bookmarks from "@arcgis/core/widgets/Bookmarks.js";
|
|
181
|
-
|
|
182
|
-
const bookmarks = new Bookmarks({
|
|
183
|
-
view: view,
|
|
184
|
-
bookmarks: [
|
|
185
|
-
{
|
|
186
|
-
name: "Los Angeles",
|
|
187
|
-
viewpoint: { targetGeometry: extent1 }
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
name: "New York",
|
|
191
|
-
viewpoint: { targetGeometry: extent2 }
|
|
192
|
-
}
|
|
193
|
-
]
|
|
194
|
-
});
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
## Portal Operations
|
|
198
|
-
|
|
199
|
-
### Save WebMap
|
|
200
|
-
|
|
201
|
-
```javascript
|
|
202
|
-
import WebMap from "@arcgis/core/WebMap.js";
|
|
203
|
-
|
|
204
|
-
const webmap = new WebMap({ basemap: "topo-vector" });
|
|
205
|
-
webmap.add(layer);
|
|
206
|
-
|
|
207
|
-
await webmap.save({
|
|
208
|
-
folder: portal.user.username + "/My Maps",
|
|
209
|
-
title: "My WebMap",
|
|
210
|
-
description: "Description",
|
|
211
|
-
tags: ["tag1", "tag2"]
|
|
212
|
-
});
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Load and Update WebMap
|
|
216
|
-
|
|
217
|
-
```javascript
|
|
218
|
-
const webmap = new WebMap({
|
|
219
|
-
portalItem: { id: "EXISTING_WEBMAP_ID" }
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
await webmap.load();
|
|
223
|
-
webmap.add(newLayer);
|
|
224
|
-
await webmap.save();
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## Time-Aware Layers
|
|
228
|
-
|
|
229
|
-
```javascript
|
|
230
|
-
// TimeSlider
|
|
231
|
-
import TimeSlider from "@arcgis/core/widgets/TimeSlider.js";
|
|
232
|
-
|
|
233
|
-
const timeSlider = new TimeSlider({
|
|
234
|
-
view: view,
|
|
235
|
-
fullTimeExtent: layer.timeInfo.fullTimeExtent,
|
|
236
|
-
mode: "time-window",
|
|
237
|
-
stops: { interval: { value: 1, unit: "hours" } }
|
|
238
|
-
});
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
```html
|
|
242
|
-
<arcgis-time-slider slot="bottom" mode="time-window" loop></arcgis-time-slider>
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
## Statistics
|
|
246
|
-
|
|
247
|
-
```javascript
|
|
248
|
-
const query = layer.createQuery();
|
|
249
|
-
query.outStatistics = [
|
|
250
|
-
{ statisticType: "sum", onStatisticField: "population", outStatisticFieldName: "total" },
|
|
251
|
-
{ statisticType: "avg", onStatisticField: "population", outStatisticFieldName: "average" },
|
|
252
|
-
{ statisticType: "min", onStatisticField: "population", outStatisticFieldName: "minimum" },
|
|
253
|
-
{ statisticType: "max", onStatisticField: "population", outStatisticFieldName: "maximum" },
|
|
254
|
-
{ statisticType: "count", onStatisticField: "population", outStatisticFieldName: "count" }
|
|
255
|
-
];
|
|
256
|
-
|
|
257
|
-
query.groupByFieldsForStatistics = ["category"];
|
|
258
|
-
|
|
259
|
-
const result = await layer.queryFeatures(query);
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## Hit Test
|
|
263
|
-
|
|
264
|
-
```javascript
|
|
265
|
-
view.on("click", async (event) => {
|
|
266
|
-
const response = await view.hitTest(event);
|
|
267
|
-
|
|
268
|
-
if (response.results.length > 0) {
|
|
269
|
-
const graphic = response.results[0].graphic;
|
|
270
|
-
console.log("Clicked:", graphic.attributes);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Screenshot
|
|
276
|
-
|
|
277
|
-
```javascript
|
|
278
|
-
const screenshot = await view.takeScreenshot({
|
|
279
|
-
format: "png",
|
|
280
|
-
quality: 100,
|
|
281
|
-
width: 1920,
|
|
282
|
-
height: 1080
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
const image = document.createElement("img");
|
|
286
|
-
image.src = screenshot.dataUrl;
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
## Common Pitfalls
|
|
290
|
-
|
|
291
|
-
1. **API key required** - Many services need API key or OAuth
|
|
292
|
-
2. **Async operations** - Always await async methods
|
|
293
|
-
3. **CORS** - Configure proxy for cross-origin services
|
|
294
|
-
4. **Rate limits** - Be aware of service rate limits
|