require(["esri/smartMapping/raster/renderers/classBreaks"], (rasterClassBreaksCreator) => { /* code goes here */ });
import * as rasterClassBreaksCreator from "@arcgis/core/smartMapping/raster/renderers/classBreaks.js";
esri/smartMapping/raster/renderers/classBreaks
This object contains helper methods for generating class breaks visualizations for raster layers (i.e. ImageryLayer, ImageryTileLayer, or WCSLayer) based on a cell or field value.
The createRenderer method in this module generates a renderer that may be applied directly to the input layer.
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Promise<RasterClassBreaksResult> | Generates a ClassBreaksRenderer used to render imagery data. | classBreaks |
Method Details
-
createRenderer
createRenderer(params){Promise<RasterClassBreaksResult>}
-
Generates a ClassBreaksRenderer used to render imagery data. Depending on the
classificationMethod
, class breaks (or data ranges) are generated based on the statistics of the data. Each cell is assigned a color based on the class break in which the value of the cell orfield
falls.ParametersSpecificationparams ObjectInput parameters for generating a classed color visualization for raster data returned from the cell value or a given field. See the table below for details of each parameter.
SpecificationThe input layer for which the renderer is generated.
renderingRule RasterFunctionoptionalDeprecated since 4.27. Use
rasterFunction
instead.rasterFunction RasterFunctionoptionalSpecifies the function for how the requested image should be processed. When
rasterFunction
is applied, the server returns updated service information that reflects custom processing as defined by the raster function. If not provided, the output renderer is created using the layer'srasterFunction
.field StringoptionalDefault Value: valueThe field whose data will be used in the classification.
classificationMethod StringoptionalDefault Value: natural-breaksThe classification method used for generating breaks.
Possible Values:"equal-interval"|"natural-breaks"|"quantile"|"standard-deviation"|"defined-interval"
variableName StringoptionalOnly applicable to multidimensional datasets where a raster layer can contain more than one variable (such as temperature, humidity, wind speed) with different statistics. Indicate the variable name here.
numClasses NumberoptionalDefault Value: 5The number of class breaks to generate for the classification. This is ignored if a
standard-deviation
classification method is specified.colorRamp AlgorithmicColorRamp|MultipartColorRampoptionalThe color ramp to apply to the renderer.
optional The colors to apply to each class break. This must be a two-dimensional array where each item of the first dimension is an array of 3-4 numbers representing the RGB or RGBA values of each class break. This overrides
colorRamp
.definedInterval NumberoptionalOnly applicable when
classificationMethod
isdefined-interval
. Specifies the interval of each break. Note this may cause the last break to extend beyond the actual data max.signal AbortSignaloptionalAllows for cancelable requests. If canceled, the promise will be rejected with an error named
AbortError
. See also AbortController.ReturnsType Description Promise<RasterClassBreaksResult> Resolves with an object containing a ClassBreaksRenderer that can be set on the input layer.
Type Definitions
-
The result object of the createRenderer() method. See the table below for details of each property.
- Properties
-
renderer ClassBreaksRenderer
The renderer object configured to best match the given basemap and the spread of the data. Set this on a layer's
renderer
property to update its visualization.classBreaksResult ClassBreaksResultThis object describes class breaks generated from data in a layer for a given field with a specified classification method.