@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,580 +1,580 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: arcgis-visualization
|
|
3
|
-
description: Style and render geographic data with renderers, symbols, and visual variables. Use for creating thematic maps, heatmaps, class breaks, unique values, labels, and 3D visualization.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# ArcGIS Visualization
|
|
7
|
-
|
|
8
|
-
Use this skill when styling layers with renderers, symbols, visual variables, labels, and effects.
|
|
9
|
-
|
|
10
|
-
## Renderer Types Overview
|
|
11
|
-
|
|
12
|
-
| Renderer | Use Case |
|
|
13
|
-
|----------|----------|
|
|
14
|
-
| SimpleRenderer | Same symbol for all features |
|
|
15
|
-
| UniqueValueRenderer | Different symbols by category |
|
|
16
|
-
| ClassBreaksRenderer | Different symbols by numeric ranges |
|
|
17
|
-
| HeatmapRenderer | Density visualization |
|
|
18
|
-
| DotDensityRenderer | Dot density maps |
|
|
19
|
-
| DictionaryRenderer | Military symbology |
|
|
20
|
-
|
|
21
|
-
## SimpleRenderer
|
|
22
|
-
|
|
23
|
-
```javascript
|
|
24
|
-
const renderer = {
|
|
25
|
-
type: "simple",
|
|
26
|
-
symbol: {
|
|
27
|
-
type: "simple-marker",
|
|
28
|
-
color: "blue",
|
|
29
|
-
size: 8,
|
|
30
|
-
outline: {
|
|
31
|
-
color: "white",
|
|
32
|
-
width: 1
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
layer.renderer = renderer;
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### With Visual Variables
|
|
41
|
-
```javascript
|
|
42
|
-
const renderer = {
|
|
43
|
-
type: "simple",
|
|
44
|
-
symbol: {
|
|
45
|
-
type: "simple-marker",
|
|
46
|
-
color: "#13EB0C",
|
|
47
|
-
outline: { color: "#A9A9A9", width: 0.5 }
|
|
48
|
-
},
|
|
49
|
-
visualVariables: [{
|
|
50
|
-
type: "size",
|
|
51
|
-
field: "population",
|
|
52
|
-
stops: [
|
|
53
|
-
{ value: 1000, size: 4 },
|
|
54
|
-
{ value: 10000, size: 12 },
|
|
55
|
-
{ value: 100000, size: 24 }
|
|
56
|
-
]
|
|
57
|
-
}]
|
|
58
|
-
};
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## UniqueValueRenderer
|
|
62
|
-
|
|
63
|
-
### Basic Unique Values
|
|
64
|
-
```javascript
|
|
65
|
-
const renderer = {
|
|
66
|
-
type: "unique-value",
|
|
67
|
-
field: "type",
|
|
68
|
-
defaultSymbol: { type: "simple-fill", color: "gray" },
|
|
69
|
-
uniqueValueInfos: [
|
|
70
|
-
{
|
|
71
|
-
value: "residential",
|
|
72
|
-
symbol: { type: "simple-fill", color: "#FFFF00" },
|
|
73
|
-
label: "Residential"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
value: "commercial",
|
|
77
|
-
symbol: { type: "simple-fill", color: "#FF0000" },
|
|
78
|
-
label: "Commercial"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
value: "industrial",
|
|
82
|
-
symbol: { type: "simple-fill", color: "#800080" },
|
|
83
|
-
label: "Industrial"
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
};
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Grouped Unique Values (with headings in legend)
|
|
90
|
-
```javascript
|
|
91
|
-
const renderer = {
|
|
92
|
-
type: "unique-value",
|
|
93
|
-
field: "zonecode",
|
|
94
|
-
uniqueValueGroups: [
|
|
95
|
-
{
|
|
96
|
-
heading: "Commercial",
|
|
97
|
-
classes: [
|
|
98
|
-
{
|
|
99
|
-
label: "C-1 | Neighborhood Commercial",
|
|
100
|
-
symbol: createFillSymbol([189, 145, 145]),
|
|
101
|
-
values: "C-1"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
label: "C-2 | Community Commercial",
|
|
105
|
-
symbol: createFillSymbol([255, 179, 219]),
|
|
106
|
-
values: "C-2"
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
heading: "Residential",
|
|
112
|
-
classes: [
|
|
113
|
-
{
|
|
114
|
-
label: "R-1 | Low Density",
|
|
115
|
-
symbol: createFillSymbol([255, 255, 224]),
|
|
116
|
-
values: "R-1"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
label: "Special Areas",
|
|
120
|
-
symbol: createFillSymbol([161, 237, 237]),
|
|
121
|
-
values: ["S-DW", "S-DR", "S-RP"] // Multiple values
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
]
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
function createFillSymbol(color) {
|
|
129
|
-
return {
|
|
130
|
-
type: "simple-fill",
|
|
131
|
-
color: color,
|
|
132
|
-
outline: null
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## ClassBreaksRenderer
|
|
138
|
-
|
|
139
|
-
```javascript
|
|
140
|
-
const renderer = {
|
|
141
|
-
type: "class-breaks",
|
|
142
|
-
field: "population",
|
|
143
|
-
normalizationField: "area", // Optional: divide by this field
|
|
144
|
-
legendOptions: {
|
|
145
|
-
title: "Population Density"
|
|
146
|
-
},
|
|
147
|
-
defaultSymbol: {
|
|
148
|
-
type: "simple-fill",
|
|
149
|
-
color: "black",
|
|
150
|
-
style: "backward-diagonal"
|
|
151
|
-
},
|
|
152
|
-
defaultLabel: "No data",
|
|
153
|
-
classBreakInfos: [
|
|
154
|
-
{
|
|
155
|
-
minValue: 0,
|
|
156
|
-
maxValue: 100,
|
|
157
|
-
symbol: { type: "simple-fill", color: "#fffcd4" },
|
|
158
|
-
label: "< 100"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
minValue: 100,
|
|
162
|
-
maxValue: 500,
|
|
163
|
-
symbol: { type: "simple-fill", color: "#b1cdc2" },
|
|
164
|
-
label: "100 - 500"
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
minValue: 500,
|
|
168
|
-
maxValue: 1000,
|
|
169
|
-
symbol: { type: "simple-fill", color: "#38627a" },
|
|
170
|
-
label: "500 - 1,000"
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
minValue: 1000,
|
|
174
|
-
maxValue: Infinity,
|
|
175
|
-
symbol: { type: "simple-fill", color: "#0d2644" },
|
|
176
|
-
label: "> 1,000"
|
|
177
|
-
}
|
|
178
|
-
]
|
|
179
|
-
};
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
## HeatmapRenderer
|
|
183
|
-
|
|
184
|
-
```javascript
|
|
185
|
-
const renderer = {
|
|
186
|
-
type: "heatmap",
|
|
187
|
-
colorStops: [
|
|
188
|
-
{ color: "rgba(63, 40, 102, 0)", ratio: 0 },
|
|
189
|
-
{ color: "#472b77", ratio: 0.083 },
|
|
190
|
-
{ color: "#563098", ratio: 0.25 },
|
|
191
|
-
{ color: "#7139d4", ratio: 0.5 },
|
|
192
|
-
{ color: "#853fff", ratio: 0.664 },
|
|
193
|
-
{ color: "#c29f80", ratio: 0.83 },
|
|
194
|
-
{ color: "#ffff00", ratio: 1 }
|
|
195
|
-
],
|
|
196
|
-
maxDensity: 0.01,
|
|
197
|
-
minDensity: 0,
|
|
198
|
-
radius: 18 // Blur radius in pixels
|
|
199
|
-
};
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## 2D Symbol Types
|
|
203
|
-
|
|
204
|
-
### SimpleMarkerSymbol (Points)
|
|
205
|
-
```javascript
|
|
206
|
-
const symbol = {
|
|
207
|
-
type: "simple-marker",
|
|
208
|
-
style: "circle", // circle, square, cross, x, diamond, triangle
|
|
209
|
-
color: [255, 0, 0],
|
|
210
|
-
size: 12,
|
|
211
|
-
outline: {
|
|
212
|
-
color: [255, 255, 255],
|
|
213
|
-
width: 2
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
### SimpleLineSymbol
|
|
219
|
-
```javascript
|
|
220
|
-
const symbol = {
|
|
221
|
-
type: "simple-line",
|
|
222
|
-
style: "solid", // solid, dash, dot, dash-dot, etc.
|
|
223
|
-
color: [0, 0, 255],
|
|
224
|
-
width: 2,
|
|
225
|
-
cap: "round", // round, butt, square
|
|
226
|
-
join: "round" // round, miter, bevel
|
|
227
|
-
};
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### SimpleFillSymbol (Polygons)
|
|
231
|
-
```javascript
|
|
232
|
-
const symbol = {
|
|
233
|
-
type: "simple-fill",
|
|
234
|
-
style: "solid", // solid, none, horizontal, vertical, cross, etc.
|
|
235
|
-
color: [255, 255, 0, 0.5], // RGBA
|
|
236
|
-
outline: {
|
|
237
|
-
type: "simple-line",
|
|
238
|
-
color: [0, 0, 0],
|
|
239
|
-
width: 1
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### PictureMarkerSymbol
|
|
245
|
-
```javascript
|
|
246
|
-
const symbol = {
|
|
247
|
-
type: "picture-marker",
|
|
248
|
-
url: "https://example.com/icon.png",
|
|
249
|
-
width: 24,
|
|
250
|
-
height: 24,
|
|
251
|
-
xoffset: 0,
|
|
252
|
-
yoffset: 0
|
|
253
|
-
};
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### TextSymbol
|
|
257
|
-
```javascript
|
|
258
|
-
const symbol = {
|
|
259
|
-
type: "text",
|
|
260
|
-
text: "Label",
|
|
261
|
-
color: "white",
|
|
262
|
-
font: {
|
|
263
|
-
family: "Arial",
|
|
264
|
-
size: 12,
|
|
265
|
-
weight: "bold"
|
|
266
|
-
},
|
|
267
|
-
haloColor: "black",
|
|
268
|
-
haloSize: 1
|
|
269
|
-
};
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
## 3D Symbol Types
|
|
273
|
-
|
|
274
|
-
### PointSymbol3D
|
|
275
|
-
```javascript
|
|
276
|
-
const symbol = {
|
|
277
|
-
type: "point-3d",
|
|
278
|
-
symbolLayers: [{
|
|
279
|
-
type: "icon",
|
|
280
|
-
resource: { primitive: "circle" },
|
|
281
|
-
material: { color: "red" },
|
|
282
|
-
size: 12
|
|
283
|
-
}]
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
// Object marker
|
|
287
|
-
const symbol = {
|
|
288
|
-
type: "point-3d",
|
|
289
|
-
symbolLayers: [{
|
|
290
|
-
type: "object",
|
|
291
|
-
resource: { primitive: "cylinder" }, // cone, cube, sphere, diamond
|
|
292
|
-
material: { color: "blue" },
|
|
293
|
-
height: 100,
|
|
294
|
-
width: 10,
|
|
295
|
-
depth: 10
|
|
296
|
-
}]
|
|
297
|
-
};
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### WebStyleSymbol (3D icons from gallery)
|
|
301
|
-
```javascript
|
|
302
|
-
const symbol = {
|
|
303
|
-
type: "web-style",
|
|
304
|
-
name: "Pushpin 1",
|
|
305
|
-
styleName: "Esri2DPointSymbolsStyle"
|
|
306
|
-
};
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### MeshSymbol3D (for SceneLayer)
|
|
310
|
-
```javascript
|
|
311
|
-
const symbol = {
|
|
312
|
-
type: "mesh-3d",
|
|
313
|
-
symbolLayers: [{
|
|
314
|
-
type: "fill",
|
|
315
|
-
material: {
|
|
316
|
-
color: [244, 247, 134]
|
|
317
|
-
}
|
|
318
|
-
}]
|
|
319
|
-
};
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
### LineSymbol3D
|
|
323
|
-
```javascript
|
|
324
|
-
const symbol = {
|
|
325
|
-
type: "line-3d",
|
|
326
|
-
symbolLayers: [{
|
|
327
|
-
type: "path",
|
|
328
|
-
profile: "quad", // circle, quad
|
|
329
|
-
material: { color: "red" },
|
|
330
|
-
width: 5,
|
|
331
|
-
height: 5
|
|
332
|
-
}]
|
|
333
|
-
};
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
### PolygonSymbol3D
|
|
337
|
-
```javascript
|
|
338
|
-
const symbol = {
|
|
339
|
-
type: "polygon-3d",
|
|
340
|
-
symbolLayers: [{
|
|
341
|
-
type: "extrude",
|
|
342
|
-
material: { color: "blue" },
|
|
343
|
-
size: 100 // Extrusion height
|
|
344
|
-
}]
|
|
345
|
-
};
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
## Visual Variables
|
|
349
|
-
|
|
350
|
-
### Size Variable
|
|
351
|
-
```javascript
|
|
352
|
-
visualVariables: [{
|
|
353
|
-
type: "size",
|
|
354
|
-
field: "magnitude",
|
|
355
|
-
stops: [
|
|
356
|
-
{ value: 1, size: 4 },
|
|
357
|
-
{ value: 5, size: 20 },
|
|
358
|
-
{ value: 10, size: 40 }
|
|
359
|
-
]
|
|
360
|
-
}]
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
### Color Variable
|
|
364
|
-
```javascript
|
|
365
|
-
visualVariables: [{
|
|
366
|
-
type: "color",
|
|
367
|
-
field: "temperature",
|
|
368
|
-
stops: [
|
|
369
|
-
{ value: 0, color: "blue" },
|
|
370
|
-
{ value: 50, color: "yellow" },
|
|
371
|
-
{ value: 100, color: "red" }
|
|
372
|
-
]
|
|
373
|
-
}]
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### Opacity Variable
|
|
377
|
-
```javascript
|
|
378
|
-
visualVariables: [{
|
|
379
|
-
type: "opacity",
|
|
380
|
-
field: "confidence",
|
|
381
|
-
stops: [
|
|
382
|
-
{ value: 0, opacity: 0.1 },
|
|
383
|
-
{ value: 100, opacity: 1 }
|
|
384
|
-
]
|
|
385
|
-
}]
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### Rotation Variable
|
|
389
|
-
```javascript
|
|
390
|
-
visualVariables: [{
|
|
391
|
-
type: "rotation",
|
|
392
|
-
field: "heading",
|
|
393
|
-
rotationType: "geographic" // or "arithmetic"
|
|
394
|
-
}]
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
## Labeling
|
|
398
|
-
|
|
399
|
-
```javascript
|
|
400
|
-
layer.labelingInfo = [{
|
|
401
|
-
symbol: {
|
|
402
|
-
type: "text",
|
|
403
|
-
color: "white",
|
|
404
|
-
font: {
|
|
405
|
-
family: "Noto Sans",
|
|
406
|
-
size: 10,
|
|
407
|
-
weight: "bold"
|
|
408
|
-
},
|
|
409
|
-
haloColor: "#472b77",
|
|
410
|
-
haloSize: 1
|
|
411
|
-
},
|
|
412
|
-
labelPlacement: "above-center", // Various placement options
|
|
413
|
-
labelExpressionInfo: {
|
|
414
|
-
expression: "$feature.name" // Arcade expression
|
|
415
|
-
},
|
|
416
|
-
where: "population > 10000", // SQL filter
|
|
417
|
-
minScale: 500000,
|
|
418
|
-
maxScale: 0
|
|
419
|
-
}];
|
|
420
|
-
|
|
421
|
-
layer.labelsVisible = true;
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### Label Placements
|
|
425
|
-
- Points: `above-center`, `below-center`, `center-center`, `above-left`, etc.
|
|
426
|
-
- Lines: `above-along`, `below-along`, `center-along`
|
|
427
|
-
- Polygons: `always-horizontal`, `curved-horizontal`
|
|
428
|
-
|
|
429
|
-
### Arcade Label Expressions
|
|
430
|
-
```javascript
|
|
431
|
-
labelExpressionInfo: {
|
|
432
|
-
expression: `
|
|
433
|
-
var pop = $feature.population;
|
|
434
|
-
if (pop > 1000000) {
|
|
435
|
-
return $feature.name + " (" + Round(pop/1000000, 1) + "M)";
|
|
436
|
-
}
|
|
437
|
-
return $feature.name;
|
|
438
|
-
`
|
|
439
|
-
}
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
## Effects and Blend Modes
|
|
443
|
-
|
|
444
|
-
### Layer Effects
|
|
445
|
-
```javascript
|
|
446
|
-
// Drop shadow
|
|
447
|
-
layer.effect = "drop-shadow(2px 2px 3px gray)";
|
|
448
|
-
|
|
449
|
-
// Blur
|
|
450
|
-
layer.effect = "blur(2px)";
|
|
451
|
-
|
|
452
|
-
// Grayscale
|
|
453
|
-
layer.effect = "grayscale(100%)";
|
|
454
|
-
|
|
455
|
-
// Brightness/contrast
|
|
456
|
-
layer.effect = "brightness(150%) contrast(120%)";
|
|
457
|
-
|
|
458
|
-
// Combined effects
|
|
459
|
-
layer.effect = "drop-shadow(1px, 1px, 1px, gray) brightness(120%)";
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
### Feature Effects
|
|
463
|
-
```javascript
|
|
464
|
-
import FeatureEffect from "@arcgis/core/layers/support/FeatureEffect.js";
|
|
465
|
-
|
|
466
|
-
layerView.featureEffect = new FeatureEffect({
|
|
467
|
-
filter: {
|
|
468
|
-
where: "population > 100000"
|
|
469
|
-
},
|
|
470
|
-
includedEffect: "bloom(1, 0.5px, 0.2)",
|
|
471
|
-
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
472
|
-
});
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
### Blend Modes
|
|
476
|
-
```javascript
|
|
477
|
-
layer.blendMode = "multiply"; // normal, multiply, screen, overlay, darken, lighten
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
## Smart Mapping (Auto-generated Renderers)
|
|
481
|
-
|
|
482
|
-
```javascript
|
|
483
|
-
import colorRendererCreator from "@arcgis/core/smartMapping/renderers/color.js";
|
|
484
|
-
import sizeRendererCreator from "@arcgis/core/smartMapping/renderers/size.js";
|
|
485
|
-
|
|
486
|
-
// Generate color renderer
|
|
487
|
-
const colorResponse = await colorRendererCreator.createContinuousRenderer({
|
|
488
|
-
layer: featureLayer,
|
|
489
|
-
field: "population",
|
|
490
|
-
view: view,
|
|
491
|
-
theme: "high-to-low" // above, below, high-to-low, centered-on, extremes
|
|
492
|
-
});
|
|
493
|
-
featureLayer.renderer = colorResponse.renderer;
|
|
494
|
-
|
|
495
|
-
// Generate size renderer
|
|
496
|
-
const sizeResponse = await sizeRendererCreator.createContinuousRenderer({
|
|
497
|
-
layer: featureLayer,
|
|
498
|
-
field: "magnitude",
|
|
499
|
-
view: view
|
|
500
|
-
});
|
|
501
|
-
featureLayer.renderer = sizeResponse.renderer;
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
## Autocasting
|
|
505
|
-
|
|
506
|
-
All symbol and renderer objects support autocasting - you can use plain objects instead of constructing classes.
|
|
507
|
-
|
|
508
|
-
### JavaScript
|
|
509
|
-
```javascript
|
|
510
|
-
// This plain object autocasts to a SimpleRenderer with SimpleMarkerSymbol
|
|
511
|
-
layer.renderer = {
|
|
512
|
-
type: "simple",
|
|
513
|
-
symbol: {
|
|
514
|
-
type: "simple-marker",
|
|
515
|
-
color: "red",
|
|
516
|
-
size: 8
|
|
517
|
-
}
|
|
518
|
-
};
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
### TypeScript (with type safety)
|
|
522
|
-
```typescript
|
|
523
|
-
// Use 'as const' to keep discriminated union types narrow
|
|
524
|
-
layer.renderer = {
|
|
525
|
-
type: "simple",
|
|
526
|
-
symbol: {
|
|
527
|
-
type: "simple-marker",
|
|
528
|
-
color: "red",
|
|
529
|
-
size: 8
|
|
530
|
-
}
|
|
531
|
-
} as const;
|
|
532
|
-
|
|
533
|
-
// Or use 'satisfies' for explicit type checking
|
|
534
|
-
layer.renderer = {
|
|
535
|
-
type: "simple",
|
|
536
|
-
symbol: {
|
|
537
|
-
type: "simple-marker",
|
|
538
|
-
color: "red",
|
|
539
|
-
size: 8
|
|
540
|
-
}
|
|
541
|
-
} satisfies __esri.SimpleRendererProperties;
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
### Explicit Classes (when you need instance methods)
|
|
545
|
-
```typescript
|
|
546
|
-
import SimpleRenderer from "@arcgis/core/renderers/SimpleRenderer.js";
|
|
547
|
-
import SimpleMarkerSymbol from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
|
|
548
|
-
|
|
549
|
-
layer.renderer = new SimpleRenderer({
|
|
550
|
-
symbol: new SimpleMarkerSymbol({
|
|
551
|
-
color: "red",
|
|
552
|
-
size: 8
|
|
553
|
-
})
|
|
554
|
-
});
|
|
555
|
-
```
|
|
556
|
-
|
|
557
|
-
> **Tip:** Use autocasting for configuration-heavy code. Use explicit classes when you need instance methods or `instanceof` checks. See [arcgis-core-maps skill](../arcgis-core-maps/SKILL.md) for detailed guidance.
|
|
558
|
-
|
|
559
|
-
## Common Pitfalls
|
|
560
|
-
|
|
561
|
-
1. **Missing type property**: Always include `type` for autocasting
|
|
562
|
-
```javascript
|
|
563
|
-
// Wrong
|
|
564
|
-
{ color: "red" }
|
|
565
|
-
// Correct
|
|
566
|
-
{ type: "simple-marker", color: "red" }
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
2. **Color formats**: Colors can be hex, named, RGB array, or RGBA array
|
|
570
|
-
```javascript
|
|
571
|
-
color: "red"
|
|
572
|
-
color: "#FF0000"
|
|
573
|
-
color: [255, 0, 0]
|
|
574
|
-
color: [255, 0, 0, 0.5] // With transparency
|
|
575
|
-
```
|
|
576
|
-
|
|
577
|
-
3. **Visual variables require numeric fields**: Ensure the field contains numbers
|
|
578
|
-
|
|
579
|
-
4. **Label expressions are Arcade**: Use Arcade syntax, not JavaScript
|
|
580
|
-
|
|
1
|
+
---
|
|
2
|
+
name: arcgis-visualization
|
|
3
|
+
description: Style and render geographic data with renderers, symbols, and visual variables. Use for creating thematic maps, heatmaps, class breaks, unique values, labels, and 3D visualization.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ArcGIS Visualization
|
|
7
|
+
|
|
8
|
+
Use this skill when styling layers with renderers, symbols, visual variables, labels, and effects.
|
|
9
|
+
|
|
10
|
+
## Renderer Types Overview
|
|
11
|
+
|
|
12
|
+
| Renderer | Use Case |
|
|
13
|
+
|----------|----------|
|
|
14
|
+
| SimpleRenderer | Same symbol for all features |
|
|
15
|
+
| UniqueValueRenderer | Different symbols by category |
|
|
16
|
+
| ClassBreaksRenderer | Different symbols by numeric ranges |
|
|
17
|
+
| HeatmapRenderer | Density visualization |
|
|
18
|
+
| DotDensityRenderer | Dot density maps |
|
|
19
|
+
| DictionaryRenderer | Military symbology |
|
|
20
|
+
|
|
21
|
+
## SimpleRenderer
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
const renderer = {
|
|
25
|
+
type: "simple",
|
|
26
|
+
symbol: {
|
|
27
|
+
type: "simple-marker",
|
|
28
|
+
color: "blue",
|
|
29
|
+
size: 8,
|
|
30
|
+
outline: {
|
|
31
|
+
color: "white",
|
|
32
|
+
width: 1
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
layer.renderer = renderer;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### With Visual Variables
|
|
41
|
+
```javascript
|
|
42
|
+
const renderer = {
|
|
43
|
+
type: "simple",
|
|
44
|
+
symbol: {
|
|
45
|
+
type: "simple-marker",
|
|
46
|
+
color: "#13EB0C",
|
|
47
|
+
outline: { color: "#A9A9A9", width: 0.5 }
|
|
48
|
+
},
|
|
49
|
+
visualVariables: [{
|
|
50
|
+
type: "size",
|
|
51
|
+
field: "population",
|
|
52
|
+
stops: [
|
|
53
|
+
{ value: 1000, size: 4 },
|
|
54
|
+
{ value: 10000, size: 12 },
|
|
55
|
+
{ value: 100000, size: 24 }
|
|
56
|
+
]
|
|
57
|
+
}]
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## UniqueValueRenderer
|
|
62
|
+
|
|
63
|
+
### Basic Unique Values
|
|
64
|
+
```javascript
|
|
65
|
+
const renderer = {
|
|
66
|
+
type: "unique-value",
|
|
67
|
+
field: "type",
|
|
68
|
+
defaultSymbol: { type: "simple-fill", color: "gray" },
|
|
69
|
+
uniqueValueInfos: [
|
|
70
|
+
{
|
|
71
|
+
value: "residential",
|
|
72
|
+
symbol: { type: "simple-fill", color: "#FFFF00" },
|
|
73
|
+
label: "Residential"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
value: "commercial",
|
|
77
|
+
symbol: { type: "simple-fill", color: "#FF0000" },
|
|
78
|
+
label: "Commercial"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
value: "industrial",
|
|
82
|
+
symbol: { type: "simple-fill", color: "#800080" },
|
|
83
|
+
label: "Industrial"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
};
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Grouped Unique Values (with headings in legend)
|
|
90
|
+
```javascript
|
|
91
|
+
const renderer = {
|
|
92
|
+
type: "unique-value",
|
|
93
|
+
field: "zonecode",
|
|
94
|
+
uniqueValueGroups: [
|
|
95
|
+
{
|
|
96
|
+
heading: "Commercial",
|
|
97
|
+
classes: [
|
|
98
|
+
{
|
|
99
|
+
label: "C-1 | Neighborhood Commercial",
|
|
100
|
+
symbol: createFillSymbol([189, 145, 145]),
|
|
101
|
+
values: "C-1"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: "C-2 | Community Commercial",
|
|
105
|
+
symbol: createFillSymbol([255, 179, 219]),
|
|
106
|
+
values: "C-2"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
heading: "Residential",
|
|
112
|
+
classes: [
|
|
113
|
+
{
|
|
114
|
+
label: "R-1 | Low Density",
|
|
115
|
+
symbol: createFillSymbol([255, 255, 224]),
|
|
116
|
+
values: "R-1"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
label: "Special Areas",
|
|
120
|
+
symbol: createFillSymbol([161, 237, 237]),
|
|
121
|
+
values: ["S-DW", "S-DR", "S-RP"] // Multiple values
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
function createFillSymbol(color) {
|
|
129
|
+
return {
|
|
130
|
+
type: "simple-fill",
|
|
131
|
+
color: color,
|
|
132
|
+
outline: null
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## ClassBreaksRenderer
|
|
138
|
+
|
|
139
|
+
```javascript
|
|
140
|
+
const renderer = {
|
|
141
|
+
type: "class-breaks",
|
|
142
|
+
field: "population",
|
|
143
|
+
normalizationField: "area", // Optional: divide by this field
|
|
144
|
+
legendOptions: {
|
|
145
|
+
title: "Population Density"
|
|
146
|
+
},
|
|
147
|
+
defaultSymbol: {
|
|
148
|
+
type: "simple-fill",
|
|
149
|
+
color: "black",
|
|
150
|
+
style: "backward-diagonal"
|
|
151
|
+
},
|
|
152
|
+
defaultLabel: "No data",
|
|
153
|
+
classBreakInfos: [
|
|
154
|
+
{
|
|
155
|
+
minValue: 0,
|
|
156
|
+
maxValue: 100,
|
|
157
|
+
symbol: { type: "simple-fill", color: "#fffcd4" },
|
|
158
|
+
label: "< 100"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
minValue: 100,
|
|
162
|
+
maxValue: 500,
|
|
163
|
+
symbol: { type: "simple-fill", color: "#b1cdc2" },
|
|
164
|
+
label: "100 - 500"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
minValue: 500,
|
|
168
|
+
maxValue: 1000,
|
|
169
|
+
symbol: { type: "simple-fill", color: "#38627a" },
|
|
170
|
+
label: "500 - 1,000"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
minValue: 1000,
|
|
174
|
+
maxValue: Infinity,
|
|
175
|
+
symbol: { type: "simple-fill", color: "#0d2644" },
|
|
176
|
+
label: "> 1,000"
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## HeatmapRenderer
|
|
183
|
+
|
|
184
|
+
```javascript
|
|
185
|
+
const renderer = {
|
|
186
|
+
type: "heatmap",
|
|
187
|
+
colorStops: [
|
|
188
|
+
{ color: "rgba(63, 40, 102, 0)", ratio: 0 },
|
|
189
|
+
{ color: "#472b77", ratio: 0.083 },
|
|
190
|
+
{ color: "#563098", ratio: 0.25 },
|
|
191
|
+
{ color: "#7139d4", ratio: 0.5 },
|
|
192
|
+
{ color: "#853fff", ratio: 0.664 },
|
|
193
|
+
{ color: "#c29f80", ratio: 0.83 },
|
|
194
|
+
{ color: "#ffff00", ratio: 1 }
|
|
195
|
+
],
|
|
196
|
+
maxDensity: 0.01,
|
|
197
|
+
minDensity: 0,
|
|
198
|
+
radius: 18 // Blur radius in pixels
|
|
199
|
+
};
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## 2D Symbol Types
|
|
203
|
+
|
|
204
|
+
### SimpleMarkerSymbol (Points)
|
|
205
|
+
```javascript
|
|
206
|
+
const symbol = {
|
|
207
|
+
type: "simple-marker",
|
|
208
|
+
style: "circle", // circle, square, cross, x, diamond, triangle
|
|
209
|
+
color: [255, 0, 0],
|
|
210
|
+
size: 12,
|
|
211
|
+
outline: {
|
|
212
|
+
color: [255, 255, 255],
|
|
213
|
+
width: 2
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### SimpleLineSymbol
|
|
219
|
+
```javascript
|
|
220
|
+
const symbol = {
|
|
221
|
+
type: "simple-line",
|
|
222
|
+
style: "solid", // solid, dash, dot, dash-dot, etc.
|
|
223
|
+
color: [0, 0, 255],
|
|
224
|
+
width: 2,
|
|
225
|
+
cap: "round", // round, butt, square
|
|
226
|
+
join: "round" // round, miter, bevel
|
|
227
|
+
};
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### SimpleFillSymbol (Polygons)
|
|
231
|
+
```javascript
|
|
232
|
+
const symbol = {
|
|
233
|
+
type: "simple-fill",
|
|
234
|
+
style: "solid", // solid, none, horizontal, vertical, cross, etc.
|
|
235
|
+
color: [255, 255, 0, 0.5], // RGBA
|
|
236
|
+
outline: {
|
|
237
|
+
type: "simple-line",
|
|
238
|
+
color: [0, 0, 0],
|
|
239
|
+
width: 1
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### PictureMarkerSymbol
|
|
245
|
+
```javascript
|
|
246
|
+
const symbol = {
|
|
247
|
+
type: "picture-marker",
|
|
248
|
+
url: "https://example.com/icon.png",
|
|
249
|
+
width: 24,
|
|
250
|
+
height: 24,
|
|
251
|
+
xoffset: 0,
|
|
252
|
+
yoffset: 0
|
|
253
|
+
};
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### TextSymbol
|
|
257
|
+
```javascript
|
|
258
|
+
const symbol = {
|
|
259
|
+
type: "text",
|
|
260
|
+
text: "Label",
|
|
261
|
+
color: "white",
|
|
262
|
+
font: {
|
|
263
|
+
family: "Arial",
|
|
264
|
+
size: 12,
|
|
265
|
+
weight: "bold"
|
|
266
|
+
},
|
|
267
|
+
haloColor: "black",
|
|
268
|
+
haloSize: 1
|
|
269
|
+
};
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## 3D Symbol Types
|
|
273
|
+
|
|
274
|
+
### PointSymbol3D
|
|
275
|
+
```javascript
|
|
276
|
+
const symbol = {
|
|
277
|
+
type: "point-3d",
|
|
278
|
+
symbolLayers: [{
|
|
279
|
+
type: "icon",
|
|
280
|
+
resource: { primitive: "circle" },
|
|
281
|
+
material: { color: "red" },
|
|
282
|
+
size: 12
|
|
283
|
+
}]
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// Object marker
|
|
287
|
+
const symbol = {
|
|
288
|
+
type: "point-3d",
|
|
289
|
+
symbolLayers: [{
|
|
290
|
+
type: "object",
|
|
291
|
+
resource: { primitive: "cylinder" }, // cone, cube, sphere, diamond
|
|
292
|
+
material: { color: "blue" },
|
|
293
|
+
height: 100,
|
|
294
|
+
width: 10,
|
|
295
|
+
depth: 10
|
|
296
|
+
}]
|
|
297
|
+
};
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### WebStyleSymbol (3D icons from gallery)
|
|
301
|
+
```javascript
|
|
302
|
+
const symbol = {
|
|
303
|
+
type: "web-style",
|
|
304
|
+
name: "Pushpin 1",
|
|
305
|
+
styleName: "Esri2DPointSymbolsStyle"
|
|
306
|
+
};
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### MeshSymbol3D (for SceneLayer)
|
|
310
|
+
```javascript
|
|
311
|
+
const symbol = {
|
|
312
|
+
type: "mesh-3d",
|
|
313
|
+
symbolLayers: [{
|
|
314
|
+
type: "fill",
|
|
315
|
+
material: {
|
|
316
|
+
color: [244, 247, 134]
|
|
317
|
+
}
|
|
318
|
+
}]
|
|
319
|
+
};
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### LineSymbol3D
|
|
323
|
+
```javascript
|
|
324
|
+
const symbol = {
|
|
325
|
+
type: "line-3d",
|
|
326
|
+
symbolLayers: [{
|
|
327
|
+
type: "path",
|
|
328
|
+
profile: "quad", // circle, quad
|
|
329
|
+
material: { color: "red" },
|
|
330
|
+
width: 5,
|
|
331
|
+
height: 5
|
|
332
|
+
}]
|
|
333
|
+
};
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### PolygonSymbol3D
|
|
337
|
+
```javascript
|
|
338
|
+
const symbol = {
|
|
339
|
+
type: "polygon-3d",
|
|
340
|
+
symbolLayers: [{
|
|
341
|
+
type: "extrude",
|
|
342
|
+
material: { color: "blue" },
|
|
343
|
+
size: 100 // Extrusion height
|
|
344
|
+
}]
|
|
345
|
+
};
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Visual Variables
|
|
349
|
+
|
|
350
|
+
### Size Variable
|
|
351
|
+
```javascript
|
|
352
|
+
visualVariables: [{
|
|
353
|
+
type: "size",
|
|
354
|
+
field: "magnitude",
|
|
355
|
+
stops: [
|
|
356
|
+
{ value: 1, size: 4 },
|
|
357
|
+
{ value: 5, size: 20 },
|
|
358
|
+
{ value: 10, size: 40 }
|
|
359
|
+
]
|
|
360
|
+
}]
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Color Variable
|
|
364
|
+
```javascript
|
|
365
|
+
visualVariables: [{
|
|
366
|
+
type: "color",
|
|
367
|
+
field: "temperature",
|
|
368
|
+
stops: [
|
|
369
|
+
{ value: 0, color: "blue" },
|
|
370
|
+
{ value: 50, color: "yellow" },
|
|
371
|
+
{ value: 100, color: "red" }
|
|
372
|
+
]
|
|
373
|
+
}]
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Opacity Variable
|
|
377
|
+
```javascript
|
|
378
|
+
visualVariables: [{
|
|
379
|
+
type: "opacity",
|
|
380
|
+
field: "confidence",
|
|
381
|
+
stops: [
|
|
382
|
+
{ value: 0, opacity: 0.1 },
|
|
383
|
+
{ value: 100, opacity: 1 }
|
|
384
|
+
]
|
|
385
|
+
}]
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Rotation Variable
|
|
389
|
+
```javascript
|
|
390
|
+
visualVariables: [{
|
|
391
|
+
type: "rotation",
|
|
392
|
+
field: "heading",
|
|
393
|
+
rotationType: "geographic" // or "arithmetic"
|
|
394
|
+
}]
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## Labeling
|
|
398
|
+
|
|
399
|
+
```javascript
|
|
400
|
+
layer.labelingInfo = [{
|
|
401
|
+
symbol: {
|
|
402
|
+
type: "text",
|
|
403
|
+
color: "white",
|
|
404
|
+
font: {
|
|
405
|
+
family: "Noto Sans",
|
|
406
|
+
size: 10,
|
|
407
|
+
weight: "bold"
|
|
408
|
+
},
|
|
409
|
+
haloColor: "#472b77",
|
|
410
|
+
haloSize: 1
|
|
411
|
+
},
|
|
412
|
+
labelPlacement: "above-center", // Various placement options
|
|
413
|
+
labelExpressionInfo: {
|
|
414
|
+
expression: "$feature.name" // Arcade expression
|
|
415
|
+
},
|
|
416
|
+
where: "population > 10000", // SQL filter
|
|
417
|
+
minScale: 500000,
|
|
418
|
+
maxScale: 0
|
|
419
|
+
}];
|
|
420
|
+
|
|
421
|
+
layer.labelsVisible = true;
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Label Placements
|
|
425
|
+
- Points: `above-center`, `below-center`, `center-center`, `above-left`, etc.
|
|
426
|
+
- Lines: `above-along`, `below-along`, `center-along`
|
|
427
|
+
- Polygons: `always-horizontal`, `curved-horizontal`
|
|
428
|
+
|
|
429
|
+
### Arcade Label Expressions
|
|
430
|
+
```javascript
|
|
431
|
+
labelExpressionInfo: {
|
|
432
|
+
expression: `
|
|
433
|
+
var pop = $feature.population;
|
|
434
|
+
if (pop > 1000000) {
|
|
435
|
+
return $feature.name + " (" + Round(pop/1000000, 1) + "M)";
|
|
436
|
+
}
|
|
437
|
+
return $feature.name;
|
|
438
|
+
`
|
|
439
|
+
}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
## Effects and Blend Modes
|
|
443
|
+
|
|
444
|
+
### Layer Effects
|
|
445
|
+
```javascript
|
|
446
|
+
// Drop shadow
|
|
447
|
+
layer.effect = "drop-shadow(2px 2px 3px gray)";
|
|
448
|
+
|
|
449
|
+
// Blur
|
|
450
|
+
layer.effect = "blur(2px)";
|
|
451
|
+
|
|
452
|
+
// Grayscale
|
|
453
|
+
layer.effect = "grayscale(100%)";
|
|
454
|
+
|
|
455
|
+
// Brightness/contrast
|
|
456
|
+
layer.effect = "brightness(150%) contrast(120%)";
|
|
457
|
+
|
|
458
|
+
// Combined effects
|
|
459
|
+
layer.effect = "drop-shadow(1px, 1px, 1px, gray) brightness(120%)";
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Feature Effects
|
|
463
|
+
```javascript
|
|
464
|
+
import FeatureEffect from "@arcgis/core/layers/support/FeatureEffect.js";
|
|
465
|
+
|
|
466
|
+
layerView.featureEffect = new FeatureEffect({
|
|
467
|
+
filter: {
|
|
468
|
+
where: "population > 100000"
|
|
469
|
+
},
|
|
470
|
+
includedEffect: "bloom(1, 0.5px, 0.2)",
|
|
471
|
+
excludedEffect: "grayscale(100%) opacity(30%)"
|
|
472
|
+
});
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### Blend Modes
|
|
476
|
+
```javascript
|
|
477
|
+
layer.blendMode = "multiply"; // normal, multiply, screen, overlay, darken, lighten
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## Smart Mapping (Auto-generated Renderers)
|
|
481
|
+
|
|
482
|
+
```javascript
|
|
483
|
+
import colorRendererCreator from "@arcgis/core/smartMapping/renderers/color.js";
|
|
484
|
+
import sizeRendererCreator from "@arcgis/core/smartMapping/renderers/size.js";
|
|
485
|
+
|
|
486
|
+
// Generate color renderer
|
|
487
|
+
const colorResponse = await colorRendererCreator.createContinuousRenderer({
|
|
488
|
+
layer: featureLayer,
|
|
489
|
+
field: "population",
|
|
490
|
+
view: view,
|
|
491
|
+
theme: "high-to-low" // above, below, high-to-low, centered-on, extremes
|
|
492
|
+
});
|
|
493
|
+
featureLayer.renderer = colorResponse.renderer;
|
|
494
|
+
|
|
495
|
+
// Generate size renderer
|
|
496
|
+
const sizeResponse = await sizeRendererCreator.createContinuousRenderer({
|
|
497
|
+
layer: featureLayer,
|
|
498
|
+
field: "magnitude",
|
|
499
|
+
view: view
|
|
500
|
+
});
|
|
501
|
+
featureLayer.renderer = sizeResponse.renderer;
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
## Autocasting
|
|
505
|
+
|
|
506
|
+
All symbol and renderer objects support autocasting - you can use plain objects instead of constructing classes.
|
|
507
|
+
|
|
508
|
+
### JavaScript
|
|
509
|
+
```javascript
|
|
510
|
+
// This plain object autocasts to a SimpleRenderer with SimpleMarkerSymbol
|
|
511
|
+
layer.renderer = {
|
|
512
|
+
type: "simple",
|
|
513
|
+
symbol: {
|
|
514
|
+
type: "simple-marker",
|
|
515
|
+
color: "red",
|
|
516
|
+
size: 8
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### TypeScript (with type safety)
|
|
522
|
+
```typescript
|
|
523
|
+
// Use 'as const' to keep discriminated union types narrow
|
|
524
|
+
layer.renderer = {
|
|
525
|
+
type: "simple",
|
|
526
|
+
symbol: {
|
|
527
|
+
type: "simple-marker",
|
|
528
|
+
color: "red",
|
|
529
|
+
size: 8
|
|
530
|
+
}
|
|
531
|
+
} as const;
|
|
532
|
+
|
|
533
|
+
// Or use 'satisfies' for explicit type checking
|
|
534
|
+
layer.renderer = {
|
|
535
|
+
type: "simple",
|
|
536
|
+
symbol: {
|
|
537
|
+
type: "simple-marker",
|
|
538
|
+
color: "red",
|
|
539
|
+
size: 8
|
|
540
|
+
}
|
|
541
|
+
} satisfies __esri.SimpleRendererProperties;
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
### Explicit Classes (when you need instance methods)
|
|
545
|
+
```typescript
|
|
546
|
+
import SimpleRenderer from "@arcgis/core/renderers/SimpleRenderer.js";
|
|
547
|
+
import SimpleMarkerSymbol from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
|
|
548
|
+
|
|
549
|
+
layer.renderer = new SimpleRenderer({
|
|
550
|
+
symbol: new SimpleMarkerSymbol({
|
|
551
|
+
color: "red",
|
|
552
|
+
size: 8
|
|
553
|
+
})
|
|
554
|
+
});
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
> **Tip:** Use autocasting for configuration-heavy code. Use explicit classes when you need instance methods or `instanceof` checks. See [arcgis-core-maps skill](../arcgis-core-maps/SKILL.md) for detailed guidance.
|
|
558
|
+
|
|
559
|
+
## Common Pitfalls
|
|
560
|
+
|
|
561
|
+
1. **Missing type property**: Always include `type` for autocasting
|
|
562
|
+
```javascript
|
|
563
|
+
// Wrong
|
|
564
|
+
{ color: "red" }
|
|
565
|
+
// Correct
|
|
566
|
+
{ type: "simple-marker", color: "red" }
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
2. **Color formats**: Colors can be hex, named, RGB array, or RGBA array
|
|
570
|
+
```javascript
|
|
571
|
+
color: "red"
|
|
572
|
+
color: "#FF0000"
|
|
573
|
+
color: [255, 0, 0]
|
|
574
|
+
color: [255, 0, 0, 0.5] // With transparency
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
3. **Visual variables require numeric fields**: Ensure the field contains numbers
|
|
578
|
+
|
|
579
|
+
4. **Label expressions are Arcade**: Use Arcade syntax, not JavaScript
|
|
580
|
+
|