@saschabrunnerch/arcgis-maps-sdk-js-ai-context 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +163 -201
  2. package/bin/cli.js +157 -173
  3. package/contexts/4.34/{claude → skills}/arcgis-3d-advanced/SKILL.md +586 -586
  4. package/contexts/4.34/{claude → skills}/arcgis-advanced-layers/SKILL.md +431 -431
  5. package/contexts/4.34/{claude → skills}/arcgis-analysis-services/SKILL.md +607 -607
  6. package/contexts/4.34/{claude → skills}/arcgis-authentication/SKILL.md +301 -301
  7. package/contexts/4.34/{claude → skills}/arcgis-cim-symbols/SKILL.md +486 -486
  8. package/contexts/4.34/{claude → skills}/arcgis-coordinates-projection/SKILL.md +406 -406
  9. package/contexts/4.34/{claude → skills}/arcgis-core-maps/SKILL.md +739 -739
  10. package/contexts/4.34/{claude → skills}/arcgis-core-utilities/SKILL.md +732 -732
  11. package/contexts/4.34/{claude → skills}/arcgis-custom-rendering/SKILL.md +445 -445
  12. package/contexts/4.34/{claude → skills}/arcgis-editing-advanced/SKILL.md +702 -702
  13. package/contexts/4.34/{claude → skills}/arcgis-feature-effects/SKILL.md +393 -393
  14. package/contexts/4.34/{claude → skills}/arcgis-geometry-operations/SKILL.md +489 -489
  15. package/contexts/4.34/{claude → skills}/arcgis-imagery/SKILL.md +307 -307
  16. package/contexts/4.34/{claude → skills}/arcgis-interaction/SKILL.md +572 -572
  17. package/contexts/4.34/{claude → skills}/arcgis-knowledge-graphs/SKILL.md +582 -582
  18. package/contexts/4.34/{claude → skills}/arcgis-layers/SKILL.md +601 -601
  19. package/contexts/4.34/{claude → skills}/arcgis-map-tools/SKILL.md +668 -668
  20. package/contexts/4.34/{claude → skills}/arcgis-media-layers/SKILL.md +290 -290
  21. package/contexts/4.34/{claude → skills}/arcgis-portal-content/SKILL.md +679 -679
  22. package/contexts/4.34/{claude → skills}/arcgis-scene-effects/SKILL.md +512 -512
  23. package/contexts/4.34/{claude → skills}/arcgis-smart-mapping/SKILL.md +686 -686
  24. package/contexts/4.34/skills/arcgis-starter-app/SKILL.md +273 -0
  25. package/contexts/4.34/skills/arcgis-starter-app-extended/SKILL.md +649 -0
  26. package/contexts/4.34/{claude → skills}/arcgis-tables-forms/SKILL.md +877 -877
  27. package/contexts/4.34/{claude → skills}/arcgis-time-animation/SKILL.md +722 -722
  28. package/contexts/4.34/{claude → skills}/arcgis-utility-networks/SKILL.md +301 -301
  29. package/contexts/4.34/{claude → skills}/arcgis-visualization/SKILL.md +580 -580
  30. package/contexts/4.34/{claude → skills}/arcgis-widgets-ui/SKILL.md +574 -574
  31. package/lib/installer.js +294 -379
  32. package/package.json +45 -45
  33. package/contexts/4.34/copilot/arcgis-3d.instructions.md +0 -267
  34. package/contexts/4.34/copilot/arcgis-analysis.instructions.md +0 -294
  35. package/contexts/4.34/copilot/arcgis-arcade.instructions.md +0 -234
  36. package/contexts/4.34/copilot/arcgis-authentication.instructions.md +0 -187
  37. package/contexts/4.34/copilot/arcgis-cim-symbols.instructions.md +0 -177
  38. package/contexts/4.34/copilot/arcgis-core-maps.instructions.md +0 -246
  39. package/contexts/4.34/copilot/arcgis-core-utilities.instructions.md +0 -247
  40. package/contexts/4.34/copilot/arcgis-editing.instructions.md +0 -262
  41. package/contexts/4.34/copilot/arcgis-geometry.instructions.md +0 -225
  42. package/contexts/4.34/copilot/arcgis-layers.instructions.md +0 -278
  43. package/contexts/4.34/copilot/arcgis-popup-templates.instructions.md +0 -266
  44. package/contexts/4.34/copilot/arcgis-portal-advanced.instructions.md +0 -275
  45. package/contexts/4.34/copilot/arcgis-smart-mapping.instructions.md +0 -184
  46. package/contexts/4.34/copilot/arcgis-time-animation.instructions.md +0 -112
  47. package/contexts/4.34/copilot/arcgis-visualization.instructions.md +0 -321
  48. package/contexts/4.34/copilot/arcgis-widgets-ui.instructions.md +0 -277
  49. /package/contexts/4.34/{claude → skills}/arcgis-arcade/SKILL.md +0 -0
  50. /package/contexts/4.34/{claude → skills}/arcgis-popup-templates/SKILL.md +0 -0
@@ -1,686 +1,686 @@
1
- ---
2
- name: arcgis-smart-mapping
3
- description: Auto-generate renderers, calculate statistics, and create data-driven visualizations. Use for class breaks, unique values, heatmaps, dot density, relationship maps, and getting histogram/summary statistics.
4
- ---
5
-
6
- # ArcGIS Smart Mapping
7
-
8
- Use this skill to auto-generate renderers based on data, calculate statistics, and create intelligent visualizations.
9
-
10
- ## Smart Mapping Overview
11
-
12
- | Module | Purpose |
13
- |--------|---------|
14
- | `smartMapping/renderers/*` | Generate renderers automatically |
15
- | `smartMapping/statistics/*` | Calculate data statistics |
16
- | `smartMapping/symbology/*` | Get color schemes and symbols |
17
- | `smartMapping/heuristics/*` | Determine optimal visualization settings |
18
- | `smartMapping/raster/*` | Generate raster-specific renderers |
19
-
20
- ## Renderer Creators
21
-
22
- ### Color Renderer (Continuous)
23
-
24
- Creates a renderer with color gradient based on numeric values.
25
-
26
- ```javascript
27
- import colorRendererCreator from "@arcgis/core/smartMapping/renderers/color.js";
28
-
29
- const { renderer, visualVariable, colorScheme } = await colorRendererCreator.createContinuousRenderer({
30
- layer: featureLayer,
31
- view: view,
32
- field: "population",
33
- theme: "high-to-low", // high-to-low, above, below, centered-on, extremes
34
- colorScheme: {
35
- id: "esri-blue-5" // Optional: specify color scheme
36
- }
37
- });
38
-
39
- featureLayer.renderer = renderer;
40
- ```
41
-
42
- ### Color Renderer (Class Breaks)
43
-
44
- Creates a renderer with distinct color classes.
45
-
46
- ```javascript
47
- const { renderer, classBreakInfos } = await colorRendererCreator.createClassBreaksRenderer({
48
- layer: featureLayer,
49
- view: view,
50
- field: "income",
51
- classificationMethod: "natural-breaks", // equal-interval, quantile, standard-deviation
52
- numClasses: 5,
53
- colorScheme: {
54
- id: "esri-orange-9"
55
- }
56
- });
57
-
58
- featureLayer.renderer = renderer;
59
- ```
60
-
61
- ### Size Renderer (Continuous)
62
-
63
- Varies symbol size based on data values.
64
-
65
- ```javascript
66
- import sizeRendererCreator from "@arcgis/core/smartMapping/renderers/size.js";
67
-
68
- const { renderer, visualVariable } = await sizeRendererCreator.createContinuousRenderer({
69
- layer: featureLayer,
70
- view: view,
71
- field: "magnitude",
72
- sizeScheme: {
73
- minSize: 4,
74
- maxSize: 40
75
- }
76
- });
77
-
78
- featureLayer.renderer = renderer;
79
- ```
80
-
81
- ### Size Renderer (Class Breaks)
82
-
83
- ```javascript
84
- const { renderer } = await sizeRendererCreator.createClassBreaksRenderer({
85
- layer: featureLayer,
86
- view: view,
87
- field: "sales",
88
- classificationMethod: "quantile",
89
- numClasses: 4
90
- });
91
- ```
92
-
93
- ### Type (Unique Values) Renderer
94
-
95
- Creates a renderer for categorical data.
96
-
97
- ```javascript
98
- import typeRendererCreator from "@arcgis/core/smartMapping/renderers/type.js";
99
-
100
- const { renderer, uniqueValueInfos } = await typeRendererCreator.createRenderer({
101
- layer: featureLayer,
102
- view: view,
103
- field: "landuse",
104
- numTypes: 10, // Maximum categories before "Other"
105
- sortBy: "count" // value, count
106
- });
107
-
108
- featureLayer.renderer = renderer;
109
- ```
110
-
111
- ### Heatmap Renderer
112
-
113
- Creates a heatmap for point density visualization.
114
-
115
- ```javascript
116
- import heatmapRendererCreator from "@arcgis/core/smartMapping/renderers/heatmap.js";
117
-
118
- const { renderer } = await heatmapRendererCreator.createRenderer({
119
- layer: featureLayer,
120
- view: view,
121
- field: "magnitude", // Optional: weight by field
122
- colorScheme: {
123
- id: "esri-fire"
124
- },
125
- radius: 18,
126
- minDensity: 0,
127
- maxDensity: 0.05
128
- });
129
-
130
- featureLayer.renderer = renderer;
131
- ```
132
-
133
- ### Dot Density Renderer
134
-
135
- Shows density using dots within polygons.
136
-
137
- ```javascript
138
- import dotDensityRendererCreator from "@arcgis/core/smartMapping/renderers/dotDensity.js";
139
-
140
- const { renderer } = await dotDensityRendererCreator.createRenderer({
141
- layer: featureLayer,
142
- view: view,
143
- attributes: [
144
- { field: "dem_votes", color: "blue", label: "Democrat" },
145
- { field: "rep_votes", color: "red", label: "Republican" }
146
- ],
147
- dotValue: 1000, // Each dot represents 1000 votes
148
- dotBlendingEnabled: true
149
- });
150
-
151
- featureLayer.renderer = renderer;
152
- ```
153
-
154
- ### Opacity Renderer
155
-
156
- Varies opacity based on data values.
157
-
158
- ```javascript
159
- import opacityRendererCreator from "@arcgis/core/smartMapping/renderers/opacity.js";
160
-
161
- const { renderer, visualVariable } = await opacityRendererCreator.createContinuousRenderer({
162
- layer: featureLayer,
163
- view: view,
164
- field: "confidence",
165
- minOpacity: 0.1,
166
- maxOpacity: 1
167
- });
168
- ```
169
-
170
- ### Relationship Renderer
171
-
172
- Shows relationship between two variables.
173
-
174
- ```javascript
175
- import relationshipRendererCreator from "@arcgis/core/smartMapping/renderers/relationship.js";
176
-
177
- const { renderer } = await relationshipRendererCreator.createRenderer({
178
- layer: featureLayer,
179
- view: view,
180
- field1: {
181
- field: "population"
182
- },
183
- field2: {
184
- field: "income"
185
- },
186
- numClasses: 3, // 2, 3, or 4
187
- focus: "HH" // HH, HL, LH, LL
188
- });
189
- ```
190
-
191
- ### Predominance Renderer
192
-
193
- Shows which category has the highest value.
194
-
195
- ```javascript
196
- import predominanceRendererCreator from "@arcgis/core/smartMapping/renderers/predominance.js";
197
-
198
- const { renderer } = await predominanceRendererCreator.createRenderer({
199
- layer: featureLayer,
200
- view: view,
201
- fields: [
202
- { name: "dem_votes", label: "Democrat" },
203
- { name: "rep_votes", label: "Republican" },
204
- { name: "ind_votes", label: "Independent" }
205
- ],
206
- includeSizeVariable: true, // Size by margin
207
- includeOpacityVariable: true // Opacity by strength
208
- });
209
- ```
210
-
211
- ### Pie Chart Renderer
212
-
213
- Creates pie charts for each feature.
214
-
215
- ```javascript
216
- import pieChartRendererCreator from "@arcgis/core/smartMapping/renderers/pieChart.js";
217
-
218
- const { renderer } = await pieChartRendererCreator.createRenderer({
219
- layer: featureLayer,
220
- view: view,
221
- attributes: [
222
- { field: "asian", label: "Asian" },
223
- { field: "black", label: "Black" },
224
- { field: "white", label: "White" },
225
- { field: "other", label: "Other" }
226
- ],
227
- sizeOptimizationEnabled: true
228
- });
229
- ```
230
-
231
- ### Univariate Color-Size Renderer
232
-
233
- Combines color and size for a single variable.
234
-
235
- ```javascript
236
- import univariateRendererCreator from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
237
-
238
- const { renderer } = await univariateRendererCreator.createContinuousRenderer({
239
- layer: featureLayer,
240
- view: view,
241
- field: "population",
242
- theme: "above-and-below"
243
- });
244
- ```
245
-
246
- ### Location Renderer
247
-
248
- Simple location-based visualization (no data driven).
249
-
250
- ```javascript
251
- import locationRendererCreator from "@arcgis/core/smartMapping/renderers/location.js";
252
-
253
- const { renderer } = await locationRendererCreator.createRenderer({
254
- layer: featureLayer,
255
- view: view,
256
- color: [0, 112, 255]
257
- });
258
- ```
259
-
260
- ## Statistics Functions
261
-
262
- ### Class Breaks
263
-
264
- Calculate optimal class break values.
265
-
266
- ```javascript
267
- import classBreaksStats from "@arcgis/core/smartMapping/statistics/classBreaks.js";
268
-
269
- const result = await classBreaksStats({
270
- layer: featureLayer,
271
- field: "population",
272
- classificationMethod: "natural-breaks", // equal-interval, quantile, standard-deviation
273
- numClasses: 5,
274
- normalizationField: "area" // Optional
275
- });
276
-
277
- console.log(result.classBreakInfos);
278
- // [{ minValue: 0, maxValue: 1000, count: 50 }, ...]
279
- ```
280
-
281
- ### Histogram
282
-
283
- Get histogram data for a field.
284
-
285
- ```javascript
286
- import histogram from "@arcgis/core/smartMapping/statistics/histogram.js";
287
-
288
- const result = await histogram({
289
- layer: featureLayer,
290
- field: "income",
291
- numBins: 20,
292
- minValue: 0,
293
- maxValue: 200000
294
- });
295
-
296
- console.log(result.bins);
297
- // [{ minValue: 0, maxValue: 10000, count: 150 }, ...]
298
- console.log(result.source); // min, max, avg, stddev
299
- ```
300
-
301
- ### Summary Statistics
302
-
303
- Get statistical summary for a field.
304
-
305
- ```javascript
306
- import summaryStatistics from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
307
-
308
- const result = await summaryStatistics({
309
- layer: featureLayer,
310
- field: "temperature"
311
- });
312
-
313
- console.log(result.avg); // Mean
314
- console.log(result.count); // Feature count
315
- console.log(result.max); // Maximum
316
- console.log(result.min); // Minimum
317
- console.log(result.stddev); // Standard deviation
318
- console.log(result.sum); // Sum
319
- console.log(result.variance); // Variance
320
- ```
321
-
322
- ### Summary Statistics for Age
323
-
324
- Calculate age-based statistics from date field.
325
-
326
- ```javascript
327
- import summaryStatisticsForAge from "@arcgis/core/smartMapping/statistics/summaryStatisticsForAge.js";
328
-
329
- const result = await summaryStatisticsForAge({
330
- layer: featureLayer,
331
- field: "construction_date",
332
- unit: "years" // years, months, days, hours, minutes, seconds
333
- });
334
-
335
- console.log(result.avg); // Average age in years
336
- ```
337
-
338
- ### Unique Values
339
-
340
- Get all unique values for a field.
341
-
342
- ```javascript
343
- import uniqueValues from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
344
-
345
- const result = await uniqueValues({
346
- layer: featureLayer,
347
- field: "category"
348
- });
349
-
350
- console.log(result.uniqueValueInfos);
351
- // [{ value: "Type A", count: 100, symbol: ... }, ...]
352
- ```
353
-
354
- ### Predominant Categories
355
-
356
- Find which category is most common.
357
-
358
- ```javascript
359
- import predominantCategories from "@arcgis/core/smartMapping/statistics/predominantCategories.js";
360
-
361
- const result = await predominantCategories({
362
- layer: featureLayer,
363
- fields: ["typeA_count", "typeB_count", "typeC_count"]
364
- });
365
-
366
- console.log(result.predominantCategoryInfos);
367
- // [{ value: "typeA_count", count: 500 }, ...]
368
- ```
369
-
370
- ### Heatmap Statistics
371
-
372
- Get statistics for heatmap configuration.
373
-
374
- ```javascript
375
- import heatmapStatistics from "@arcgis/core/smartMapping/statistics/heatmapStatistics.js";
376
-
377
- const result = await heatmapStatistics({
378
- layer: featureLayer,
379
- view: view,
380
- field: "magnitude"
381
- });
382
-
383
- console.log(result.avgDensity);
384
- console.log(result.maxDensity);
385
- console.log(result.minDensity);
386
- ```
387
-
388
- ## Symbology (Color Schemes)
389
-
390
- ### Get Color Schemes
391
-
392
- ```javascript
393
- import symbologyColor from "@arcgis/core/smartMapping/symbology/color.js";
394
-
395
- // Get schemes for sequential data
396
- const schemes = symbologyColor.getSchemes({
397
- geometryType: "polygon",
398
- theme: "high-to-low"
399
- });
400
-
401
- console.log(schemes.primaryScheme); // Best match
402
- console.log(schemes.secondarySchemes); // Alternatives
403
-
404
- // Get scheme by name
405
- const scheme = symbologyColor.getSchemeByName({
406
- geometryType: "polygon",
407
- name: "Blue 5",
408
- theme: "high-to-low"
409
- });
410
- ```
411
-
412
- ### Color Scheme Themes
413
-
414
- - `high-to-low` - Sequential (low to high values)
415
- - `above-and-below` - Diverging (center point)
416
- - `centered-on` - Centered on specific value
417
- - `extremes` - Emphasize high and low
418
-
419
- ### Get Color Ramps
420
-
421
- ```javascript
422
- import colorRamps from "@arcgis/core/smartMapping/symbology/colorRamps.js";
423
-
424
- const allRamps = colorRamps.all();
425
- // Returns array of color ramp objects
426
-
427
- const byName = colorRamps.byName("Green-Brown");
428
- // Returns specific color ramp
429
- ```
430
-
431
- ## Heuristics
432
-
433
- ### Size Range
434
-
435
- Calculate optimal size range for data.
436
-
437
- ```javascript
438
- import sizeRange from "@arcgis/core/smartMapping/heuristics/sizeRange.js";
439
-
440
- const result = await sizeRange({
441
- layer: featureLayer,
442
- view: view,
443
- field: "population"
444
- });
445
-
446
- console.log(result.minSize); // Suggested minimum symbol size
447
- console.log(result.maxSize); // Suggested maximum symbol size
448
- ```
449
-
450
- ### Scale Range
451
-
452
- Determine appropriate scale range for visualization.
453
-
454
- ```javascript
455
- import scaleRange from "@arcgis/core/smartMapping/heuristics/scaleRange.js";
456
-
457
- const result = await scaleRange({
458
- layer: featureLayer,
459
- view: view
460
- });
461
-
462
- console.log(result.minScale);
463
- console.log(result.maxScale);
464
- ```
465
-
466
- ## Raster Smart Mapping
467
-
468
- ### Class Breaks Raster Renderer
469
-
470
- ```javascript
471
- import rasterClassBreaks from "@arcgis/core/smartMapping/raster/renderers/classBreaks.js";
472
-
473
- const { renderer } = await rasterClassBreaks.createRenderer({
474
- layer: imageryLayer,
475
- view: view,
476
- classificationMethod: "natural-breaks",
477
- numClasses: 5
478
- });
479
-
480
- imageryLayer.renderer = renderer;
481
- ```
482
-
483
- ### Stretch Raster Renderer
484
-
485
- ```javascript
486
- import rasterStretch from "@arcgis/core/smartMapping/raster/renderers/stretch.js";
487
-
488
- const { renderer } = await rasterStretch.createRenderer({
489
- layer: imageryLayer,
490
- view: view,
491
- stretchType: "standard-deviation", // min-max, standard-deviation, histogram-equalization
492
- numberOfStandardDeviations: 2
493
- });
494
- ```
495
-
496
- ### Colormap Raster Renderer
497
-
498
- ```javascript
499
- import rasterColormap from "@arcgis/core/smartMapping/raster/renderers/colormap.js";
500
-
501
- const { renderer } = await rasterColormap.createRenderer({
502
- layer: imageryLayer,
503
- view: view
504
- });
505
- ```
506
-
507
- ### RGB Raster Renderer
508
-
509
- ```javascript
510
- import rasterRGB from "@arcgis/core/smartMapping/raster/renderers/rgb.js";
511
-
512
- const { renderer } = await rasterRGB.createRenderer({
513
- layer: imageryLayer,
514
- view: view,
515
- bandIds: [4, 3, 2] // NIR, Red, Green (false color)
516
- });
517
- ```
518
-
519
- ### Vector Field Renderer
520
-
521
- For wind, current, or flow data.
522
-
523
- ```javascript
524
- import rasterVectorField from "@arcgis/core/smartMapping/raster/renderers/vectorField.js";
525
-
526
- const { renderer } = await rasterVectorField.createRenderer({
527
- layer: imageryLayer,
528
- view: view,
529
- style: "beaufort-wind" // single-arrow, wind-barb, beaufort-wind, classified-arrow
530
- });
531
- ```
532
-
533
- ### Flow Renderer
534
-
535
- Animated flow visualization.
536
-
537
- ```javascript
538
- import rasterFlow from "@arcgis/core/smartMapping/raster/renderers/flow.js";
539
-
540
- const { renderer } = await rasterFlow.createRenderer({
541
- layer: imageryLayer,
542
- view: view
543
- });
544
- ```
545
-
546
- ## Visual Variables
547
-
548
- ### Create Visual Variable
549
-
550
- ```javascript
551
- import colorVV from "@arcgis/core/smartMapping/renderers/color.js";
552
-
553
- const { visualVariable } = await colorVV.createVisualVariable({
554
- layer: featureLayer,
555
- view: view,
556
- field: "temperature",
557
- theme: "high-to-low"
558
- });
559
-
560
- // Add to existing renderer
561
- renderer.visualVariables = [visualVariable];
562
- ```
563
-
564
- ### Update Renderer with Statistics
565
-
566
- ```javascript
567
- // Get existing renderer's visual variable
568
- const colorVV = renderer.visualVariables.find(vv => vv.type === "color");
569
-
570
- // Get new statistics
571
- const stats = await summaryStatistics({
572
- layer: featureLayer,
573
- field: colorVV.field
574
- });
575
-
576
- // Update stops based on new statistics
577
- colorVV.stops = [
578
- { value: stats.min, color: [255, 255, 178] },
579
- { value: stats.avg, color: [253, 141, 60] },
580
- { value: stats.max, color: [189, 0, 38] }
581
- ];
582
- ```
583
-
584
- ## Common Patterns
585
-
586
- ### Complete Smart Mapping Workflow
587
-
588
- ```javascript
589
- // 1. Create renderer
590
- const { renderer } = await colorRendererCreator.createContinuousRenderer({
591
- layer: featureLayer,
592
- view: view,
593
- field: "population"
594
- });
595
-
596
- // 2. Get histogram for legend/slider
597
- const histogramResult = await histogram({
598
- layer: featureLayer,
599
- field: "population",
600
- numBins: 50
601
- });
602
-
603
- // 3. Apply renderer
604
- featureLayer.renderer = renderer;
605
-
606
- // 4. Create histogram slider widget
607
- const slider = new HistogramRangeSlider({
608
- bins: histogramResult.bins,
609
- min: histogramResult.minValue,
610
- max: histogramResult.maxValue,
611
- values: [histogramResult.minValue, histogramResult.maxValue]
612
- });
613
- ```
614
-
615
- ### Dynamic Renderer Updates
616
-
617
- ```javascript
618
- // Listen for extent changes and update renderer
619
- view.watch("extent", async () => {
620
- const stats = await summaryStatistics({
621
- layer: featureLayer,
622
- field: "population",
623
- view: view // Limit to current extent
624
- });
625
-
626
- // Update visual variable stops
627
- updateRendererStops(featureLayer.renderer, stats);
628
- });
629
- ```
630
-
631
- ### Multi-Variable Visualization
632
-
633
- ```javascript
634
- // Color by one variable, size by another
635
- const colorResult = await colorRendererCreator.createContinuousRenderer({
636
- layer: featureLayer,
637
- view: view,
638
- field: "income"
639
- });
640
-
641
- const sizeResult = await sizeRendererCreator.createVisualVariable({
642
- layer: featureLayer,
643
- view: view,
644
- field: "population"
645
- });
646
-
647
- colorResult.renderer.visualVariables.push(sizeResult.visualVariable);
648
- featureLayer.renderer = colorResult.renderer;
649
- ```
650
-
651
- ## Common Pitfalls
652
-
653
- 1. **View Required**: Most smart mapping functions require a view for scale-dependent calculations
654
- ```javascript
655
- // Always pass the view
656
- const { renderer } = await colorRendererCreator.createContinuousRenderer({
657
- layer: featureLayer,
658
- view: view, // Required!
659
- field: "population"
660
- });
661
- ```
662
-
663
- 2. **Async Operations**: All smart mapping functions are asynchronous
664
- ```javascript
665
- // Always await results
666
- const { renderer } = await colorRendererCreator.createContinuousRenderer({...});
667
- ```
668
-
669
- 3. **Field Type**: Ensure field type matches renderer type
670
- - Numeric fields for color/size continuous
671
- - String/coded value fields for type/unique values
672
-
673
- 4. **Layer Requirements**: Layer must be loaded and have the field
674
- ```javascript
675
- await featureLayer.load();
676
- const { renderer } = await colorRendererCreator.createContinuousRenderer({...});
677
- ```
678
-
679
- 5. **Color Scheme Geometry**: Color schemes are geometry-specific
680
- ```javascript
681
- const schemes = symbologyColor.getSchemes({
682
- geometryType: featureLayer.geometryType, // point, polyline, polygon
683
- theme: "high-to-low"
684
- });
685
- ```
686
-
1
+ ---
2
+ name: arcgis-smart-mapping
3
+ description: Auto-generate renderers, calculate statistics, and create data-driven visualizations. Use for class breaks, unique values, heatmaps, dot density, relationship maps, and getting histogram/summary statistics.
4
+ ---
5
+
6
+ # ArcGIS Smart Mapping
7
+
8
+ Use this skill to auto-generate renderers based on data, calculate statistics, and create intelligent visualizations.
9
+
10
+ ## Smart Mapping Overview
11
+
12
+ | Module | Purpose |
13
+ |--------|---------|
14
+ | `smartMapping/renderers/*` | Generate renderers automatically |
15
+ | `smartMapping/statistics/*` | Calculate data statistics |
16
+ | `smartMapping/symbology/*` | Get color schemes and symbols |
17
+ | `smartMapping/heuristics/*` | Determine optimal visualization settings |
18
+ | `smartMapping/raster/*` | Generate raster-specific renderers |
19
+
20
+ ## Renderer Creators
21
+
22
+ ### Color Renderer (Continuous)
23
+
24
+ Creates a renderer with color gradient based on numeric values.
25
+
26
+ ```javascript
27
+ import colorRendererCreator from "@arcgis/core/smartMapping/renderers/color.js";
28
+
29
+ const { renderer, visualVariable, colorScheme } = await colorRendererCreator.createContinuousRenderer({
30
+ layer: featureLayer,
31
+ view: view,
32
+ field: "population",
33
+ theme: "high-to-low", // high-to-low, above, below, centered-on, extremes
34
+ colorScheme: {
35
+ id: "esri-blue-5" // Optional: specify color scheme
36
+ }
37
+ });
38
+
39
+ featureLayer.renderer = renderer;
40
+ ```
41
+
42
+ ### Color Renderer (Class Breaks)
43
+
44
+ Creates a renderer with distinct color classes.
45
+
46
+ ```javascript
47
+ const { renderer, classBreakInfos } = await colorRendererCreator.createClassBreaksRenderer({
48
+ layer: featureLayer,
49
+ view: view,
50
+ field: "income",
51
+ classificationMethod: "natural-breaks", // equal-interval, quantile, standard-deviation
52
+ numClasses: 5,
53
+ colorScheme: {
54
+ id: "esri-orange-9"
55
+ }
56
+ });
57
+
58
+ featureLayer.renderer = renderer;
59
+ ```
60
+
61
+ ### Size Renderer (Continuous)
62
+
63
+ Varies symbol size based on data values.
64
+
65
+ ```javascript
66
+ import sizeRendererCreator from "@arcgis/core/smartMapping/renderers/size.js";
67
+
68
+ const { renderer, visualVariable } = await sizeRendererCreator.createContinuousRenderer({
69
+ layer: featureLayer,
70
+ view: view,
71
+ field: "magnitude",
72
+ sizeScheme: {
73
+ minSize: 4,
74
+ maxSize: 40
75
+ }
76
+ });
77
+
78
+ featureLayer.renderer = renderer;
79
+ ```
80
+
81
+ ### Size Renderer (Class Breaks)
82
+
83
+ ```javascript
84
+ const { renderer } = await sizeRendererCreator.createClassBreaksRenderer({
85
+ layer: featureLayer,
86
+ view: view,
87
+ field: "sales",
88
+ classificationMethod: "quantile",
89
+ numClasses: 4
90
+ });
91
+ ```
92
+
93
+ ### Type (Unique Values) Renderer
94
+
95
+ Creates a renderer for categorical data.
96
+
97
+ ```javascript
98
+ import typeRendererCreator from "@arcgis/core/smartMapping/renderers/type.js";
99
+
100
+ const { renderer, uniqueValueInfos } = await typeRendererCreator.createRenderer({
101
+ layer: featureLayer,
102
+ view: view,
103
+ field: "landuse",
104
+ numTypes: 10, // Maximum categories before "Other"
105
+ sortBy: "count" // value, count
106
+ });
107
+
108
+ featureLayer.renderer = renderer;
109
+ ```
110
+
111
+ ### Heatmap Renderer
112
+
113
+ Creates a heatmap for point density visualization.
114
+
115
+ ```javascript
116
+ import heatmapRendererCreator from "@arcgis/core/smartMapping/renderers/heatmap.js";
117
+
118
+ const { renderer } = await heatmapRendererCreator.createRenderer({
119
+ layer: featureLayer,
120
+ view: view,
121
+ field: "magnitude", // Optional: weight by field
122
+ colorScheme: {
123
+ id: "esri-fire"
124
+ },
125
+ radius: 18,
126
+ minDensity: 0,
127
+ maxDensity: 0.05
128
+ });
129
+
130
+ featureLayer.renderer = renderer;
131
+ ```
132
+
133
+ ### Dot Density Renderer
134
+
135
+ Shows density using dots within polygons.
136
+
137
+ ```javascript
138
+ import dotDensityRendererCreator from "@arcgis/core/smartMapping/renderers/dotDensity.js";
139
+
140
+ const { renderer } = await dotDensityRendererCreator.createRenderer({
141
+ layer: featureLayer,
142
+ view: view,
143
+ attributes: [
144
+ { field: "dem_votes", color: "blue", label: "Democrat" },
145
+ { field: "rep_votes", color: "red", label: "Republican" }
146
+ ],
147
+ dotValue: 1000, // Each dot represents 1000 votes
148
+ dotBlendingEnabled: true
149
+ });
150
+
151
+ featureLayer.renderer = renderer;
152
+ ```
153
+
154
+ ### Opacity Renderer
155
+
156
+ Varies opacity based on data values.
157
+
158
+ ```javascript
159
+ import opacityRendererCreator from "@arcgis/core/smartMapping/renderers/opacity.js";
160
+
161
+ const { renderer, visualVariable } = await opacityRendererCreator.createContinuousRenderer({
162
+ layer: featureLayer,
163
+ view: view,
164
+ field: "confidence",
165
+ minOpacity: 0.1,
166
+ maxOpacity: 1
167
+ });
168
+ ```
169
+
170
+ ### Relationship Renderer
171
+
172
+ Shows relationship between two variables.
173
+
174
+ ```javascript
175
+ import relationshipRendererCreator from "@arcgis/core/smartMapping/renderers/relationship.js";
176
+
177
+ const { renderer } = await relationshipRendererCreator.createRenderer({
178
+ layer: featureLayer,
179
+ view: view,
180
+ field1: {
181
+ field: "population"
182
+ },
183
+ field2: {
184
+ field: "income"
185
+ },
186
+ numClasses: 3, // 2, 3, or 4
187
+ focus: "HH" // HH, HL, LH, LL
188
+ });
189
+ ```
190
+
191
+ ### Predominance Renderer
192
+
193
+ Shows which category has the highest value.
194
+
195
+ ```javascript
196
+ import predominanceRendererCreator from "@arcgis/core/smartMapping/renderers/predominance.js";
197
+
198
+ const { renderer } = await predominanceRendererCreator.createRenderer({
199
+ layer: featureLayer,
200
+ view: view,
201
+ fields: [
202
+ { name: "dem_votes", label: "Democrat" },
203
+ { name: "rep_votes", label: "Republican" },
204
+ { name: "ind_votes", label: "Independent" }
205
+ ],
206
+ includeSizeVariable: true, // Size by margin
207
+ includeOpacityVariable: true // Opacity by strength
208
+ });
209
+ ```
210
+
211
+ ### Pie Chart Renderer
212
+
213
+ Creates pie charts for each feature.
214
+
215
+ ```javascript
216
+ import pieChartRendererCreator from "@arcgis/core/smartMapping/renderers/pieChart.js";
217
+
218
+ const { renderer } = await pieChartRendererCreator.createRenderer({
219
+ layer: featureLayer,
220
+ view: view,
221
+ attributes: [
222
+ { field: "asian", label: "Asian" },
223
+ { field: "black", label: "Black" },
224
+ { field: "white", label: "White" },
225
+ { field: "other", label: "Other" }
226
+ ],
227
+ sizeOptimizationEnabled: true
228
+ });
229
+ ```
230
+
231
+ ### Univariate Color-Size Renderer
232
+
233
+ Combines color and size for a single variable.
234
+
235
+ ```javascript
236
+ import univariateRendererCreator from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
237
+
238
+ const { renderer } = await univariateRendererCreator.createContinuousRenderer({
239
+ layer: featureLayer,
240
+ view: view,
241
+ field: "population",
242
+ theme: "above-and-below"
243
+ });
244
+ ```
245
+
246
+ ### Location Renderer
247
+
248
+ Simple location-based visualization (no data driven).
249
+
250
+ ```javascript
251
+ import locationRendererCreator from "@arcgis/core/smartMapping/renderers/location.js";
252
+
253
+ const { renderer } = await locationRendererCreator.createRenderer({
254
+ layer: featureLayer,
255
+ view: view,
256
+ color: [0, 112, 255]
257
+ });
258
+ ```
259
+
260
+ ## Statistics Functions
261
+
262
+ ### Class Breaks
263
+
264
+ Calculate optimal class break values.
265
+
266
+ ```javascript
267
+ import classBreaksStats from "@arcgis/core/smartMapping/statistics/classBreaks.js";
268
+
269
+ const result = await classBreaksStats({
270
+ layer: featureLayer,
271
+ field: "population",
272
+ classificationMethod: "natural-breaks", // equal-interval, quantile, standard-deviation
273
+ numClasses: 5,
274
+ normalizationField: "area" // Optional
275
+ });
276
+
277
+ console.log(result.classBreakInfos);
278
+ // [{ minValue: 0, maxValue: 1000, count: 50 }, ...]
279
+ ```
280
+
281
+ ### Histogram
282
+
283
+ Get histogram data for a field.
284
+
285
+ ```javascript
286
+ import histogram from "@arcgis/core/smartMapping/statistics/histogram.js";
287
+
288
+ const result = await histogram({
289
+ layer: featureLayer,
290
+ field: "income",
291
+ numBins: 20,
292
+ minValue: 0,
293
+ maxValue: 200000
294
+ });
295
+
296
+ console.log(result.bins);
297
+ // [{ minValue: 0, maxValue: 10000, count: 150 }, ...]
298
+ console.log(result.source); // min, max, avg, stddev
299
+ ```
300
+
301
+ ### Summary Statistics
302
+
303
+ Get statistical summary for a field.
304
+
305
+ ```javascript
306
+ import summaryStatistics from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
307
+
308
+ const result = await summaryStatistics({
309
+ layer: featureLayer,
310
+ field: "temperature"
311
+ });
312
+
313
+ console.log(result.avg); // Mean
314
+ console.log(result.count); // Feature count
315
+ console.log(result.max); // Maximum
316
+ console.log(result.min); // Minimum
317
+ console.log(result.stddev); // Standard deviation
318
+ console.log(result.sum); // Sum
319
+ console.log(result.variance); // Variance
320
+ ```
321
+
322
+ ### Summary Statistics for Age
323
+
324
+ Calculate age-based statistics from date field.
325
+
326
+ ```javascript
327
+ import summaryStatisticsForAge from "@arcgis/core/smartMapping/statistics/summaryStatisticsForAge.js";
328
+
329
+ const result = await summaryStatisticsForAge({
330
+ layer: featureLayer,
331
+ field: "construction_date",
332
+ unit: "years" // years, months, days, hours, minutes, seconds
333
+ });
334
+
335
+ console.log(result.avg); // Average age in years
336
+ ```
337
+
338
+ ### Unique Values
339
+
340
+ Get all unique values for a field.
341
+
342
+ ```javascript
343
+ import uniqueValues from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
344
+
345
+ const result = await uniqueValues({
346
+ layer: featureLayer,
347
+ field: "category"
348
+ });
349
+
350
+ console.log(result.uniqueValueInfos);
351
+ // [{ value: "Type A", count: 100, symbol: ... }, ...]
352
+ ```
353
+
354
+ ### Predominant Categories
355
+
356
+ Find which category is most common.
357
+
358
+ ```javascript
359
+ import predominantCategories from "@arcgis/core/smartMapping/statistics/predominantCategories.js";
360
+
361
+ const result = await predominantCategories({
362
+ layer: featureLayer,
363
+ fields: ["typeA_count", "typeB_count", "typeC_count"]
364
+ });
365
+
366
+ console.log(result.predominantCategoryInfos);
367
+ // [{ value: "typeA_count", count: 500 }, ...]
368
+ ```
369
+
370
+ ### Heatmap Statistics
371
+
372
+ Get statistics for heatmap configuration.
373
+
374
+ ```javascript
375
+ import heatmapStatistics from "@arcgis/core/smartMapping/statistics/heatmapStatistics.js";
376
+
377
+ const result = await heatmapStatistics({
378
+ layer: featureLayer,
379
+ view: view,
380
+ field: "magnitude"
381
+ });
382
+
383
+ console.log(result.avgDensity);
384
+ console.log(result.maxDensity);
385
+ console.log(result.minDensity);
386
+ ```
387
+
388
+ ## Symbology (Color Schemes)
389
+
390
+ ### Get Color Schemes
391
+
392
+ ```javascript
393
+ import symbologyColor from "@arcgis/core/smartMapping/symbology/color.js";
394
+
395
+ // Get schemes for sequential data
396
+ const schemes = symbologyColor.getSchemes({
397
+ geometryType: "polygon",
398
+ theme: "high-to-low"
399
+ });
400
+
401
+ console.log(schemes.primaryScheme); // Best match
402
+ console.log(schemes.secondarySchemes); // Alternatives
403
+
404
+ // Get scheme by name
405
+ const scheme = symbologyColor.getSchemeByName({
406
+ geometryType: "polygon",
407
+ name: "Blue 5",
408
+ theme: "high-to-low"
409
+ });
410
+ ```
411
+
412
+ ### Color Scheme Themes
413
+
414
+ - `high-to-low` - Sequential (low to high values)
415
+ - `above-and-below` - Diverging (center point)
416
+ - `centered-on` - Centered on specific value
417
+ - `extremes` - Emphasize high and low
418
+
419
+ ### Get Color Ramps
420
+
421
+ ```javascript
422
+ import colorRamps from "@arcgis/core/smartMapping/symbology/colorRamps.js";
423
+
424
+ const allRamps = colorRamps.all();
425
+ // Returns array of color ramp objects
426
+
427
+ const byName = colorRamps.byName("Green-Brown");
428
+ // Returns specific color ramp
429
+ ```
430
+
431
+ ## Heuristics
432
+
433
+ ### Size Range
434
+
435
+ Calculate optimal size range for data.
436
+
437
+ ```javascript
438
+ import sizeRange from "@arcgis/core/smartMapping/heuristics/sizeRange.js";
439
+
440
+ const result = await sizeRange({
441
+ layer: featureLayer,
442
+ view: view,
443
+ field: "population"
444
+ });
445
+
446
+ console.log(result.minSize); // Suggested minimum symbol size
447
+ console.log(result.maxSize); // Suggested maximum symbol size
448
+ ```
449
+
450
+ ### Scale Range
451
+
452
+ Determine appropriate scale range for visualization.
453
+
454
+ ```javascript
455
+ import scaleRange from "@arcgis/core/smartMapping/heuristics/scaleRange.js";
456
+
457
+ const result = await scaleRange({
458
+ layer: featureLayer,
459
+ view: view
460
+ });
461
+
462
+ console.log(result.minScale);
463
+ console.log(result.maxScale);
464
+ ```
465
+
466
+ ## Raster Smart Mapping
467
+
468
+ ### Class Breaks Raster Renderer
469
+
470
+ ```javascript
471
+ import rasterClassBreaks from "@arcgis/core/smartMapping/raster/renderers/classBreaks.js";
472
+
473
+ const { renderer } = await rasterClassBreaks.createRenderer({
474
+ layer: imageryLayer,
475
+ view: view,
476
+ classificationMethod: "natural-breaks",
477
+ numClasses: 5
478
+ });
479
+
480
+ imageryLayer.renderer = renderer;
481
+ ```
482
+
483
+ ### Stretch Raster Renderer
484
+
485
+ ```javascript
486
+ import rasterStretch from "@arcgis/core/smartMapping/raster/renderers/stretch.js";
487
+
488
+ const { renderer } = await rasterStretch.createRenderer({
489
+ layer: imageryLayer,
490
+ view: view,
491
+ stretchType: "standard-deviation", // min-max, standard-deviation, histogram-equalization
492
+ numberOfStandardDeviations: 2
493
+ });
494
+ ```
495
+
496
+ ### Colormap Raster Renderer
497
+
498
+ ```javascript
499
+ import rasterColormap from "@arcgis/core/smartMapping/raster/renderers/colormap.js";
500
+
501
+ const { renderer } = await rasterColormap.createRenderer({
502
+ layer: imageryLayer,
503
+ view: view
504
+ });
505
+ ```
506
+
507
+ ### RGB Raster Renderer
508
+
509
+ ```javascript
510
+ import rasterRGB from "@arcgis/core/smartMapping/raster/renderers/rgb.js";
511
+
512
+ const { renderer } = await rasterRGB.createRenderer({
513
+ layer: imageryLayer,
514
+ view: view,
515
+ bandIds: [4, 3, 2] // NIR, Red, Green (false color)
516
+ });
517
+ ```
518
+
519
+ ### Vector Field Renderer
520
+
521
+ For wind, current, or flow data.
522
+
523
+ ```javascript
524
+ import rasterVectorField from "@arcgis/core/smartMapping/raster/renderers/vectorField.js";
525
+
526
+ const { renderer } = await rasterVectorField.createRenderer({
527
+ layer: imageryLayer,
528
+ view: view,
529
+ style: "beaufort-wind" // single-arrow, wind-barb, beaufort-wind, classified-arrow
530
+ });
531
+ ```
532
+
533
+ ### Flow Renderer
534
+
535
+ Animated flow visualization.
536
+
537
+ ```javascript
538
+ import rasterFlow from "@arcgis/core/smartMapping/raster/renderers/flow.js";
539
+
540
+ const { renderer } = await rasterFlow.createRenderer({
541
+ layer: imageryLayer,
542
+ view: view
543
+ });
544
+ ```
545
+
546
+ ## Visual Variables
547
+
548
+ ### Create Visual Variable
549
+
550
+ ```javascript
551
+ import colorVV from "@arcgis/core/smartMapping/renderers/color.js";
552
+
553
+ const { visualVariable } = await colorVV.createVisualVariable({
554
+ layer: featureLayer,
555
+ view: view,
556
+ field: "temperature",
557
+ theme: "high-to-low"
558
+ });
559
+
560
+ // Add to existing renderer
561
+ renderer.visualVariables = [visualVariable];
562
+ ```
563
+
564
+ ### Update Renderer with Statistics
565
+
566
+ ```javascript
567
+ // Get existing renderer's visual variable
568
+ const colorVV = renderer.visualVariables.find(vv => vv.type === "color");
569
+
570
+ // Get new statistics
571
+ const stats = await summaryStatistics({
572
+ layer: featureLayer,
573
+ field: colorVV.field
574
+ });
575
+
576
+ // Update stops based on new statistics
577
+ colorVV.stops = [
578
+ { value: stats.min, color: [255, 255, 178] },
579
+ { value: stats.avg, color: [253, 141, 60] },
580
+ { value: stats.max, color: [189, 0, 38] }
581
+ ];
582
+ ```
583
+
584
+ ## Common Patterns
585
+
586
+ ### Complete Smart Mapping Workflow
587
+
588
+ ```javascript
589
+ // 1. Create renderer
590
+ const { renderer } = await colorRendererCreator.createContinuousRenderer({
591
+ layer: featureLayer,
592
+ view: view,
593
+ field: "population"
594
+ });
595
+
596
+ // 2. Get histogram for legend/slider
597
+ const histogramResult = await histogram({
598
+ layer: featureLayer,
599
+ field: "population",
600
+ numBins: 50
601
+ });
602
+
603
+ // 3. Apply renderer
604
+ featureLayer.renderer = renderer;
605
+
606
+ // 4. Create histogram slider widget
607
+ const slider = new HistogramRangeSlider({
608
+ bins: histogramResult.bins,
609
+ min: histogramResult.minValue,
610
+ max: histogramResult.maxValue,
611
+ values: [histogramResult.minValue, histogramResult.maxValue]
612
+ });
613
+ ```
614
+
615
+ ### Dynamic Renderer Updates
616
+
617
+ ```javascript
618
+ // Listen for extent changes and update renderer
619
+ view.watch("extent", async () => {
620
+ const stats = await summaryStatistics({
621
+ layer: featureLayer,
622
+ field: "population",
623
+ view: view // Limit to current extent
624
+ });
625
+
626
+ // Update visual variable stops
627
+ updateRendererStops(featureLayer.renderer, stats);
628
+ });
629
+ ```
630
+
631
+ ### Multi-Variable Visualization
632
+
633
+ ```javascript
634
+ // Color by one variable, size by another
635
+ const colorResult = await colorRendererCreator.createContinuousRenderer({
636
+ layer: featureLayer,
637
+ view: view,
638
+ field: "income"
639
+ });
640
+
641
+ const sizeResult = await sizeRendererCreator.createVisualVariable({
642
+ layer: featureLayer,
643
+ view: view,
644
+ field: "population"
645
+ });
646
+
647
+ colorResult.renderer.visualVariables.push(sizeResult.visualVariable);
648
+ featureLayer.renderer = colorResult.renderer;
649
+ ```
650
+
651
+ ## Common Pitfalls
652
+
653
+ 1. **View Required**: Most smart mapping functions require a view for scale-dependent calculations
654
+ ```javascript
655
+ // Always pass the view
656
+ const { renderer } = await colorRendererCreator.createContinuousRenderer({
657
+ layer: featureLayer,
658
+ view: view, // Required!
659
+ field: "population"
660
+ });
661
+ ```
662
+
663
+ 2. **Async Operations**: All smart mapping functions are asynchronous
664
+ ```javascript
665
+ // Always await results
666
+ const { renderer } = await colorRendererCreator.createContinuousRenderer({...});
667
+ ```
668
+
669
+ 3. **Field Type**: Ensure field type matches renderer type
670
+ - Numeric fields for color/size continuous
671
+ - String/coded value fields for type/unique values
672
+
673
+ 4. **Layer Requirements**: Layer must be loaded and have the field
674
+ ```javascript
675
+ await featureLayer.load();
676
+ const { renderer } = await colorRendererCreator.createContinuousRenderer({...});
677
+ ```
678
+
679
+ 5. **Color Scheme Geometry**: Color schemes are geometry-specific
680
+ ```javascript
681
+ const schemes = symbologyColor.getSchemes({
682
+ geometryType: featureLayer.geometryType, // point, polyline, polygon
683
+ theme: "high-to-low"
684
+ });
685
+ ```
686
+