@saschabrunnerch/arcgis-maps-sdk-js-ai-context 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +163 -201
- package/bin/cli.js +157 -173
- package/contexts/4.34/{claude → skills}/arcgis-3d-advanced/SKILL.md +586 -586
- package/contexts/4.34/{claude → skills}/arcgis-advanced-layers/SKILL.md +431 -431
- package/contexts/4.34/{claude → skills}/arcgis-analysis-services/SKILL.md +607 -607
- package/contexts/4.34/{claude → skills}/arcgis-authentication/SKILL.md +301 -301
- package/contexts/4.34/{claude → skills}/arcgis-cim-symbols/SKILL.md +486 -486
- package/contexts/4.34/{claude → skills}/arcgis-coordinates-projection/SKILL.md +406 -406
- package/contexts/4.34/{claude → skills}/arcgis-core-maps/SKILL.md +739 -739
- package/contexts/4.34/{claude → skills}/arcgis-core-utilities/SKILL.md +732 -732
- package/contexts/4.34/{claude → skills}/arcgis-custom-rendering/SKILL.md +445 -445
- package/contexts/4.34/{claude → skills}/arcgis-editing-advanced/SKILL.md +702 -702
- package/contexts/4.34/{claude → skills}/arcgis-feature-effects/SKILL.md +393 -393
- package/contexts/4.34/{claude → skills}/arcgis-geometry-operations/SKILL.md +489 -489
- package/contexts/4.34/{claude → skills}/arcgis-imagery/SKILL.md +307 -307
- package/contexts/4.34/{claude → skills}/arcgis-interaction/SKILL.md +572 -572
- package/contexts/4.34/{claude → skills}/arcgis-knowledge-graphs/SKILL.md +582 -582
- package/contexts/4.34/{claude → skills}/arcgis-layers/SKILL.md +601 -601
- package/contexts/4.34/{claude → skills}/arcgis-map-tools/SKILL.md +668 -668
- package/contexts/4.34/{claude → skills}/arcgis-media-layers/SKILL.md +290 -290
- package/contexts/4.34/{claude → skills}/arcgis-portal-content/SKILL.md +679 -679
- package/contexts/4.34/{claude → skills}/arcgis-scene-effects/SKILL.md +512 -512
- package/contexts/4.34/{claude → skills}/arcgis-smart-mapping/SKILL.md +686 -686
- package/contexts/4.34/skills/arcgis-starter-app/SKILL.md +273 -0
- package/contexts/4.34/skills/arcgis-starter-app-extended/SKILL.md +649 -0
- package/contexts/4.34/{claude → skills}/arcgis-tables-forms/SKILL.md +877 -877
- package/contexts/4.34/{claude → skills}/arcgis-time-animation/SKILL.md +722 -722
- package/contexts/4.34/{claude → skills}/arcgis-utility-networks/SKILL.md +301 -301
- package/contexts/4.34/{claude → skills}/arcgis-visualization/SKILL.md +580 -580
- package/contexts/4.34/{claude → skills}/arcgis-widgets-ui/SKILL.md +574 -574
- package/lib/installer.js +294 -379
- package/package.json +45 -45
- package/contexts/4.34/copilot/arcgis-3d.instructions.md +0 -267
- package/contexts/4.34/copilot/arcgis-analysis.instructions.md +0 -294
- package/contexts/4.34/copilot/arcgis-arcade.instructions.md +0 -234
- package/contexts/4.34/copilot/arcgis-authentication.instructions.md +0 -187
- package/contexts/4.34/copilot/arcgis-cim-symbols.instructions.md +0 -177
- package/contexts/4.34/copilot/arcgis-core-maps.instructions.md +0 -246
- package/contexts/4.34/copilot/arcgis-core-utilities.instructions.md +0 -247
- package/contexts/4.34/copilot/arcgis-editing.instructions.md +0 -262
- package/contexts/4.34/copilot/arcgis-geometry.instructions.md +0 -225
- package/contexts/4.34/copilot/arcgis-layers.instructions.md +0 -278
- package/contexts/4.34/copilot/arcgis-popup-templates.instructions.md +0 -266
- package/contexts/4.34/copilot/arcgis-portal-advanced.instructions.md +0 -275
- package/contexts/4.34/copilot/arcgis-smart-mapping.instructions.md +0 -184
- package/contexts/4.34/copilot/arcgis-time-animation.instructions.md +0 -112
- package/contexts/4.34/copilot/arcgis-visualization.instructions.md +0 -321
- package/contexts/4.34/copilot/arcgis-widgets-ui.instructions.md +0 -277
- /package/contexts/4.34/{claude → skills}/arcgis-arcade/SKILL.md +0 -0
- /package/contexts/4.34/{claude → skills}/arcgis-popup-templates/SKILL.md +0 -0
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
applyTo: "**/*.{js,ts,jsx,tsx,html}"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# ArcGIS Maps SDK - Editing
|
|
6
|
-
|
|
7
|
-
## Editor Component
|
|
8
|
-
|
|
9
|
-
```html
|
|
10
|
-
<arcgis-map item-id="YOUR_EDITABLE_WEBMAP_ID">
|
|
11
|
-
<arcgis-editor slot="top-right"></arcgis-editor>
|
|
12
|
-
</arcgis-map>
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Editor Widget (Core API)
|
|
16
|
-
|
|
17
|
-
```javascript
|
|
18
|
-
import Editor from "@arcgis/core/widgets/Editor.js";
|
|
19
|
-
|
|
20
|
-
const editor = new Editor({
|
|
21
|
-
view: view,
|
|
22
|
-
layerInfos: [{
|
|
23
|
-
layer: featureLayer,
|
|
24
|
-
formTemplate: {
|
|
25
|
-
title: "Feature Details",
|
|
26
|
-
elements: [
|
|
27
|
-
{ type: "field", fieldName: "name", label: "Name" },
|
|
28
|
-
{ type: "field", fieldName: "category", label: "Category" }
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
addEnabled: true,
|
|
32
|
-
updateEnabled: true,
|
|
33
|
-
deleteEnabled: false
|
|
34
|
-
}]
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
view.ui.add(editor, "top-right");
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Feature Form
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
import FeatureForm from "@arcgis/core/widgets/FeatureForm.js";
|
|
44
|
-
|
|
45
|
-
const form = new FeatureForm({
|
|
46
|
-
container: "formDiv",
|
|
47
|
-
layer: featureLayer,
|
|
48
|
-
formTemplate: {
|
|
49
|
-
title: "Edit Feature",
|
|
50
|
-
elements: [
|
|
51
|
-
{ type: "field", fieldName: "name" },
|
|
52
|
-
{
|
|
53
|
-
type: "group",
|
|
54
|
-
label: "Location",
|
|
55
|
-
elements: [
|
|
56
|
-
{ type: "field", fieldName: "address" },
|
|
57
|
-
{ type: "field", fieldName: "city" }
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
form.feature = graphic;
|
|
65
|
-
|
|
66
|
-
form.on("submit", async () => {
|
|
67
|
-
if (form.valid) {
|
|
68
|
-
const values = form.getValues();
|
|
69
|
-
graphic.attributes = { ...graphic.attributes, ...values };
|
|
70
|
-
await layer.applyEdits({ updateFeatures: [graphic] });
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Apply Edits Programmatically
|
|
76
|
-
|
|
77
|
-
```javascript
|
|
78
|
-
// Add features
|
|
79
|
-
await layer.applyEdits({
|
|
80
|
-
addFeatures: [newGraphic1, newGraphic2]
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// Update features
|
|
84
|
-
await layer.applyEdits({
|
|
85
|
-
updateFeatures: [updatedGraphic]
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
// Delete features
|
|
89
|
-
await layer.applyEdits({
|
|
90
|
-
deleteFeatures: [{ objectId: 123 }]
|
|
91
|
-
});
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Sketch Widget
|
|
95
|
-
|
|
96
|
-
```html
|
|
97
|
-
<arcgis-map basemap="streets-vector">
|
|
98
|
-
<arcgis-sketch slot="top-right"></arcgis-sketch>
|
|
99
|
-
</arcgis-map>
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
```javascript
|
|
103
|
-
import Sketch from "@arcgis/core/widgets/Sketch.js";
|
|
104
|
-
|
|
105
|
-
const sketch = new Sketch({
|
|
106
|
-
view: view,
|
|
107
|
-
layer: graphicsLayer,
|
|
108
|
-
creationMode: "update"
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
sketch.on("create", (event) => {
|
|
112
|
-
if (event.state === "complete") {
|
|
113
|
-
console.log("Created:", event.graphic);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## SketchViewModel
|
|
119
|
-
|
|
120
|
-
```javascript
|
|
121
|
-
import SketchViewModel from "@arcgis/core/widgets/Sketch/SketchViewModel.js";
|
|
122
|
-
|
|
123
|
-
const sketchVM = new SketchViewModel({
|
|
124
|
-
view: view,
|
|
125
|
-
layer: graphicsLayer,
|
|
126
|
-
pointSymbol: { type: "simple-marker", color: "red" },
|
|
127
|
-
polylineSymbol: { type: "simple-line", color: "blue" },
|
|
128
|
-
polygonSymbol: { type: "simple-fill", color: [255, 255, 0, 0.5] }
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
sketchVM.create("polygon");
|
|
132
|
-
|
|
133
|
-
sketchVM.on("create", (event) => {
|
|
134
|
-
if (event.state === "complete") {
|
|
135
|
-
console.log("Geometry:", event.graphic.geometry);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Snapping
|
|
141
|
-
|
|
142
|
-
```javascript
|
|
143
|
-
sketchVM.snappingOptions = {
|
|
144
|
-
enabled: true,
|
|
145
|
-
featureSources: [{ layer: featureLayer }],
|
|
146
|
-
selfEnabled: true
|
|
147
|
-
};
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
## Attachments
|
|
151
|
-
|
|
152
|
-
```javascript
|
|
153
|
-
// Query attachments
|
|
154
|
-
const attachments = await layer.queryAttachments({
|
|
155
|
-
objectIds: [featureOID]
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// Add attachment
|
|
159
|
-
const formData = new FormData();
|
|
160
|
-
formData.append("attachment", fileBlob, "photo.jpg");
|
|
161
|
-
await layer.addAttachment(featureOID, formData);
|
|
162
|
-
|
|
163
|
-
// Delete attachment
|
|
164
|
-
await layer.deleteAttachments(featureOID, [attachmentId]);
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Versioning (Branch Versioning)
|
|
168
|
-
|
|
169
|
-
```javascript
|
|
170
|
-
import VersionManagementService from "@arcgis/core/versionManagement/VersionManagementService.js";
|
|
171
|
-
|
|
172
|
-
const vms = new VersionManagementService({
|
|
173
|
-
url: "https://services.arcgis.com/.../VersionManagementServer"
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
await vms.load();
|
|
177
|
-
|
|
178
|
-
// Create version
|
|
179
|
-
const version = await vms.createVersion({
|
|
180
|
-
versionName: "MyEditVersion",
|
|
181
|
-
access: "private"
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// Switch layer to version
|
|
185
|
-
layer.gdbVersion = version.versionName;
|
|
186
|
-
await layer.refresh();
|
|
187
|
-
|
|
188
|
-
// Reconcile and post
|
|
189
|
-
const session = await vms.startEditing({ versionName: version.versionName });
|
|
190
|
-
await layer.applyEdits(edits);
|
|
191
|
-
await vms.reconcile({ sessionId: session.sessionId, withPost: true });
|
|
192
|
-
await vms.stopEditing({ sessionId: session.sessionId, saveEdits: true });
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
## Form Validation
|
|
196
|
-
|
|
197
|
-
```javascript
|
|
198
|
-
const form = new FeatureForm({
|
|
199
|
-
layer: featureLayer,
|
|
200
|
-
formTemplate: {
|
|
201
|
-
elements: [{
|
|
202
|
-
type: "field",
|
|
203
|
-
fieldName: "email",
|
|
204
|
-
validationExpression: {
|
|
205
|
-
expression: `
|
|
206
|
-
var email = $feature.email;
|
|
207
|
-
return IIf(Find("@", email) > 0, true,
|
|
208
|
-
{ valid: false, errorMessage: "Invalid email" });
|
|
209
|
-
`
|
|
210
|
-
}
|
|
211
|
-
}]
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Expression-Based Visibility
|
|
217
|
-
|
|
218
|
-
```javascript
|
|
219
|
-
const formTemplate = {
|
|
220
|
-
elements: [
|
|
221
|
-
{ type: "field", fieldName: "type" },
|
|
222
|
-
{
|
|
223
|
-
type: "field",
|
|
224
|
-
fieldName: "subtype",
|
|
225
|
-
visibilityExpression: "show-subtype"
|
|
226
|
-
}
|
|
227
|
-
],
|
|
228
|
-
expressionInfos: [{
|
|
229
|
-
name: "show-subtype",
|
|
230
|
-
expression: "$feature.type == 'complex'"
|
|
231
|
-
}]
|
|
232
|
-
};
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Related Records
|
|
236
|
-
|
|
237
|
-
```javascript
|
|
238
|
-
const related = await layer.queryRelatedFeatures({
|
|
239
|
-
outFields: ["*"],
|
|
240
|
-
relationshipId: 0,
|
|
241
|
-
objectIds: [selectedFeature.attributes.OBJECTID]
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
// Edit related in Editor
|
|
245
|
-
const editor = new Editor({
|
|
246
|
-
view: view,
|
|
247
|
-
layerInfos: [{
|
|
248
|
-
layer: parentLayer,
|
|
249
|
-
relatedTableInfos: [{
|
|
250
|
-
layer: relatedTable,
|
|
251
|
-
addEnabled: true
|
|
252
|
-
}]
|
|
253
|
-
}]
|
|
254
|
-
});
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
## Common Pitfalls
|
|
258
|
-
|
|
259
|
-
1. **Editing permissions** - User must have edit permissions
|
|
260
|
-
2. **Subtype field** - Must match service configuration
|
|
261
|
-
3. **Version locking** - Versions may lock during editing
|
|
262
|
-
4. **Validation expressions** - Must return true/false or error object
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
applyTo: "**/*.{js,ts,jsx,tsx,html}"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# ArcGIS Maps SDK - Geometry Operations
|
|
6
|
-
|
|
7
|
-
## Geometry Classes
|
|
8
|
-
|
|
9
|
-
| Class | Use Case |
|
|
10
|
-
|-------|----------|
|
|
11
|
-
| Point | Single location |
|
|
12
|
-
| Polyline | Lines and paths |
|
|
13
|
-
| Polygon | Areas with rings |
|
|
14
|
-
| Multipoint | Collection of points |
|
|
15
|
-
| Extent | Bounding box |
|
|
16
|
-
| Circle | Circular geometry |
|
|
17
|
-
| Mesh | 3D mesh |
|
|
18
|
-
|
|
19
|
-
## Creating Geometries
|
|
20
|
-
|
|
21
|
-
### Point
|
|
22
|
-
```javascript
|
|
23
|
-
const point = {
|
|
24
|
-
type: "point",
|
|
25
|
-
longitude: -118.80657,
|
|
26
|
-
latitude: 34.02749,
|
|
27
|
-
spatialReference: { wkid: 4326 }
|
|
28
|
-
};
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Polyline
|
|
32
|
-
```javascript
|
|
33
|
-
const polyline = {
|
|
34
|
-
type: "polyline",
|
|
35
|
-
paths: [
|
|
36
|
-
[[-118.821527, 34.0139576], [-118.814893, 34.0137161]]
|
|
37
|
-
],
|
|
38
|
-
spatialReference: { wkid: 4326 }
|
|
39
|
-
};
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Polygon
|
|
43
|
-
```javascript
|
|
44
|
-
const polygon = {
|
|
45
|
-
type: "polygon",
|
|
46
|
-
rings: [
|
|
47
|
-
// Outer ring (clockwise)
|
|
48
|
-
[[-118.818984, 34.01991], [-118.806796, 34.01991],
|
|
49
|
-
[-118.806796, 34.02937], [-118.818984, 34.02937],
|
|
50
|
-
[-118.818984, 34.01991]]
|
|
51
|
-
],
|
|
52
|
-
spatialReference: { wkid: 4326 }
|
|
53
|
-
};
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Extent
|
|
57
|
-
```javascript
|
|
58
|
-
const extent = {
|
|
59
|
-
type: "extent",
|
|
60
|
-
xmin: -118.82, ymin: 34.01,
|
|
61
|
-
xmax: -118.80, ymax: 34.03,
|
|
62
|
-
spatialReference: { wkid: 4326 }
|
|
63
|
-
};
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Circle
|
|
67
|
-
```javascript
|
|
68
|
-
import Circle from "@arcgis/core/geometry/Circle.js";
|
|
69
|
-
|
|
70
|
-
const circle = new Circle({
|
|
71
|
-
center: [-118.80657, 34.02749],
|
|
72
|
-
radius: 1000,
|
|
73
|
-
radiusUnit: "meters",
|
|
74
|
-
geodesic: true
|
|
75
|
-
});
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Geometry Operators (Modern API)
|
|
79
|
-
|
|
80
|
-
> **Note:** `geometryEngine` is deprecated since 4.29. Use geometry operators instead.
|
|
81
|
-
|
|
82
|
-
### Import Operators
|
|
83
|
-
```javascript
|
|
84
|
-
import buffer from "@arcgis/core/geometry/operators/buffer.js";
|
|
85
|
-
import union from "@arcgis/core/geometry/operators/union.js";
|
|
86
|
-
import contains from "@arcgis/core/geometry/operators/contains.js";
|
|
87
|
-
import intersection from "@arcgis/core/geometry/operators/intersection.js";
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Buffer Operations
|
|
91
|
-
```javascript
|
|
92
|
-
import buffer from "@arcgis/core/geometry/operators/buffer.js";
|
|
93
|
-
import geodesicBuffer from "@arcgis/core/geometry/operators/geodesicBuffer.js";
|
|
94
|
-
|
|
95
|
-
const buffered = buffer.execute(point, 1000);
|
|
96
|
-
|
|
97
|
-
const geoBuffered = geodesicBuffer.execute(point, {
|
|
98
|
-
distance: 1000,
|
|
99
|
-
unit: "meters"
|
|
100
|
-
});
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Spatial Relationships
|
|
104
|
-
```javascript
|
|
105
|
-
import contains from "@arcgis/core/geometry/operators/contains.js";
|
|
106
|
-
import within from "@arcgis/core/geometry/operators/within.js";
|
|
107
|
-
import intersects from "@arcgis/core/geometry/operators/intersects.js";
|
|
108
|
-
|
|
109
|
-
const result = contains.execute(polygon, point); // boolean
|
|
110
|
-
const result = within.execute(point, polygon); // boolean
|
|
111
|
-
const result = intersects.execute(poly1, poly2); // boolean
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Set Operations
|
|
115
|
-
```javascript
|
|
116
|
-
import union from "@arcgis/core/geometry/operators/union.js";
|
|
117
|
-
import intersection from "@arcgis/core/geometry/operators/intersection.js";
|
|
118
|
-
import difference from "@arcgis/core/geometry/operators/difference.js";
|
|
119
|
-
|
|
120
|
-
const combined = union.execute([polygon1, polygon2]);
|
|
121
|
-
const common = intersection.execute(polygon1, polygon2);
|
|
122
|
-
const diff = difference.execute(polygon1, polygon2);
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Measurements
|
|
126
|
-
```javascript
|
|
127
|
-
import area from "@arcgis/core/geometry/operators/area.js";
|
|
128
|
-
import geodesicArea from "@arcgis/core/geometry/operators/geodesicArea.js";
|
|
129
|
-
import length from "@arcgis/core/geometry/operators/length.js";
|
|
130
|
-
import distance from "@arcgis/core/geometry/operators/distance.js";
|
|
131
|
-
|
|
132
|
-
const areaValue = area.execute(polygon);
|
|
133
|
-
const geoArea = geodesicArea.execute(polygon, { unit: "square-kilometers" });
|
|
134
|
-
const dist = distance.execute(point1, point2);
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Geometry Manipulation
|
|
138
|
-
```javascript
|
|
139
|
-
import simplify from "@arcgis/core/geometry/operators/simplify.js";
|
|
140
|
-
import convexHull from "@arcgis/core/geometry/operators/convexHull.js";
|
|
141
|
-
import centroid from "@arcgis/core/geometry/operators/centroid.js";
|
|
142
|
-
|
|
143
|
-
const simplified = simplify.execute(polygon);
|
|
144
|
-
const hull = convexHull.execute(polygon);
|
|
145
|
-
const center = centroid.execute(polygon);
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Projection
|
|
149
|
-
|
|
150
|
-
```javascript
|
|
151
|
-
import projectOperator from "@arcgis/core/geometry/operators/projectOperator.js";
|
|
152
|
-
|
|
153
|
-
await projectOperator.load();
|
|
154
|
-
|
|
155
|
-
const projected = projectOperator.execute(geometry, {
|
|
156
|
-
outSpatialReference: { wkid: 4326 }
|
|
157
|
-
});
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## Web Mercator Utilities
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
import webMercatorUtils from "@arcgis/core/geometry/support/webMercatorUtils.js";
|
|
164
|
-
|
|
165
|
-
const webMercator = webMercatorUtils.geographicToWebMercator(geographicPoint);
|
|
166
|
-
const geographic = webMercatorUtils.webMercatorToGeographic(webMercatorPoint);
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Mesh (3D)
|
|
170
|
-
|
|
171
|
-
```javascript
|
|
172
|
-
import Mesh from "@arcgis/core/geometry/Mesh.js";
|
|
173
|
-
|
|
174
|
-
const box = Mesh.createBox(location, {
|
|
175
|
-
size: { width: 100, height: 100, depth: 50 },
|
|
176
|
-
material: { color: "red" }
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
const sphere = Mesh.createSphere(location, {
|
|
180
|
-
size: 50,
|
|
181
|
-
material: { color: "blue" }
|
|
182
|
-
});
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
## Common Patterns
|
|
186
|
-
|
|
187
|
-
### Check if Point is in Polygon
|
|
188
|
-
```javascript
|
|
189
|
-
import contains from "@arcgis/core/geometry/operators/contains.js";
|
|
190
|
-
|
|
191
|
-
function isPointInPolygon(point, polygon) {
|
|
192
|
-
return contains.execute(polygon, point);
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Buffer and Query
|
|
197
|
-
```javascript
|
|
198
|
-
import geodesicBuffer from "@arcgis/core/geometry/operators/geodesicBuffer.js";
|
|
199
|
-
|
|
200
|
-
async function queryWithinDistance(point, distance, layer) {
|
|
201
|
-
const buffer = geodesicBuffer.execute(point, { distance, unit: "meters" });
|
|
202
|
-
const query = layer.createQuery();
|
|
203
|
-
query.geometry = buffer;
|
|
204
|
-
query.spatialRelationship = "contains";
|
|
205
|
-
return await layer.queryFeatures(query);
|
|
206
|
-
}
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
## Available Operators
|
|
210
|
-
|
|
211
|
-
| Category | Operators |
|
|
212
|
-
|----------|-----------|
|
|
213
|
-
| Relationship | `contains`, `crosses`, `disjoint`, `equals`, `intersects`, `overlaps`, `touches`, `within` |
|
|
214
|
-
| Set Operations | `clip`, `difference`, `intersection`, `symmetricDifference`, `union` |
|
|
215
|
-
| Buffer | `buffer`, `geodesicBuffer` |
|
|
216
|
-
| Measurement | `area`, `geodesicArea`, `length`, `geodesicLength`, `distance` |
|
|
217
|
-
| Transform | `densify`, `generalize`, `offset`, `project`, `rotate` |
|
|
218
|
-
| Analysis | `centroid`, `convexHull`, `labelPoint`, `simplify` |
|
|
219
|
-
|
|
220
|
-
## Common Pitfalls
|
|
221
|
-
|
|
222
|
-
1. **Spatial reference mismatch** - Ensure geometries are in same SR before operations
|
|
223
|
-
2. **Geodesic vs Planar** - Use geodesic operators for geographic coordinates (WGS84)
|
|
224
|
-
3. **Ring orientation** - Outer rings clockwise, holes counter-clockwise
|
|
225
|
-
4. **Load projection engine** - Call `projectOperator.load()` before projecting
|