// 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.
| name | arcgis-smart-mapping |
| 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. |
Use this skill to auto-generate renderers based on data, calculate statistics, and create intelligent visualizations.
| Module | Purpose |
|---|---|
smartMapping/renderers/* | Generate renderers automatically |
smartMapping/statistics/* | Calculate data statistics |
smartMapping/symbology/* | Get color schemes and symbols |
smartMapping/heuristics/* | Determine optimal visualization settings |
smartMapping/raster/* | Generate raster-specific renderers |
Creates a renderer with color gradient based on numeric values.
import colorRendererCreator from "@arcgis/core/smartMapping/renderers/color.js";
const { renderer, visualVariable, colorScheme } = await colorRendererCreator.createContinuousRenderer({
layer: featureLayer,
view: view,
field: "population",
theme: "high-to-low", // high-to-low, above, below, centered-on, extremes
colorScheme: {
id: "esri-blue-5" // Optional: specify color scheme
}
});
featureLayer.renderer = renderer;
Creates a renderer with distinct color classes.
const { renderer, classBreakInfos } = await colorRendererCreator.createClassBreaksRenderer({
layer: featureLayer,
view: view,
field: "income",
classificationMethod: "natural-breaks", // equal-interval, quantile, standard-deviation
numClasses: 5,
colorScheme: {
id: "esri-orange-9"
}
});
featureLayer.renderer = renderer;
Varies symbol size based on data values.
import sizeRendererCreator from "@arcgis/core/smartMapping/renderers/size.js";
const { renderer, visualVariable } = await sizeRendererCreator.createContinuousRenderer({
layer: featureLayer,
view: view,
field: "magnitude",
sizeScheme: {
minSize: 4,
maxSize: 40
}
});
featureLayer.renderer = renderer;
const { renderer } = await sizeRendererCreator.createClassBreaksRenderer({
layer: featureLayer,
view: view,
field: "sales",
classificationMethod: "quantile",
numClasses: 4
});
Creates a renderer for categorical data.
import typeRendererCreator from "@arcgis/core/smartMapping/renderers/type.js";
const { renderer, uniqueValueInfos } = await typeRendererCreator.createRenderer({
layer: featureLayer,
view: view,
field: "landuse",
numTypes: 10, // Maximum categories before "Other"
sortBy: "count" // value, count
});
featureLayer.renderer = renderer;
Creates a heatmap for point density visualization.
import heatmapRendererCreator from "@arcgis/core/smartMapping/renderers/heatmap.js";
const { renderer } = await heatmapRendererCreator.createRenderer({
layer: featureLayer,
view: view,
field: "magnitude", // Optional: weight by field
colorScheme: {
id: "esri-fire"
},
radius: 18,
minDensity: 0,
maxDensity: 0.05
});
featureLayer.renderer = renderer;
Shows density using dots within polygons.
import dotDensityRendererCreator from "@arcgis/core/smartMapping/renderers/dotDensity.js";
const { renderer } = await dotDensityRendererCreator.createRenderer({
layer: featureLayer,
view: view,
attributes: [
{ field: "dem_votes", color: "blue", label: "Democrat" },
{ field: "rep_votes", color: "red", label: "Republican" }
],
dotValue: 1000, // Each dot represents 1000 votes
dotBlendingEnabled: true
});
featureLayer.renderer = renderer;
Varies opacity based on data values.
import opacityRendererCreator from "@arcgis/core/smartMapping/renderers/opacity.js";
const { renderer, visualVariable } = await opacityRendererCreator.createContinuousRenderer({
layer: featureLayer,
view: view,
field: "confidence",
minOpacity: 0.1,
maxOpacity: 1
});
Shows relationship between two variables.
import relationshipRendererCreator from "@arcgis/core/smartMapping/renderers/relationship.js";
const { renderer } = await relationshipRendererCreator.createRenderer({
layer: featureLayer,
view: view,
field1: {
field: "population"
},
field2: {
field: "income"
},
numClasses: 3, // 2, 3, or 4
focus: "HH" // HH, HL, LH, LL
});
Shows which category has the highest value.
import predominanceRendererCreator from "@arcgis/core/smartMapping/renderers/predominance.js";
const { renderer } = await predominanceRendererCreator.createRenderer({
layer: featureLayer,
view: view,
fields: [
{ name: "dem_votes", label: "Democrat" },
{ name: "rep_votes", label: "Republican" },
{ name: "ind_votes", label: "Independent" }
],
includeSizeVariable: true, // Size by margin
includeOpacityVariable: true // Opacity by strength
});
Creates pie charts for each feature.
import pieChartRendererCreator from "@arcgis/core/smartMapping/renderers/pieChart.js";
const { renderer } = await pieChartRendererCreator.createRenderer({
layer: featureLayer,
view: view,
attributes: [
{ field: "asian", label: "Asian" },
{ field: "black", label: "Black" },
{ field: "white", label: "White" },
{ field: "other", label: "Other" }
],
sizeOptimizationEnabled: true
});
Combines color and size for a single variable.
import univariateRendererCreator from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
const { renderer } = await univariateRendererCreator.createContinuousRenderer({
layer: featureLayer,
view: view,
field: "population",
theme: "above-and-below"
});
Simple location-based visualization (no data driven).
import locationRendererCreator from "@arcgis/core/smartMapping/renderers/location.js";
const { renderer } = await locationRendererCreator.createRenderer({
layer: featureLayer,
view: view,
color: [0, 112, 255]
});
Calculate optimal class break values.
import classBreaksStats from "@arcgis/core/smartMapping/statistics/classBreaks.js";
const result = await classBreaksStats({
layer: featureLayer,
field: "population",
classificationMethod: "natural-breaks", // equal-interval, quantile, standard-deviation
numClasses: 5,
normalizationField: "area" // Optional
});
console.log(result.classBreakInfos);
// [{ minValue: 0, maxValue: 1000, count: 50 }, ...]
Get histogram data for a field.
import histogram from "@arcgis/core/smartMapping/statistics/histogram.js";
const result = await histogram({
layer: featureLayer,
field: "income",
numBins: 20,
minValue: 0,
maxValue: 200000
});
console.log(result.bins);
// [{ minValue: 0, maxValue: 10000, count: 150 }, ...]
console.log(result.source); // min, max, avg, stddev
Get statistical summary for a field.
import summaryStatistics from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
const result = await summaryStatistics({
layer: featureLayer,
field: "temperature"
});
console.log(result.avg); // Mean
console.log(result.count); // Feature count
console.log(result.max); // Maximum
console.log(result.min); // Minimum
console.log(result.stddev); // Standard deviation
console.log(result.sum); // Sum
console.log(result.variance); // Variance
Calculate age-based statistics from date field.
import summaryStatisticsForAge from "@arcgis/core/smartMapping/statistics/summaryStatisticsForAge.js";
const result = await summaryStatisticsForAge({
layer: featureLayer,
field: "construction_date",
unit: "years" // years, months, days, hours, minutes, seconds
});
console.log(result.avg); // Average age in years
Get all unique values for a field.
import uniqueValues from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
const result = await uniqueValues({
layer: featureLayer,
field: "category"
});
console.log(result.uniqueValueInfos);
// [{ value: "Type A", count: 100, symbol: ... }, ...]
Find which category is most common.
import predominantCategories from "@arcgis/core/smartMapping/statistics/predominantCategories.js";
const result = await predominantCategories({
layer: featureLayer,
fields: ["typeA_count", "typeB_count", "typeC_count"]
});
console.log(result.predominantCategoryInfos);
// [{ value: "typeA_count", count: 500 }, ...]
Get statistics for heatmap configuration.
import heatmapStatistics from "@arcgis/core/smartMapping/statistics/heatmapStatistics.js";
const result = await heatmapStatistics({
layer: featureLayer,
view: view,
field: "magnitude"
});
console.log(result.avgDensity);
console.log(result.maxDensity);
console.log(result.minDensity);
import symbologyColor from "@arcgis/core/smartMapping/symbology/color.js";
// Get schemes for sequential data
const schemes = symbologyColor.getSchemes({
geometryType: "polygon",
theme: "high-to-low"
});
console.log(schemes.primaryScheme); // Best match
console.log(schemes.secondarySchemes); // Alternatives
// Get scheme by name
const scheme = symbologyColor.getSchemeByName({
geometryType: "polygon",
name: "Blue 5",
theme: "high-to-low"
});
high-to-low - Sequential (low to high values)above-and-below - Diverging (center point)centered-on - Centered on specific valueextremes - Emphasize high and lowimport colorRamps from "@arcgis/core/smartMapping/symbology/colorRamps.js";
const allRamps = colorRamps.all();
// Returns array of color ramp objects
const byName = colorRamps.byName("Green-Brown");
// Returns specific color ramp
Calculate optimal size range for data.
import sizeRange from "@arcgis/core/smartMapping/heuristics/sizeRange.js";
const result = await sizeRange({
layer: featureLayer,
view: view,
field: "population"
});
console.log(result.minSize); // Suggested minimum symbol size
console.log(result.maxSize); // Suggested maximum symbol size
Determine appropriate scale range for visualization.
import scaleRange from "@arcgis/core/smartMapping/heuristics/scaleRange.js";
const result = await scaleRange({
layer: featureLayer,
view: view
});
console.log(result.minScale);
console.log(result.maxScale);
import rasterClassBreaks from "@arcgis/core/smartMapping/raster/renderers/classBreaks.js";
const { renderer } = await rasterClassBreaks.createRenderer({
layer: imageryLayer,
view: view,
classificationMethod: "natural-breaks",
numClasses: 5
});
imageryLayer.renderer = renderer;
import rasterStretch from "@arcgis/core/smartMapping/raster/renderers/stretch.js";
const { renderer } = await rasterStretch.createRenderer({
layer: imageryLayer,
view: view,
stretchType: "standard-deviation", // min-max, standard-deviation, histogram-equalization
numberOfStandardDeviations: 2
});
import rasterColormap from "@arcgis/core/smartMapping/raster/renderers/colormap.js";
const { renderer } = await rasterColormap.createRenderer({
layer: imageryLayer,
view: view
});
import rasterRGB from "@arcgis/core/smartMapping/raster/renderers/rgb.js";
const { renderer } = await rasterRGB.createRenderer({
layer: imageryLayer,
view: view,
bandIds: [4, 3, 2] // NIR, Red, Green (false color)
});
For wind, current, or flow data.
import rasterVectorField from "@arcgis/core/smartMapping/raster/renderers/vectorField.js";
const { renderer } = await rasterVectorField.createRenderer({
layer: imageryLayer,
view: view,
style: "beaufort-wind" // single-arrow, wind-barb, beaufort-wind, classified-arrow
});
Animated flow visualization.
import rasterFlow from "@arcgis/core/smartMapping/raster/renderers/flow.js";
const { renderer } = await rasterFlow.createRenderer({
layer: imageryLayer,
view: view
});
import colorVV from "@arcgis/core/smartMapping/renderers/color.js";
const { visualVariable } = await colorVV.createVisualVariable({
layer: featureLayer,
view: view,
field: "temperature",
theme: "high-to-low"
});
// Add to existing renderer
renderer.visualVariables = [visualVariable];
// Get existing renderer's visual variable
const colorVV = renderer.visualVariables.find(vv => vv.type === "color");
// Get new statistics
const stats = await summaryStatistics({
layer: featureLayer,
field: colorVV.field
});
// Update stops based on new statistics
colorVV.stops = [
{ value: stats.min, color: [255, 255, 178] },
{ value: stats.avg, color: [253, 141, 60] },
{ value: stats.max, color: [189, 0, 38] }
];
// 1. Create renderer
const { renderer } = await colorRendererCreator.createContinuousRenderer({
layer: featureLayer,
view: view,
field: "population"
});
// 2. Get histogram for legend/slider
const histogramResult = await histogram({
layer: featureLayer,
field: "population",
numBins: 50
});
// 3. Apply renderer
featureLayer.renderer = renderer;
// 4. Create histogram slider widget
const slider = new HistogramRangeSlider({
bins: histogramResult.bins,
min: histogramResult.minValue,
max: histogramResult.maxValue,
values: [histogramResult.minValue, histogramResult.maxValue]
});
// Listen for extent changes and update renderer
view.watch("extent", async () => {
const stats = await summaryStatistics({
layer: featureLayer,
field: "population",
view: view // Limit to current extent
});
// Update visual variable stops
updateRendererStops(featureLayer.renderer, stats);
});
// Color by one variable, size by another
const colorResult = await colorRendererCreator.createContinuousRenderer({
layer: featureLayer,
view: view,
field: "income"
});
const sizeResult = await sizeRendererCreator.createVisualVariable({
layer: featureLayer,
view: view,
field: "population"
});
colorResult.renderer.visualVariables.push(sizeResult.visualVariable);
featureLayer.renderer = colorResult.renderer;
View Required: Most smart mapping functions require a view for scale-dependent calculations
// Always pass the view
const { renderer } = await colorRendererCreator.createContinuousRenderer({
layer: featureLayer,
view: view, // Required!
field: "population"
});
Async Operations: All smart mapping functions are asynchronous
// Always await results
const { renderer } = await colorRendererCreator.createContinuousRenderer({...});
Field Type: Ensure field type matches renderer type
Layer Requirements: Layer must be loaded and have the field
await featureLayer.load();
const { renderer } = await colorRendererCreator.createContinuousRenderer({...});
Color Scheme Geometry: Color schemes are geometry-specific
const schemes = symbologyColor.getSchemes({
geometryType: featureLayer.geometryType, // point, polyline, polygon
theme: "high-to-low"
});