Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: RasterFunction

dojo.require("esri.layers.RasterFunction")

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

NameSummary
new esri.layers.RasterFunction()Creates a new RasterFunction object.
new esri.layers.RasterFunction(json)Create a new Raster Function object using a json string representing a serialized version of a raster function.

Properties

NameTypeSummary
argumentsObjectDeprecated at v3.10, use functionArguments instead.
functionArgumentsObjectThe arguments for the raster function.
functionNameStringThe raster function name.
outputPixelTypeStringDefines the output image's pixel type.
variableNameStringVariable name for the raster function.

Methods

NameReturn typeSummary
toJson()ObjectReturns an easily serializable object representation of the raster function.
Constructor Details

new esri.layers.RasterFunction()

Creates a new RasterFunction object.
Sample:
var rasterFunction = new esri.layers.RasterFunction();
rasterFunction.functionName = "Hillshade";

new esri.layers.RasterFunction(json)

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.
Sample:
var rasterFunction = new esri.layers.RasterFunction(
 {
    "functionName" : "Colormap",
    "functionArguments" : {
      "ColormapName" : "Random"
    },
    "variableName" : "Raster"
 }
);
Property Details

<Object> arguments

Deprecated at v3.10, use functionArguments instead.

<Object> functionArguments

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
};

<String> functionName

The raster function name. View the Raster Functions documentation in the REST help for more details.
Sample:
 
rasterFunction.functionName = "Hillshade";

<String> outputPixelType

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"

<String> variableName

Variable name for the raster function.
Sample:
rasterFunction.variableName = "DEM";
Method Details

toJson()

Returns an easily serializable object representation of the raster function.
Return type: Object
Show Modal