@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.
- package/README.md +163 -203
- 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/{claude → skills}/arcgis-starter-app-extended/SKILL.md +649 -649
- 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 +19 -104
- 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-starter-app-extended.instructions.md +0 -643
- package/contexts/4.34/copilot/arcgis-starter-app.instructions.md +0 -268
- 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/contexts/4.34/{claude → skills}/arcgis-starter-app/SKILL.md +0 -0
|
@@ -1,393 +1,393 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: arcgis-feature-effects
|
|
3
|
-
description: Apply visual effects to features including filters, drop shadows, blur, and grayscale. Use for highlighting features and creating visual emphasis.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# ArcGIS Feature Effects
|
|
7
|
-
|
|
8
|
-
Use this skill for applying visual effects, filters, and emphasis to features.
|
|
9
|
-
|
|
10
|
-
## Feature Effect Basics
|
|
11
|
-
|
|
12
|
-
### Basic Feature Effect
|
|
13
|
-
```javascript
|
|
14
|
-
layer.featureEffect = {
|
|
15
|
-
filter: {
|
|
16
|
-
where: "population > 100000"
|
|
17
|
-
},
|
|
18
|
-
includedEffect: "bloom(1.5, 0.5px, 0.2)",
|
|
19
|
-
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
20
|
-
};
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Feature Effect on LayerView
|
|
24
|
-
```javascript
|
|
25
|
-
const layerView = await view.whenLayerView(layer);
|
|
26
|
-
|
|
27
|
-
layerView.featureEffect = {
|
|
28
|
-
filter: {
|
|
29
|
-
where: "status = 'Active'"
|
|
30
|
-
},
|
|
31
|
-
excludedEffect: "grayscale(100%) opacity(50%)"
|
|
32
|
-
};
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Effect Types
|
|
36
|
-
|
|
37
|
-
### Opacity Effect
|
|
38
|
-
```javascript
|
|
39
|
-
// Make excluded features transparent
|
|
40
|
-
layer.featureEffect = {
|
|
41
|
-
filter: { where: "type = 'primary'" },
|
|
42
|
-
excludedEffect: "opacity(25%)"
|
|
43
|
-
};
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Grayscale Effect
|
|
47
|
-
```javascript
|
|
48
|
-
// Grayscale excluded features
|
|
49
|
-
layer.featureEffect = {
|
|
50
|
-
filter: { where: "category = 'important'" },
|
|
51
|
-
excludedEffect: "grayscale(100%)"
|
|
52
|
-
};
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Blur Effect
|
|
56
|
-
```javascript
|
|
57
|
-
// Blur excluded features
|
|
58
|
-
layer.featureEffect = {
|
|
59
|
-
filter: { where: "highlighted = 1" },
|
|
60
|
-
excludedEffect: "blur(5px)"
|
|
61
|
-
};
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Drop Shadow Effect
|
|
65
|
-
```javascript
|
|
66
|
-
// Add drop shadow to included features
|
|
67
|
-
layer.featureEffect = {
|
|
68
|
-
filter: { where: "selected = 1" },
|
|
69
|
-
includedEffect: "drop-shadow(3px, 3px, 4px, #000000)"
|
|
70
|
-
};
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Bloom Effect
|
|
74
|
-
```javascript
|
|
75
|
-
// Add glow to included features
|
|
76
|
-
layer.featureEffect = {
|
|
77
|
-
filter: { where: "active = 1" },
|
|
78
|
-
includedEffect: "bloom(1.5, 0.5px, 0.2)"
|
|
79
|
-
};
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Brightness and Contrast
|
|
83
|
-
```javascript
|
|
84
|
-
layer.featureEffect = {
|
|
85
|
-
filter: { where: "status = 'highlight'" },
|
|
86
|
-
includedEffect: "brightness(150%) contrast(120%)",
|
|
87
|
-
excludedEffect: "brightness(50%)"
|
|
88
|
-
};
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Invert Colors
|
|
92
|
-
```javascript
|
|
93
|
-
layer.featureEffect = {
|
|
94
|
-
filter: { where: "type = 'special'" },
|
|
95
|
-
includedEffect: "invert(100%)"
|
|
96
|
-
};
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Sepia Effect
|
|
100
|
-
```javascript
|
|
101
|
-
layer.featureEffect = {
|
|
102
|
-
filter: { where: "year < 1900" },
|
|
103
|
-
includedEffect: "sepia(100%)"
|
|
104
|
-
};
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Saturate Effect
|
|
108
|
-
```javascript
|
|
109
|
-
layer.featureEffect = {
|
|
110
|
-
filter: { where: "priority = 'high'" },
|
|
111
|
-
includedEffect: "saturate(200%)",
|
|
112
|
-
excludedEffect: "saturate(20%)"
|
|
113
|
-
};
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Hue Rotate
|
|
117
|
-
```javascript
|
|
118
|
-
layer.featureEffect = {
|
|
119
|
-
filter: { where: "category = 'alternate'" },
|
|
120
|
-
includedEffect: "hue-rotate(180deg)"
|
|
121
|
-
};
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## Combining Effects
|
|
125
|
-
|
|
126
|
-
### Multiple Effects
|
|
127
|
-
```javascript
|
|
128
|
-
layer.featureEffect = {
|
|
129
|
-
filter: { where: "status = 'active'" },
|
|
130
|
-
includedEffect: "drop-shadow(2px, 2px, 3px) brightness(120%)",
|
|
131
|
-
excludedEffect: "grayscale(100%) opacity(30%) blur(2px)"
|
|
132
|
-
};
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Geometry-Based Filters
|
|
136
|
-
|
|
137
|
-
### Spatial Filter with Effect
|
|
138
|
-
```javascript
|
|
139
|
-
const layerView = await view.whenLayerView(layer);
|
|
140
|
-
|
|
141
|
-
layerView.featureEffect = {
|
|
142
|
-
filter: {
|
|
143
|
-
geometry: polygon,
|
|
144
|
-
spatialRelationship: "intersects"
|
|
145
|
-
},
|
|
146
|
-
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
147
|
-
};
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Distance-Based Filter
|
|
151
|
-
```javascript
|
|
152
|
-
layerView.featureEffect = {
|
|
153
|
-
filter: {
|
|
154
|
-
geometry: point,
|
|
155
|
-
spatialRelationship: "intersects",
|
|
156
|
-
distance: 1000,
|
|
157
|
-
units: "meters"
|
|
158
|
-
},
|
|
159
|
-
excludedEffect: "opacity(20%)"
|
|
160
|
-
};
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Multiple Spatial Relationships
|
|
164
|
-
```javascript
|
|
165
|
-
// Features intersecting, containing, within, etc.
|
|
166
|
-
const spatialRelationships = [
|
|
167
|
-
"intersects", "contains", "crosses",
|
|
168
|
-
"envelope-intersects", "overlaps",
|
|
169
|
-
"touches", "within", "disjoint"
|
|
170
|
-
];
|
|
171
|
-
|
|
172
|
-
layerView.featureEffect = {
|
|
173
|
-
filter: {
|
|
174
|
-
geometry: filterGeometry,
|
|
175
|
-
spatialRelationship: "within"
|
|
176
|
-
},
|
|
177
|
-
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
178
|
-
};
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Time-Based Filters
|
|
182
|
-
|
|
183
|
-
### Time Filter with Effect
|
|
184
|
-
```javascript
|
|
185
|
-
layer.featureEffect = {
|
|
186
|
-
filter: {
|
|
187
|
-
timeExtent: {
|
|
188
|
-
start: new Date("2020-01-01"),
|
|
189
|
-
end: new Date("2020-12-31")
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
excludedEffect: "opacity(20%)"
|
|
193
|
-
};
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## Display Filter
|
|
197
|
-
|
|
198
|
-
### Display Filter (Performance Optimization)
|
|
199
|
-
```javascript
|
|
200
|
-
// Display filter completely hides features (better performance)
|
|
201
|
-
layer.displayFilter = {
|
|
202
|
-
where: "population > 10000"
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
// Combined with feature effect
|
|
206
|
-
layer.displayFilter = {
|
|
207
|
-
where: "status != 'deleted'"
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
layer.featureEffect = {
|
|
211
|
-
filter: { where: "status = 'active'" },
|
|
212
|
-
excludedEffect: "opacity(50%)"
|
|
213
|
-
};
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Interactive Feature Effects
|
|
217
|
-
|
|
218
|
-
### Effect on Click
|
|
219
|
-
```javascript
|
|
220
|
-
view.on("click", async (event) => {
|
|
221
|
-
const response = await view.hitTest(event);
|
|
222
|
-
const graphic = response.results[0]?.graphic;
|
|
223
|
-
|
|
224
|
-
if (graphic) {
|
|
225
|
-
const oid = graphic.attributes.OBJECTID;
|
|
226
|
-
layerView.featureEffect = {
|
|
227
|
-
filter: {
|
|
228
|
-
objectIds: [oid]
|
|
229
|
-
},
|
|
230
|
-
includedEffect: "drop-shadow(3px, 3px, 4px)",
|
|
231
|
-
excludedEffect: "grayscale(100%) opacity(40%)"
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Effect with Slider
|
|
238
|
-
```javascript
|
|
239
|
-
const slider = new Slider({
|
|
240
|
-
container: "sliderDiv",
|
|
241
|
-
min: 0,
|
|
242
|
-
max: 100,
|
|
243
|
-
values: [50]
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
slider.on("thumb-drag", (event) => {
|
|
247
|
-
const value = event.value;
|
|
248
|
-
layer.featureEffect = {
|
|
249
|
-
filter: { where: `value > ${value}` },
|
|
250
|
-
excludedEffect: `opacity(${100 - value}%)`
|
|
251
|
-
};
|
|
252
|
-
});
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Clear Feature Effect
|
|
256
|
-
```javascript
|
|
257
|
-
layer.featureEffect = null;
|
|
258
|
-
// or
|
|
259
|
-
layerView.featureEffect = null;
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## Effect with Histogram
|
|
263
|
-
|
|
264
|
-
### Feature Effect with Histogram Widget
|
|
265
|
-
```javascript
|
|
266
|
-
import Histogram from "@arcgis/core/widgets/Histogram.js";
|
|
267
|
-
import HistogramRangeSlider from "@arcgis/core/widgets/HistogramRangeSlider.js";
|
|
268
|
-
import generateHistogram from "@arcgis/core/smartMapping/statistics/histogram.js";
|
|
269
|
-
|
|
270
|
-
// Generate histogram for field
|
|
271
|
-
const histogramResult = await generateHistogram({
|
|
272
|
-
layer: layer,
|
|
273
|
-
field: "population",
|
|
274
|
-
numBins: 30
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
const slider = new HistogramRangeSlider({
|
|
278
|
-
bins: histogramResult.bins,
|
|
279
|
-
min: histogramResult.minValue,
|
|
280
|
-
max: histogramResult.maxValue,
|
|
281
|
-
values: [histogramResult.minValue, histogramResult.maxValue]
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
slider.on("thumb-drag", () => {
|
|
285
|
-
const [min, max] = slider.values;
|
|
286
|
-
layerView.featureEffect = {
|
|
287
|
-
filter: {
|
|
288
|
-
where: `population >= ${min} AND population <= ${max}`
|
|
289
|
-
},
|
|
290
|
-
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
291
|
-
};
|
|
292
|
-
});
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
## Complete Example
|
|
296
|
-
|
|
297
|
-
```html
|
|
298
|
-
<!DOCTYPE html>
|
|
299
|
-
<html>
|
|
300
|
-
<head>
|
|
301
|
-
<link rel="stylesheet" href="https://js.arcgis.com/4.34/esri/themes/light/main.css" />
|
|
302
|
-
<script src="https://js.arcgis.com/4.34/"></script>
|
|
303
|
-
<style>
|
|
304
|
-
html, body, #viewDiv { height: 100%; margin: 0; }
|
|
305
|
-
#controls { position: absolute; top: 10px; right: 10px; background: white; padding: 10px; }
|
|
306
|
-
</style>
|
|
307
|
-
<script type="module">
|
|
308
|
-
import Map from "@arcgis/core/Map.js";
|
|
309
|
-
import MapView from "@arcgis/core/views/MapView.js";
|
|
310
|
-
import FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
|
|
311
|
-
|
|
312
|
-
const layer = new FeatureLayer({
|
|
313
|
-
url: "https://services.arcgis.com/.../FeatureServer/0"
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
const map = new Map({
|
|
317
|
-
basemap: "gray-vector",
|
|
318
|
-
layers: [layer]
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
const view = new MapView({
|
|
322
|
-
container: "viewDiv",
|
|
323
|
-
map: map
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
const layerView = await view.whenLayerView(layer);
|
|
327
|
-
|
|
328
|
-
// Apply effect on dropdown change
|
|
329
|
-
document.getElementById("effectSelect").onchange = (e) => {
|
|
330
|
-
const effect = e.target.value;
|
|
331
|
-
|
|
332
|
-
switch(effect) {
|
|
333
|
-
case "highlight":
|
|
334
|
-
layerView.featureEffect = {
|
|
335
|
-
filter: { where: "type = 'primary'" },
|
|
336
|
-
includedEffect: "drop-shadow(2px, 2px, 3px)",
|
|
337
|
-
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
338
|
-
};
|
|
339
|
-
break;
|
|
340
|
-
case "blur":
|
|
341
|
-
layerView.featureEffect = {
|
|
342
|
-
filter: { where: "status = 'active'" },
|
|
343
|
-
excludedEffect: "blur(3px) opacity(50%)"
|
|
344
|
-
};
|
|
345
|
-
break;
|
|
346
|
-
case "none":
|
|
347
|
-
layerView.featureEffect = null;
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
</script>
|
|
352
|
-
</head>
|
|
353
|
-
<body>
|
|
354
|
-
<div id="viewDiv"></div>
|
|
355
|
-
<div id="controls" class="esri-widget">
|
|
356
|
-
<select id="effectSelect">
|
|
357
|
-
<option value="none">No Effect</option>
|
|
358
|
-
<option value="highlight">Highlight</option>
|
|
359
|
-
<option value="blur">Blur</option>
|
|
360
|
-
</select>
|
|
361
|
-
</div>
|
|
362
|
-
</body>
|
|
363
|
-
</html>
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
## Effect Reference
|
|
367
|
-
|
|
368
|
-
| Effect | Syntax | Description |
|
|
369
|
-
|--------|--------|-------------|
|
|
370
|
-
| opacity | `opacity(50%)` | Transparency (0-100%) |
|
|
371
|
-
| grayscale | `grayscale(100%)` | Remove color (0-100%) |
|
|
372
|
-
| blur | `blur(5px)` | Gaussian blur |
|
|
373
|
-
| drop-shadow | `drop-shadow(x, y, blur, color)` | Shadow effect |
|
|
374
|
-
| bloom | `bloom(strength, radius, threshold)` | Glow effect |
|
|
375
|
-
| brightness | `brightness(150%)` | Adjust brightness |
|
|
376
|
-
| contrast | `contrast(120%)` | Adjust contrast |
|
|
377
|
-
| invert | `invert(100%)` | Invert colors |
|
|
378
|
-
| sepia | `sepia(100%)` | Sepia tone |
|
|
379
|
-
| saturate | `saturate(200%)` | Color saturation |
|
|
380
|
-
| hue-rotate | `hue-rotate(180deg)` | Rotate hue |
|
|
381
|
-
|
|
382
|
-
## Common Pitfalls
|
|
383
|
-
|
|
384
|
-
1. **Layer vs LayerView**: Feature effects on layer affect all views; on layerView only that view
|
|
385
|
-
|
|
386
|
-
2. **Performance**: Complex effects on many features can impact performance
|
|
387
|
-
|
|
388
|
-
3. **Combining effects**: Effects are applied in order listed
|
|
389
|
-
|
|
390
|
-
4. **Display filter vs feature effect**: Use display filter for hiding, feature effect for styling
|
|
391
|
-
|
|
392
|
-
5. **Time extent**: Time-based filters require layer to have time info
|
|
393
|
-
|
|
1
|
+
---
|
|
2
|
+
name: arcgis-feature-effects
|
|
3
|
+
description: Apply visual effects to features including filters, drop shadows, blur, and grayscale. Use for highlighting features and creating visual emphasis.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ArcGIS Feature Effects
|
|
7
|
+
|
|
8
|
+
Use this skill for applying visual effects, filters, and emphasis to features.
|
|
9
|
+
|
|
10
|
+
## Feature Effect Basics
|
|
11
|
+
|
|
12
|
+
### Basic Feature Effect
|
|
13
|
+
```javascript
|
|
14
|
+
layer.featureEffect = {
|
|
15
|
+
filter: {
|
|
16
|
+
where: "population > 100000"
|
|
17
|
+
},
|
|
18
|
+
includedEffect: "bloom(1.5, 0.5px, 0.2)",
|
|
19
|
+
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
20
|
+
};
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Feature Effect on LayerView
|
|
24
|
+
```javascript
|
|
25
|
+
const layerView = await view.whenLayerView(layer);
|
|
26
|
+
|
|
27
|
+
layerView.featureEffect = {
|
|
28
|
+
filter: {
|
|
29
|
+
where: "status = 'Active'"
|
|
30
|
+
},
|
|
31
|
+
excludedEffect: "grayscale(100%) opacity(50%)"
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Effect Types
|
|
36
|
+
|
|
37
|
+
### Opacity Effect
|
|
38
|
+
```javascript
|
|
39
|
+
// Make excluded features transparent
|
|
40
|
+
layer.featureEffect = {
|
|
41
|
+
filter: { where: "type = 'primary'" },
|
|
42
|
+
excludedEffect: "opacity(25%)"
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Grayscale Effect
|
|
47
|
+
```javascript
|
|
48
|
+
// Grayscale excluded features
|
|
49
|
+
layer.featureEffect = {
|
|
50
|
+
filter: { where: "category = 'important'" },
|
|
51
|
+
excludedEffect: "grayscale(100%)"
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Blur Effect
|
|
56
|
+
```javascript
|
|
57
|
+
// Blur excluded features
|
|
58
|
+
layer.featureEffect = {
|
|
59
|
+
filter: { where: "highlighted = 1" },
|
|
60
|
+
excludedEffect: "blur(5px)"
|
|
61
|
+
};
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Drop Shadow Effect
|
|
65
|
+
```javascript
|
|
66
|
+
// Add drop shadow to included features
|
|
67
|
+
layer.featureEffect = {
|
|
68
|
+
filter: { where: "selected = 1" },
|
|
69
|
+
includedEffect: "drop-shadow(3px, 3px, 4px, #000000)"
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Bloom Effect
|
|
74
|
+
```javascript
|
|
75
|
+
// Add glow to included features
|
|
76
|
+
layer.featureEffect = {
|
|
77
|
+
filter: { where: "active = 1" },
|
|
78
|
+
includedEffect: "bloom(1.5, 0.5px, 0.2)"
|
|
79
|
+
};
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Brightness and Contrast
|
|
83
|
+
```javascript
|
|
84
|
+
layer.featureEffect = {
|
|
85
|
+
filter: { where: "status = 'highlight'" },
|
|
86
|
+
includedEffect: "brightness(150%) contrast(120%)",
|
|
87
|
+
excludedEffect: "brightness(50%)"
|
|
88
|
+
};
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Invert Colors
|
|
92
|
+
```javascript
|
|
93
|
+
layer.featureEffect = {
|
|
94
|
+
filter: { where: "type = 'special'" },
|
|
95
|
+
includedEffect: "invert(100%)"
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Sepia Effect
|
|
100
|
+
```javascript
|
|
101
|
+
layer.featureEffect = {
|
|
102
|
+
filter: { where: "year < 1900" },
|
|
103
|
+
includedEffect: "sepia(100%)"
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Saturate Effect
|
|
108
|
+
```javascript
|
|
109
|
+
layer.featureEffect = {
|
|
110
|
+
filter: { where: "priority = 'high'" },
|
|
111
|
+
includedEffect: "saturate(200%)",
|
|
112
|
+
excludedEffect: "saturate(20%)"
|
|
113
|
+
};
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Hue Rotate
|
|
117
|
+
```javascript
|
|
118
|
+
layer.featureEffect = {
|
|
119
|
+
filter: { where: "category = 'alternate'" },
|
|
120
|
+
includedEffect: "hue-rotate(180deg)"
|
|
121
|
+
};
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Combining Effects
|
|
125
|
+
|
|
126
|
+
### Multiple Effects
|
|
127
|
+
```javascript
|
|
128
|
+
layer.featureEffect = {
|
|
129
|
+
filter: { where: "status = 'active'" },
|
|
130
|
+
includedEffect: "drop-shadow(2px, 2px, 3px) brightness(120%)",
|
|
131
|
+
excludedEffect: "grayscale(100%) opacity(30%) blur(2px)"
|
|
132
|
+
};
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Geometry-Based Filters
|
|
136
|
+
|
|
137
|
+
### Spatial Filter with Effect
|
|
138
|
+
```javascript
|
|
139
|
+
const layerView = await view.whenLayerView(layer);
|
|
140
|
+
|
|
141
|
+
layerView.featureEffect = {
|
|
142
|
+
filter: {
|
|
143
|
+
geometry: polygon,
|
|
144
|
+
spatialRelationship: "intersects"
|
|
145
|
+
},
|
|
146
|
+
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
147
|
+
};
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Distance-Based Filter
|
|
151
|
+
```javascript
|
|
152
|
+
layerView.featureEffect = {
|
|
153
|
+
filter: {
|
|
154
|
+
geometry: point,
|
|
155
|
+
spatialRelationship: "intersects",
|
|
156
|
+
distance: 1000,
|
|
157
|
+
units: "meters"
|
|
158
|
+
},
|
|
159
|
+
excludedEffect: "opacity(20%)"
|
|
160
|
+
};
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Multiple Spatial Relationships
|
|
164
|
+
```javascript
|
|
165
|
+
// Features intersecting, containing, within, etc.
|
|
166
|
+
const spatialRelationships = [
|
|
167
|
+
"intersects", "contains", "crosses",
|
|
168
|
+
"envelope-intersects", "overlaps",
|
|
169
|
+
"touches", "within", "disjoint"
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
layerView.featureEffect = {
|
|
173
|
+
filter: {
|
|
174
|
+
geometry: filterGeometry,
|
|
175
|
+
spatialRelationship: "within"
|
|
176
|
+
},
|
|
177
|
+
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
178
|
+
};
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Time-Based Filters
|
|
182
|
+
|
|
183
|
+
### Time Filter with Effect
|
|
184
|
+
```javascript
|
|
185
|
+
layer.featureEffect = {
|
|
186
|
+
filter: {
|
|
187
|
+
timeExtent: {
|
|
188
|
+
start: new Date("2020-01-01"),
|
|
189
|
+
end: new Date("2020-12-31")
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
excludedEffect: "opacity(20%)"
|
|
193
|
+
};
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Display Filter
|
|
197
|
+
|
|
198
|
+
### Display Filter (Performance Optimization)
|
|
199
|
+
```javascript
|
|
200
|
+
// Display filter completely hides features (better performance)
|
|
201
|
+
layer.displayFilter = {
|
|
202
|
+
where: "population > 10000"
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// Combined with feature effect
|
|
206
|
+
layer.displayFilter = {
|
|
207
|
+
where: "status != 'deleted'"
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
layer.featureEffect = {
|
|
211
|
+
filter: { where: "status = 'active'" },
|
|
212
|
+
excludedEffect: "opacity(50%)"
|
|
213
|
+
};
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Interactive Feature Effects
|
|
217
|
+
|
|
218
|
+
### Effect on Click
|
|
219
|
+
```javascript
|
|
220
|
+
view.on("click", async (event) => {
|
|
221
|
+
const response = await view.hitTest(event);
|
|
222
|
+
const graphic = response.results[0]?.graphic;
|
|
223
|
+
|
|
224
|
+
if (graphic) {
|
|
225
|
+
const oid = graphic.attributes.OBJECTID;
|
|
226
|
+
layerView.featureEffect = {
|
|
227
|
+
filter: {
|
|
228
|
+
objectIds: [oid]
|
|
229
|
+
},
|
|
230
|
+
includedEffect: "drop-shadow(3px, 3px, 4px)",
|
|
231
|
+
excludedEffect: "grayscale(100%) opacity(40%)"
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Effect with Slider
|
|
238
|
+
```javascript
|
|
239
|
+
const slider = new Slider({
|
|
240
|
+
container: "sliderDiv",
|
|
241
|
+
min: 0,
|
|
242
|
+
max: 100,
|
|
243
|
+
values: [50]
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
slider.on("thumb-drag", (event) => {
|
|
247
|
+
const value = event.value;
|
|
248
|
+
layer.featureEffect = {
|
|
249
|
+
filter: { where: `value > ${value}` },
|
|
250
|
+
excludedEffect: `opacity(${100 - value}%)`
|
|
251
|
+
};
|
|
252
|
+
});
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Clear Feature Effect
|
|
256
|
+
```javascript
|
|
257
|
+
layer.featureEffect = null;
|
|
258
|
+
// or
|
|
259
|
+
layerView.featureEffect = null;
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Effect with Histogram
|
|
263
|
+
|
|
264
|
+
### Feature Effect with Histogram Widget
|
|
265
|
+
```javascript
|
|
266
|
+
import Histogram from "@arcgis/core/widgets/Histogram.js";
|
|
267
|
+
import HistogramRangeSlider from "@arcgis/core/widgets/HistogramRangeSlider.js";
|
|
268
|
+
import generateHistogram from "@arcgis/core/smartMapping/statistics/histogram.js";
|
|
269
|
+
|
|
270
|
+
// Generate histogram for field
|
|
271
|
+
const histogramResult = await generateHistogram({
|
|
272
|
+
layer: layer,
|
|
273
|
+
field: "population",
|
|
274
|
+
numBins: 30
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const slider = new HistogramRangeSlider({
|
|
278
|
+
bins: histogramResult.bins,
|
|
279
|
+
min: histogramResult.minValue,
|
|
280
|
+
max: histogramResult.maxValue,
|
|
281
|
+
values: [histogramResult.minValue, histogramResult.maxValue]
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
slider.on("thumb-drag", () => {
|
|
285
|
+
const [min, max] = slider.values;
|
|
286
|
+
layerView.featureEffect = {
|
|
287
|
+
filter: {
|
|
288
|
+
where: `population >= ${min} AND population <= ${max}`
|
|
289
|
+
},
|
|
290
|
+
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Complete Example
|
|
296
|
+
|
|
297
|
+
```html
|
|
298
|
+
<!DOCTYPE html>
|
|
299
|
+
<html>
|
|
300
|
+
<head>
|
|
301
|
+
<link rel="stylesheet" href="https://js.arcgis.com/4.34/esri/themes/light/main.css" />
|
|
302
|
+
<script src="https://js.arcgis.com/4.34/"></script>
|
|
303
|
+
<style>
|
|
304
|
+
html, body, #viewDiv { height: 100%; margin: 0; }
|
|
305
|
+
#controls { position: absolute; top: 10px; right: 10px; background: white; padding: 10px; }
|
|
306
|
+
</style>
|
|
307
|
+
<script type="module">
|
|
308
|
+
import Map from "@arcgis/core/Map.js";
|
|
309
|
+
import MapView from "@arcgis/core/views/MapView.js";
|
|
310
|
+
import FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
|
|
311
|
+
|
|
312
|
+
const layer = new FeatureLayer({
|
|
313
|
+
url: "https://services.arcgis.com/.../FeatureServer/0"
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
const map = new Map({
|
|
317
|
+
basemap: "gray-vector",
|
|
318
|
+
layers: [layer]
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
const view = new MapView({
|
|
322
|
+
container: "viewDiv",
|
|
323
|
+
map: map
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
const layerView = await view.whenLayerView(layer);
|
|
327
|
+
|
|
328
|
+
// Apply effect on dropdown change
|
|
329
|
+
document.getElementById("effectSelect").onchange = (e) => {
|
|
330
|
+
const effect = e.target.value;
|
|
331
|
+
|
|
332
|
+
switch(effect) {
|
|
333
|
+
case "highlight":
|
|
334
|
+
layerView.featureEffect = {
|
|
335
|
+
filter: { where: "type = 'primary'" },
|
|
336
|
+
includedEffect: "drop-shadow(2px, 2px, 3px)",
|
|
337
|
+
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
338
|
+
};
|
|
339
|
+
break;
|
|
340
|
+
case "blur":
|
|
341
|
+
layerView.featureEffect = {
|
|
342
|
+
filter: { where: "status = 'active'" },
|
|
343
|
+
excludedEffect: "blur(3px) opacity(50%)"
|
|
344
|
+
};
|
|
345
|
+
break;
|
|
346
|
+
case "none":
|
|
347
|
+
layerView.featureEffect = null;
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
</script>
|
|
352
|
+
</head>
|
|
353
|
+
<body>
|
|
354
|
+
<div id="viewDiv"></div>
|
|
355
|
+
<div id="controls" class="esri-widget">
|
|
356
|
+
<select id="effectSelect">
|
|
357
|
+
<option value="none">No Effect</option>
|
|
358
|
+
<option value="highlight">Highlight</option>
|
|
359
|
+
<option value="blur">Blur</option>
|
|
360
|
+
</select>
|
|
361
|
+
</div>
|
|
362
|
+
</body>
|
|
363
|
+
</html>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## Effect Reference
|
|
367
|
+
|
|
368
|
+
| Effect | Syntax | Description |
|
|
369
|
+
|--------|--------|-------------|
|
|
370
|
+
| opacity | `opacity(50%)` | Transparency (0-100%) |
|
|
371
|
+
| grayscale | `grayscale(100%)` | Remove color (0-100%) |
|
|
372
|
+
| blur | `blur(5px)` | Gaussian blur |
|
|
373
|
+
| drop-shadow | `drop-shadow(x, y, blur, color)` | Shadow effect |
|
|
374
|
+
| bloom | `bloom(strength, radius, threshold)` | Glow effect |
|
|
375
|
+
| brightness | `brightness(150%)` | Adjust brightness |
|
|
376
|
+
| contrast | `contrast(120%)` | Adjust contrast |
|
|
377
|
+
| invert | `invert(100%)` | Invert colors |
|
|
378
|
+
| sepia | `sepia(100%)` | Sepia tone |
|
|
379
|
+
| saturate | `saturate(200%)` | Color saturation |
|
|
380
|
+
| hue-rotate | `hue-rotate(180deg)` | Rotate hue |
|
|
381
|
+
|
|
382
|
+
## Common Pitfalls
|
|
383
|
+
|
|
384
|
+
1. **Layer vs LayerView**: Feature effects on layer affect all views; on layerView only that view
|
|
385
|
+
|
|
386
|
+
2. **Performance**: Complex effects on many features can impact performance
|
|
387
|
+
|
|
388
|
+
3. **Combining effects**: Effects are applied in order listed
|
|
389
|
+
|
|
390
|
+
4. **Display filter vs feature effect**: Use display filter for hiding, feature effect for styling
|
|
391
|
+
|
|
392
|
+
5. **Time extent**: Time-based filters require layer to have time info
|
|
393
|
+
|