require(["esri/renderers/RasterStretchRenderer"], (RasterStretchRenderer) => { /* code goes here */ });
import RasterStretchRenderer from "@arcgis/core/renderers/RasterStretchRenderer.js";
esri/renderers/RasterStretchRenderer
RasterStretchRenderer defines the symbology with a gradual ramp of colors for each pixel in a ImageryLayer, ImageryTileLayer, and WCSLayer based on the pixel value. The RasterStretchRenderer works well when you have a large range of values to display, such as in imagery, aerial photographs, or elevation models.
The stretch renderer allows you to define the range of values to be displayed and apply a ColorRamp to those values.
- See also
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The stretched values are mapped to this specified color ramp. | RasterStretchRenderer | ||
The computeGamma automatically calculates best gamma value to render exported image based on empirical model. | RasterStretchRenderer | ||
The name of the class. | Accessor | ||
When Dynamic Range Adjustment is | RasterStretchRenderer | ||
The gamma values to be used if useGamma is set to | RasterStretchRenderer | ||
Applicable when stretchType is | RasterStretchRenderer | ||
Applicable when stretchType is | RasterStretchRenderer | ||
Applicable when stretchType is | RasterStretchRenderer | ||
The outputMax denotes the output maximum, which is the highest pixel value. | RasterStretchRenderer | ||
The outputMin denotes the output minimum, which is the lowest pixel value. | RasterStretchRenderer | ||
The sigmoid strength level determines how much of the sigmoidal function will be used in the stretch. | RasterStretchRenderer | ||
The input statistics can be specified through the statistics property. | RasterStretchRenderer | ||
The stretch type defines a histogram stretch that will be applied to the rasters to enhance their appearance. | RasterStretchRenderer | ||
The type of Renderer. | RasterStretchRenderer | ||
Denotes whether the gamma value should be used. | RasterStretchRenderer |
Property Details
-
The stretched values are mapped to this specified color ramp. The color ramp algorithm must set when using this renderer, otherwise the
cie-lab
algorithm used by default.- See also
-
dynamicRangeAdjustment
dynamicRangeAdjustment Boolean
-
When Dynamic Range Adjustment is
true
, the statistics based on the current display extent are calculated as you zoom and pan around the image. This property only applies to images in 2D MapView.- Default Value:false
-
The gamma values to be used if useGamma is set to
true
. Gamma refers to the degree of contrast between the mid-level gray values of a raster dataset. Gamma does not affect the black or white values in a raster dataset, only the middle values. By applying a gamma correction, you can control the overall brightness of a layer. Gamma stretching is only valid with thenone
,standard-deviation
, andmin-max
stretch types.
-
maxPercent
maxPercent Number
-
Applicable when stretchType is
percent-clip
. Specifies the percentage of the highest values to exclude from the stretch.
-
minPercent
minPercent Number
-
Applicable when stretchType is
percent-clip
. Specifies the percentage of the lowest values to exclude from the stretch.
-
numberOfStandardDeviations
numberOfStandardDeviations Number
-
Applicable when stretchType is
standard-deviation
. Specifies the number of standard deviations to use. The values beyond the number of standard deviations become the outputMin and outputMax. The remaining values are linearly stretched between outputMin and outputMax.
-
sigmoidStrengthLevel
sigmoidStrengthLevel Number
-
The sigmoid strength level determines how much of the sigmoidal function will be used in the stretch. A low value such as 1 will only use the middle portion of the curve, which tends to produce dull and faint colors. A high value such as 6 will use the entire curve, which tends to produce bold and sharp colors.
-
statistics
statistics Number[][] |RasterBandStatistics[]
Since: ArcGIS Maps SDK for JavaScript 4.15RasterStretchRenderer since 4.12, statistics added at 4.15. -
The input statistics can be specified through the statistics property. If not specified, they will be retrieved from the data. If dynamicRangeAdjustment is
true
, these values will be ignored.- See also
Exampleslet renderer = new RasterStretchRenderer(); renderer.statistics = [ [0, 100, 50, 10] // [<min>, <max>, <mean>, <standardDeviation>] ];
let bandStat = layer.rasterInfo.statistics[0]; let renderer = new RasterStretchRenderer(); renderer.statistics = [{ min: valueSlider.values[0], max: valueSlider.values[1], avg: bandStat.avg, stddev: bandStat.stddev }];
-
stretchType
stretchType String
-
The stretch type defines a histogram stretch that will be applied to the rasters to enhance their appearance. Stretching improves the appearance of the data by spreading the pixel values along a histogram from the minimum and maximum values defined by their bit depth. For example, an 8-bit raster dataset or mosaic dataset will be stretched from 0 to 255. Different stretches will produce different results in the raster display.
The possible stretch types are listed below.
Value Description none No stretch method will be applied, even if statistics exist. standard-deviation This stretch type applies a linear stretch between the values defined by the standard deviation value. histogram-equalization The pixel values are stretched to adjust the contrast using the histogram of the data. min-max This stretch type applies a linear stretch based on the output minimum and output maximum pixel values, which are used as the endpoints for the histogram. percent-clip This stretch type applies a linear stretch between the defined minPercent and maxPercent pixel values. sigmoid The Sigmoid contrast stretch is designed to highlight moderate pixel values in your imagery while maintaining sufficient contrast at the extremes. Possible Values:"none" |"standard-deviation" |"histogram-equalization" |"min-max" |"percent-clip" |"sigmoid"
- Default Value:none
-
type
type Stringreadonly
-
The type of Renderer.
For RasterStretchRenderer the type is always "raster-stretch".
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Creates a deep clone of the renderer. | RasterStretchRenderer | ||
* | Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. | RasterStretchRenderer | |
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor | ||
Converts an instance of this class to its ArcGIS portal JSON representation. | RasterStretchRenderer |
Method Details
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, addHandles added at 4.25. -
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
clone
clone(){RasterStretchRenderer}
-
Creates a deep clone of the renderer.
ReturnsType Description RasterStretchRenderer A deep clone of the object that invoked this method. Example// Creates a deep clone of the first layer's renderer let renderer = view.map.layers.at(0).renderer.clone();
-
Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input
json
parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.Parameterjson ObjectA JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.
ReturnsType Description * Returns a new instance of this class.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
toJSON
toJSON(){Object}
-
Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.
ReturnsType Description Object The ArcGIS portal JSON representation of an instance of this class.