require(["esri/layers/RasterFunction"], function(RasterFunction) { /* code goes here */ });
Description
(Added at v2.0)
Specifies the processing to be done to the image service. Click
here to view a full list of available raster funtions in the REST API documentation along with their valid
functionArguments. Chaining raster functions is accomplished by setting the
Raster argument in the
functionArguments property to another defined raster function. See example below on chaining a Remap raster function with a Colormap.
var remapRF = new RasterFunction();
remapRF.functionName = "Remap";
remapRF.functionArguments = {
"InputRanges" : [-3,10,11,37], //remap pixels with values -3 to 10 to now have value of 1
"OutputValues" : [1,2], //remap pixel values from 11 to 37 to have a value of 2
"Raster" : "$$" //apply Remap to the image service
};
remapRF.outputPixelType = "U8";
var colorRF = new RasterFunction();
colorRF.functionName = "Colormap";
colorRF.functionArguments = {
"Colormap" : [
[1, 255, 0, 0], //all pixels with value of 1 symbolized with red
[2, 0, 255, 0] //all pixels with value of 2 symbolized with green
],
"Raster" : remapRF //apply Colormap to output raster from the remap rasterFunction
};
imageServiceLayer.setRenderingRule(colorRF); //set rendering rule to final raster function
Samples
Search for
samples that use this class.
Constructors
Properties
Methods
| toJson() | Object | Returns an easily serializable object representation of the raster function. |
Constructor Details
Creates a new RasterFunction object.
Sample:
require([
"esri/layers/RasterFunction", ...
], function(RasterFunction, ... ) {
var rasterFunction = new RasterFunction();
rasterFunction.functionName = "Hillshade";
...
});
Create a new Raster Function object using a json string representing a serialized version of a raster function. (Added at v3.5)
Parameters:
<Object> json |
Required |
A json string representing a serialized version of a raster function. |
Property Details
The arguments for the raster function. The structure depends on the function specified. (Added at v3.5)
Sample: rasterFunction.functionArguments = {
"Azimuth":215.0,
"Altitude":75.0,
"ZFactor":0.3
};
The raster function name. View the
Raster Functions documentation in the REST help for more details.
Sample:
rasterFunction.functionName = "Hillshade";
Defines the output image's pixel type. (Added at v3.13)
Known values: "C128" | "C64" | "F32" | "F64" | "S16" | "S32" | "S8" | "U1" | "U16" | "U2" | "U32" | "U4" | "U8" | "UNKNOWN"
Default value: "UNKNOWN"
Variable name for the raster function.
Sample:
rasterFunction.variableName = "DEM";
Method Details
Returns an easily serializable object representation of the raster function.