Raster function objects

Index

Well known functions:

Raster function templates:

Overview

The image service has multiple operations supporting the renderingRule parameter. A rendering rule defines how the requested image should be rendered or processed. It consists of a raster function, associated arguments, output pixel type, and variable name. The raster function name identifies the processing or rendering to be performed, the associated arguments provide parameter name value pairs used by the processing, and the output pixel type defines the output image's pixel type. Among the raster function arguments, there is one or more arguments that take rasters as input. The variableName operation identifies the argument name that takes raster inputs. The following is the syntax for rendering rules:

{
  "rasterFunction" : "<rasterFunctionName>",
  "rasterFunctionArguments" : {
         "argument1":<value1>,
         "argument2":<value2>,     
         "argumentn":<valuen>
         },
  "outputPixelType" : "<outputPixelType>",//new at 10.2, default is UNKNOWN. C128 | C64 | F32 | F64 | S16 | S32 | S8 | U1 | U16 | U2 | U32 | U4 | U8 | UNKNOWN
  "variableName" : "<variableName>" //optional for well known functions, default is "Raster" for raster function templates.
}

See Using Rasters in Rendering Rules for more information on how to use raster inputs and variableName.

The image service has a few well-known raster functions that do not need to be preconfigured with the service. These well known functions include the following:

At 10.1 and later, a client can invoke a raster function template that is preconfigured on the server side along with the service. A raster function template defines a processing chain composed of one or more raster functions, including customized raster functions that are extended based on ArcObjects. Information about these raster function templates is available through the RasterFunctionInfos property on the image service root resource page. A client can omit rasterFunctionArguments, and take the default configuration in the raster function template, or overwrite them by specifying argument parameters (argument names and value types are defined by the author of each raster function template and are not discoverable through REST).

ArcGIS supports numerous raster functions. Not all raster functions in ArcGIS are directly exposed as well-known functions, but they can be used in service-defined raster function templates. For more information, see Server-side raster functions and What are the functions used by a raster or mosaic dataset.

At 10.2 and later, a client can define a raster function template by chaining multiple well-known raster functions and can also specify output pixel types; this does not apply to service-defined raster function templates.

This topic describes the well-known raster functions supported by the REST API, as well as raster function template syntax and examples: either service defined or client defined.

At 10.2.1, in addition to well-known functions, service-defined raster function templates can also be used in client-defined raster function templates.

At 10.3, service-defined raster function templates can group rasters using a designated attribute and resolve rasters using a tag. For example, a fish habitat suitability model may need multiple rasters from different variables, such as water temperature, salinity, and so on. The service publisher can define a raster function template that groups rasters by an attribute, for example, an attribute representing a particular slice in time and depth. Then they can resolve these rasters in a group using a tagged attribute, for example tag or variableName. The client can get this information from Raster Function Infos; the grouping and tagging are done on the server side, so the client can simply invoke the template.

At 10.5.1, Hillshade now supports multidirectional and traditional hillshades.

"rasterFunction": "ArgStatistics"

The ArgStatistics function produces an output with a pixel value that represents a statistical metric from all bands of input rasters. The statistics can be the band index of the maximum, minimum, or median value, or the duration (number of bands) between a minimum and maximum value.

This function was added at 10.3.

The arguments for the ArgStatistics function are as follows:

{
  "rasterFunction" : "ArgStatistics",
  "rasterFunctionArguments" : {
    "ArgStatisticsType" : <ArgStatisticsType>, //int 0=maximum, 1= minimum, 2=median, 3=duration
    "MinValue":<MinValue>, //double, required if the type is duration
    "MaxValue":<MaxValue>, //double, required if the type is duration
    "UndefinedClass":<UndefinedClass>, //int, required if the type is maximum or minimum
    "Rasters":[<raster1>,<raster2>,<raster3>] //array of rasters. 
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

Calculate duration between 0.15 to 1 (number of continuous bands that meet the condition).

{
  "rasterFunction" : "ArgStatistics",
  "rasterFunctionArguments" : {
       "ArgStatisticsType" : 3,
       "MinValue":0.15,
       "MaxValue":1,
       "UndefinedClass":100
       "Raster" : "$$"
     }  
}

"rasterFunction": "Arithmetic"

The Arithmetic function performs an arithmetic operation between two rasters or a raster and a scalar, and vice versa.

This function was added at 10.2.1.

The arguments for the Arithmetic function are as follows:

{
  "rasterFunction" : "Mask",
  "rasterFunctionArguments" : {
    "Raster" : <Raster>,//raster, or scalars(space delimited string, or array of double) 
    "Raster2" : <Raster2>,//raster, or scalars(space delimited string, or array of double)
    "Operation" : <Operation>,//int 1 = esriRasterPlus, 2 = esriRasterMinus, 3 = esriRasterMultiply, 
																													 //4= esriRasterDivide, 5=esriRasterPower, 6=esriRasterMode
    "ExtentType" : <ExtentType>,//int, optional, default 0 : default 0 0 = esriExtentFirstOf, 
                              //1=esriExtentIntersectionOf, 2=esriExtentUnionOf, 3=esriExtentLastOf 
    "CellsizeType" : <CellsizeType>,//int, optional, default 0 : 0 = esriCellsizeFirstOf, 
                              //1=esriCellsizeMinOf, 2=esriCellsizeMaxOf,3=esriCellsizeMeanOf,
                              //4=esriCellsizeLastOf
    },
  "outputPixelType" : "<outputPixelType>",//optional
}

Example

Minus 100

{
  "rasterFunction" : "Arithmetic",
  "rasterFunctionArguments" : {
     {
       "Raster" : "$$",
       "Raster2: "100",
       "Operation" : 2
     }  
}

"rasterFunction": "Aspect"

Aspect identifies the downslope direction of the maximum rate of change in value from each cell to its neighbors. Aspect can be thought of as the slope direction. The values of the output raster will be the compass direction of the aspect. For more information, see Aspect function and How Aspect works.

The Aspect function takes no arguments.

{
  "rasterFunction" : "Aspect"
}

"rasterFunction": "BandArithmetic"

The BandArithmetic function performs an arithmetic operation on the bands of a raster dataset. For more information, see Band Arithmetic function.

This function was added at 10.1.

The arguments for the BandArithmetic function are as follows:

{
  "rasterFunction" : "BandArithmetic",
  "rasterFunctionArguments" : {
    "Method" : <Method>,//int (0 = UserDefined, 1 = NDVI, 2 = SAVI, 3 = TSAVI, 4 = MSAVI, 5 = GEMI, 6 = PVI, 7 = GVITM, 8 = Sultan, 9 = VARI)
    "BandIndexes" : "<BandIndexes>",//string e.g. (B3 - B1 / B3 + B1)
    "Raster":<raster>//optional, default is the image service 
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

The equations and corresponding BandIndexes are listed below for each method. In all equations, NIR equals pixel values from the near-infrared band, and Red equals pixel values from the red band.

Example

{
  "rasterFunction" : "BandArithmetic",
  "rasterFunctionArguments" : {
    "Method" : 0,
    "BandIndexes" : "(B3 - B1 / B3 + B1)",
    "Raster":<raster>//optional, default is the image service 
  },
  "variableName" : "Raster"
}

"rasterFunction": "Classify"

The Classify function classifies a segmented raster to a categorical raster.

LicenseLicense:

At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.6 Enterprise Advanced or ArcGIS Image Server to use this resource.

At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

This function was added at 10.3.

The arguments for the Classify function are as follows:

{
  "rasterFunction" : "Classify",
  "rasterFunctionArguments" : {
    "ClassifierDefinition" : <Definition_json>, //a json object that defines the classifier parameters.    
    "Raster":<Raster>,//the input raster, usually this is the service
    "Raster2":<Raster2>,//optional. additional input raster which may contain the segment information. If provided, pixels in each segment will get same class assignments.
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

Classify a segmented image using maximum likelihood classifier.

{
  "rasterFunction" : "Classify",
  "rasterFunctionArguments" : {
       "ClassifierDefinition" : {  
           "EsriClassifierDefinitionFile" : 0,
           "FileVersion" : 1, 
           "NumberDefinitions" : 1, 
           "Definitions" : [
                {
                 "Classifier" : "MaximumLikelihood",
                 "NumberClasses" : 2,  
                 "RasterIsSegmented" : false,  
                 "NumberBands" : 3,
                 "Classes" : [ 
                    {
                      "ClassValue" : 1,
                      "ClassName" : "Vegetation",
                      "Red" : 230,
                      "Green" : 0,
                      "Blue" : 0, 
                      "Count" : 546, 
                      "Means" : [244.9359,14.88278,15.21978],
                      "Covariances" : [
                           [10.26146,   0.1390063,   0.1074951    ],
                           [0.1390063,  10.31593,    1.207584E-04 ],
                           [0.1074951,  1.207584E-04,10.19345     ]]
                    },
                    {
                      "ClassValue" : 2,
                      "ClassName" : "Water",
                      "Red" : 0,
                      "Green" : 77,
                      "Blue" : 168,
                      "Count" : 716,
                      "Means" : [15.05587,15.01257,244.9567],
                      "Covariances" : [
                           [10.18124,   0.1152196,   0.2789551  ],
                           [0.1152196,  10.02638,    -0.3583943 ],
                           [0.2789551,  -0.3583943,  10.11684   ]]
                    }]
                 }]
            }
     }  
}

"rasterFunction": "Clip"

For more information, see Clip function.

This function was added at 10.1.

The arguments for the Clip function are as follows:

{
  "rasterFunction" : "Clip",
  "rasterFunctionArguments" : {
    "ClippingGeometry" : <geometry>,//a polygon or envelope
    "ClippingType" : <clippingType>,//int (1= clippingOutside, 2=clippingInside), use 1 to keep image inside of the geometry
    "Raster":<raster>//optional, default is the image service 
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "Clip",
  "rasterFunctionArguments" : {
    "ClippingGeometry" : {
      "rings" : [[[10,10], [9,11], [10,12], [11,11], [12,10],[10,10]]], "spatialReference" : {"wkid" : 4326} },             "extent" : { "xmin" :10, "ymin" : 10, "xmax" : 12, "ymax" : 12, "spatialReference" : {"wkid" : 4326} },
    "ClippingType": 1
    },
  "variableName" : "Raster"
}

"rasterFunction": "Colormap"

The Colormap function transforms the pixel values to display the raster data as a red, green, blue (RGB) color image, based on specific colors in a color map or a color range defined in a color ramp. For more information, see Colormap function.

Display raster data using a pre-defined ColorrampName or a customized Colorramp object. Several ArcGIS pre-defined color ramps are provided:

Color ramp with name table

Pre-defined color ramps graphics and their corresponding names may be viewed from the layer's properties window, in the Symbology tab. The particular color ramp or scheme name is specified in the ColorrampName argument object.

For more information about color ramp objects, see color ramp objects.

This function was added at 10.6.

The arguments for the Colormap function are as follows:

{
  "rasterFunction" : "Colormap",
  "rasterFunctionArguments" : {
    "ColormapName" : "<Random | NDVI | NDVI2 | NDVI3 | Elevation | Gray | Hillshade>",
    "Colormap" : [
      [<value1>, <red1>, <green1>, <blue1>], //[int, int, int, int]
      [<value2>, <red2>, <green2>, <blue2>]
    ],
				"ColorrampName" : "<Black To White | Yellow To Red | Slope | more…>"
				"Colorramp" : {color ramp object},
    "Raster":<raster>//optional, default is the image service 	
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example 1

{
  "rasterFunction" : "Colormap",
  "rasterFunctionArguments" : {
    "ColormapName" : "Random"
  },
  "variableName" : "Raster"
}

Example 2

{
  "rasterFunction" : "Colormap",
  "rasterFunctionArguments" : {
    "Colormap" : [
      [1, 255, 0, 0],
      [2, 0, 255, 0],
      [3, 125, 25, 255],
      ...
    ]
  },
  "variableName" : "Raster"
}

Example 3

{
  "rasterFunction" : "Colormap", 
  "rasterFunctionArguments" : {
    "ColorrampName" : "Blue Bright"
  },
  "variableName" : "Raster"
}

Example 4

{
  "rasterFunction": "Colormap",
  "rasterFunctionArguments": {
    "colorramp": {
      "type": "multipart",
      "colorRamps": [{
        "type": "algorithmic",
        "fromColor": [255,0,0,255],
        "toColor": [0,255,0,255],
        "algorithm": "esriHSVAlgorithm"
      },
      {
        "type": "algorithmic",
        "fromColor": [155,34,78,255],
        "toColor": [255,0,0,255],
        "algorithm": "esriCIELabAlgorithm"
      }]
    }
  }
}

"rasterFunction": "ColormapToRGB"

The ColormapToRGB function is designed to work with single band image service that has internal colormap. It will convert the image into a three-band 8-bit RGB raster. This function takes no arguments except an input raster. For qualified image service, there are two situations when the ColormapToRGB function is automatically applied: The colormapToRGB property of the image service is set to “true”; or, client asks to export image into jpg or png format. For more information, see Colormap To RGB function.

This function was added at 10.6.

The arguments for the ColormapToRGB function are as follows:

{
  "rasterFunction" : "ColormapToRGB",
  "rasterFunctionArguments" : {
    "Raster":<raster> //optional, default is the image service
  }
}

"rasterFunction": " ColorspaceConversion"

The ColorspaceConversion function converts the color model of a three-band unsigned 8-bit image from either the hue, saturation, and value (HSV) to red, green, and blue (RGB) or vice versa. An ExtractBand function and/or a Stretch function are sometimes used for converting the imagery into valid input of ColorspaceConversion function. For more information, see Color Model Conversion function.

This function was added at 10.6.

The arguments for the ColorspaceConversion function are as follows:

{
  "rasterFunction": "ColorspaceConversion",
  "rasterFunctionArguments": {
    "ConversionType": <int>, //0: convert color model from RGB to HSV; 1: convert color model from HSV to RGB
    "Raster": "$$" //optional, default is the image service
  }
}

Example

Perform a RGB to HSV color model conversion on input raster.

{
  "rasterFunction": "ColorspaceConversion",
  "rasterFunctionArguments": {
"ConversionType": 0,
    "raster": "$$"
  }
}

"rasterFunction": "Complex"

The Complex function is used when input raster has complex pixel type. It computes magnitude from complex value to convert the pixel type to floating point for each pixel. It takes no argument but an optional input raster. For more information, see Complex function.

This function was added at 10.6.

The arguments for the Complex function are as follows:

{
  "rasterFunction": "Complex",
  "rasterFunctionArguments": {
"Raster": <raster> //optional, default is the image service
  }
}

"rasterFunction": "CompositeBand"

The CompositeBand function allows you to combine multiple images to form a multiband image.

This function was added at 10.2.1.

The arguments for the CompositeBand function are as follows:

{
  "rasterFunction" : "CompositeBand",
  "rasterFunctionArguments" : {
    "Rasters" : [<raster>,<raster>,<raster>] //array of rasters
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

"rasterFunction": "ContrastBrightness"

The ContrastBrightness function enhances the appearance of raster data (imagery) by modifying the brightness or contrast within the image. This function works on 8-bit input raster only.

This function was added at 10.2.1.

The arguments for the ContrastBrightness function are as follows:

{
  "rasterFunction" : "ContrastBrightness",
  "rasterFunctionArguments" : {
    "ContrastOffset" : <ContrastOffset>,//double, -100 to 100 
    "BrightnessOffset" : <BrightnessOffset>,//double, -100 to 100
    "Raster":<raster>//optional, default is the image service 
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "ContrastBrightness",
  "rasterFunctionArguments" : {
       "ContrastOffset" : 30,
       "BrightnessOffset: 10,
       "Raster" : "$$"
     }  
}

"rasterFunction": "Convolution"

The Convolution function performs filtering on the pixel values in an image, which can be used for sharpening an image, blurring an image, detecting edges within an image, or other kernel-based enhancements. For more information, see Convolution function.

This function was added at 10.1.

The arguments for the Convolution function are as follows:

{
  "rasterFunction" : "Convolution",
  "rasterFunctionArguments" : {
    "Columns" : <Columns>,
    "Rows" : <Rows>,
    "Kernel" : [<k11>, <k12>, ... <k1n>, <k21>, <k22>, <k2n>,... <km1>, <km2>, <kmn>]//an array that has m x n elements
    "Type" : <Type>,//int (-1 = UserDefined, 0 = LineDetectionHorizontal, 1 = LineDetectionVertical, 2 = LineDetectionLeftDiagonal, 
	3 = LineDetectionRightDiagonal, 4 = GradientNorth, 5 = GradientWest, 6 = GradientEast, 7 = GradientSouth, 8 = GradientNorthEast,
	9 = GradientNorthWest, 10 = SmoothArithmeticMean, 11 = Smoothing3x3, 12 = Smoothing5x5, 13 = Sharpening3x3, 14 = Sharpening5x5,
	15 = Laplacian3x3, 16 = Laplacian5x5, 17 = SobelHorizontal, 18 = SobelVertical, 19 = Sharpen, 20 = Sharpen2, 21 = PointSpread)    
    "Raster":<raster>//optional, default is the image service 
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "Convolution",
  "rasterFunctionArguments" : {
    "Type" : 11
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

"rasterFunction": "Curvature"

The Curvature function displays the shape or curvature of the slope. A part of a surface can be concave or convex; you can tell that by looking at the curvature value. The curvature is calculated by computing the second derivative of the surface. Refer to this conceptual help on how it works.

The arguments for the Curvature function are as follows:

{
  "rasterFunction" : "Curvature",
  "rasterFunctionArguments" : {
    "Type" : ":<type>, //0 = Standard, 1=Platform, 2=Profile
    "ZFactor":<zFactor>, //double
				"Raster":<Raster>, //optional, default is the service "$$"
    },
  "outputPixelType" : "<outputPixelType>",//optional
}

Example

Curvature

{ 
"rasterFunction":"Curvature",
"rasterFunctionArguments":{
   "Type":0,
   "ZFactor":1
 }
}

"rasterFunction": "ElevationVoidFill"

The ElevationVoidFill function is used to create pixels where holes exist in your elevation. Refer to this conceptual help on how it works.

The arguments for the ElevationVoidFill function are as follows:

{
  "rasterFunction" : "ElevationVoidFill",
  "rasterFunctionArguments" : {
    "MaxVoidWidth" : ":<MaxVoidWidth> //number. Maximum void width to fill. 0: fill all
    "Raster":<Raster>, //optional, default is the service "$$"
    },
  "outputPixelType" : "<outputPixelType>",//optional
}

Remarks: MaxVoidWidth is used to specify the largest size of a void that you want to fill. The units of this parameter are the same as the units used in your spatial reference system.

Example

Elevation Void Fill

{ 
"rasterFunction":"ElevationVoidFill",
"rasterFunctionArguments":{
  "MaxVoidWidth":0
 }
}

"rasterFunction": "ExtractBand"

The ExtractBand function allows you to extract one or more bands from a raster, or it can reorder the bands in a multiband image.

This function was added at 10.2.1.

The arguments for the ExtractBand function are as follows:

{
  "rasterFunction" : "ExtractBand",
  "rasterFunctionArguments" : {
    "BandIDs" : [<id>,<id>,<id>] //array of int
    "BandNames":["<name>","<name","<name"] //array of string
    "BandWavelengths":[<wavelength>,<wavelength>,<wavelength>] //array of double
    "MissingBandAction":<act> //int, 0 = esriMissingBandActionFindBestMatch, 1 = esriMissingBandActionFail
    "WavelengthMatchTolerance":<WavelengthMatchTolerance>, //double
    "Raster":<raster>//optional, default is the image service 
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "ExtractBand",
  "rasterFunctionArguments" : {
       "BandIDs" : [3,2,1],
       "Raster" : "$$"
     }  
}

"rasterFunction": "Geometric"

The Geometric function transforms the image (for example, orthorectification) based on a sensor definition and a terrain model.

This function was added at 10.1.

The arguments for the Geometric function are as follows:

{
  "rasterFunction" : "Geometric",
  "rasterFunctionArguments" : {
    "GeodataTransforms" : <GeodataTransform>,//Please refer to the Geodata Transformations documentation for more details.
    "AppendGeodataXform" : <true|false>,//boolean
    "ZFactor" : <ZFactor>,//double
    "ZOffset" : <ZOffset>,//double
    "ConstantZ" : <ConstantZ>,//double
    "CorrectGeoid" : <true|false>,//boolean
    "Raster":<raster>//optional, default is the image service 
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "Geometric",
  "rasterFunctionArguments" : {
    "GeodataTransforms" : [{
          "geodataTransform" : "Polynomial",
          "geodataTransformArguments" : {
            "sourcePoints" : [ {"x":0, "y":0}, {"x":0, "y":200}, {"x":200, "y":0} ],
            "targetPoints" : [ {"x":100, "y":100}, {"x":100, "y":300}, {"x":300, "y":100} ],
            "polynomialOrder" : 1,
            "spatialReference": {"wkid" : 54004}
          }
        }],
    "AppendGeodataXform" : true
  },
  "variableName" : "Raster"
}

"rasterFunction": "Grayscale"

The Grayscale function converts a multi-band image into a single-band grayscale image. Specified weights are applied to each of the input bands, and a normalization is applied for output. For more information, see Grayscale function.

This function was added at 10.6.

The arguments for the Greyscale function are as follows:

{
  "rasterFunction" : "Grayscale",
  "rasterFunctionArguments" : {
"conversionParameters":<array_of_double>, //a length of N array representing weights for each band. N=band count.
"Raster":<raster> //optional, default is the image service
  }
}

Example

Perform a linear transformation for a three-band input raster.

{
  "rasterfunction":"Grayscale",
  "rasterfunctionarguments":{
    "conversionparameters":[1,3,2],
"raster":"$$"
       }
     }

Output = (1 * Input_band_1 + 3 * Input_band_2 + 2 * Input_band_3)/(1 + 3 + 2);

"rasterFunction": "Hillshade"

A hillshade is a grayscale 3D model of the surface taking the sun's relative position into account to shade the image. For more information, see Hillshade function and How Hillshade works.

The arguments for the Hillshade function are as follows:

{
  "rasterFunction" : "Hillshade",
  "rasterFunctionArguments" : {
    "HillshadeType":<HillshadeType>, //new at 10.5.1.  0 = traditional, 1 = multi-directional; default is 0.
    "Azimuth" : <Azimuth>, //double (e.g. 215.0)
    "Altitude" : <Altitude>, //double (e.g. 75.0)
    "ZFactor" : <ZFactor>, //double (e.g. 0.3)	
    "SlopeType":<SlopeType>,//new at 10.2. 1=DEGREE, 2=PERCENTRISE, 3=SCALED. default is 1.	
    "PSPower":<PSPower>,//new at 10.2. double, used together with SCALED slope type	
    "PSZFactor":<PSZFactor>,//new at 10.2. double, used together with SCALED slope type	
    "RemoveEdgeEffect":<SlopeType>//new at 10.2. boolean, true of false 	
    "DEM":<raster>//optional, default is the image service 	
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "DEM"
}

Example

{
  "rasterFunction" : "Hillshade",
  "rasterFunctionArguments" : {
    "Azimuth" : 215.0,
    "Altitude" : 75.0,
    "ZFactor" : 0.3
  },
  "variableName" : "DEM"
}

"rasterFunction": "Identity"

The Identity function is used to define the source raster as part of the default mosaicking behavior of the mosaic dataset. This function is a no-op function and takes no arguments except a raster. For more information, see Identity function

This function was added at 10.6.

The arguments for the Identity function are as follows:

{
  "rasterFunction" : "Identity",
  "rasterFunctionArguments" : {
    "Raster":<raster>
  }
}

"rasterFunction": "Local"

The Local function allows you to perform bitwise, conditional, logical, mathematical, and statistical operations on a pixel-by-pixel basis. For more information, see Local function.

LicenseLicense:

At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.6 Enterprise Advanced or ArcGIS Image Server to use this resource.

At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

The Local function works on single band or the first band of an image only, and the output is single band.

The arguments for the Local function are as follows:

{
  "rasterFunction" : "Local",
  "rasterFunctionArguments" : {
    "Operation" : <operation> //int see reference below.
    "Rasters":[<raster1>,<raster2>,<raster3>] //array of rasters. If a scalar is needed for the operation
                                              //the scalar can be in double or string
    "ExtentType" : <ExtentType>,//int, optional, default 0. 0 = esriExtentFirstOf, 
                              //1=esriExtentIntersectionOf, 2=esriExtentUnionOf, 3=esriExtentLastOf 
    "CellsizeType" : <CellsizeType>,//int, optional, default 0. 0 = esriCellsizeFirstOf, 
                              //1=esriCellsizeMinOf, 2=esriCellsizeMaxOf,3=esriCellsizeMeanOf,
                              //4=esriCellsizeLastOf
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Rasters"//optional
}

There are many operations supported by the Local function, see esriGeoAnalysisFunctionEnum Constants for more information.

Example

Minus 100

{
  "rasterFunction" : "Local",
  "rasterFunctionArguments" : {
       "Operation" : 2,
       "Rasters" : ["$$",100]
     }  
}

"rasterFunction": "Mask"

The Mask function changes the image by specifying a certain pixel value or a range of pixel values as no data.

This function was added at 10.2.1.

The arguments for the Mask function are as follows:

{
  "rasterFunction" : "Mask",
  "rasterFunctionArguments" : {
    "NoDataValues" : ["band0_val","band1_val",...],//array of string
    "IncludedRanges" : [band0_lowerbound,band0_upperbound,band1...],//array of double
    "NoDataInterpretation" : <NoDataInterpretation>,//int 0=esriNoDataMatchAny, 1=esriNoDataMatchAll
    "Raster":<raster>//optional, default is the image service 
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "Mask",
  "rasterFunctionArguments" : {
     "NoDataValues" : ["-100"],
     "IncludedRanges" : [-800,100],
     "NoDataInterpretation" : 0
     },  
  "variableName" : "Raster"
}

"rasterFunction": "MLClassify"

The MLClassify function allows you to perform a supervised classification using the maximum likelihood classification algorithm. The hosting ArcGIS Server needs to have a Spatial Analyst license.

LicenseLicense:

At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.6 Enterprise Advanced or ArcGIS Image Server to use this resource.

At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

This function was added at 10.2.1.

The arguments for the MLClassify function are as follows:

{
  "rasterFunction" : "MLClassify",
  "rasterFunctionArguments" : {
    "SignatureFile" : "<signature>",  //string. a signature string returned from computeClassStatistics (GSG)
    "Raster":<raster>//optional, default is the image service 
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

"rasterFunction": "NDVI"

The Normalized Difference Vegetation Index (NDVI) is a standardized index that allows you to generate an image displaying greenness (relative biomass). This index takes advantage of the contrast of the characteristics of two bands from a multispectral raster dataset—the chlorophyll pigment absorptions in the red band and the high reflectivity of plant materials in the near-infrared (NIR) band. For more information, see NDVI function.

The arguments for the NDVI function are as follows:

{
  "rasterFunction" : "NDVI",
  "rasterFunctionArguments" : {
    "VisibleBandID" : <VisibleBandID>, //int (zero-based band id, e.g. 2)
    "InfraredBandID" : <InfraredBandID>, //int (zero-based band id, e.g. 1)
    "Raster":<raster>//optional, default is the image service 
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "NDVI",
  "rasterFunctionArguments" : {
    "VisibleBandID" : 2,
    "InfraredBandID" : 1
  },
  "variableName" : "Raster"
}

The following equation is used by the NDVI function to generate a 0–200 range 8 bit result:

NDVI = ((IR - R)/(IR + R)) * 100 + 100
. If you need the specific pixel values (-1.0 to 1.0), use the BandArithmetic function and choose the NDVI method.

"rasterFunction": "Pansharpening"

The Pansharpening function uses a higher-resolution panchromatic raster to fuse with a lower-resolution, multiband raster. It can generate colorized multispectral image with higher resolution. For more information, see Pan-sharpening function.

This function was added at 10.6.

The arguments for the pansharpening function are as follows:

{
  "rasterFunction": "pansharpening",
  "rasterFunctionArguments": {
    "Weights": <array_of_double>, //Weights applied for Red, Green, Blue, Near-Infrared bands. 4-elements array, Sum of values is 1.
"PansharpeningType": <int>, //Pansharpening method, 0:IHS; 1:Brovey; 2:Esri; 3:Simple Mean; 4:Gram-Schmidt. 
"PanImage": <raster>, 
"MSImage": <raster>, 
"InfraredImage": <raster>, //optional if "UseFourthBandOfMSAsIR" is true or selected pansharpening method doesn’t require near-infrared image.
"UseFourthBandOfMSAsIR": <true|false>, //true if "MSImage" has near-infrared image on fourth band.
"Sensor": <string> //optional sensor name.
  }
}

Example

Pansharpening Landsat 8 data with Gram-Schmidt method. Image service is published from Landsat 8 mosaic dataset "$oid"="$band_number" in the example.

{
    "rasterFunction" : "Pansharpening",
    "rasterFunctionArguments" : {
          "Weights" : [0.42, 0.51, 0.07, 0],
          "PansharpeningType" : 4,
          "PanImage" : "$8",
          "MSImage" : {
                "rasterFunction" : "CompositeBand",
                "rasterFunctionArguments" : {
                      "Rasters" : ["$4", "$3", "$2", "$5"]
                }
          },
          "UseFourthBandOfMSAsIR" : false
    }
}

"rasterFunction": "RasterCalculator"

The RasterCalculator function provides access to all existing math functions so you can make calls to them when building your expressions. The calculator function requires single-band inputs. If you need to perform expressions on bands in a multispectral image as part of a function chain, you can use the Extract Bands function before the RasterCalculator function. For more information including operators supported, see the Calculator function.

This function was added at 10.6.

The arguments for the RasterCalculator function are as follows:

{
  "rasterFunction" : "RasterCalculator",
  "rasterFunctionArguments" : {
    "InputNames" : ["raster1_Name","raster2_Name","raster3_Name”,…], //array of strings for arbitrary raster names.
    "Expression" : "raster1_Name + raster2_Name - raster3_Name, //string, expression to calculate output raster from input rasters
    "ExtentType" : <ExtentType>,//int, optional, default 0 : default 0 0 = esriExtentFirstOf, 
                              //1=esriExtentIntersectionOf, 2=esriExtentUnionOf, 3=esriExtentLastOf 
    "CellsizeType" : <CellsizeType>,//int, optional, default 0 : 0 = esriCellsizeFirstOf, 
                              //1=esriCellsizeMinOf, 2=esriCellsizeMaxOf,3=esriCellsizeMeanOf,
                              //4=esriCellsizeLastOf
    "Rasters":[<raster1>,<raster2>,<raster3>,] //array of rasters.
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

Add the first item and second item of the image service.

{
  "rasterFunction":"RasterCalculator",
  "rasterFunctionArguments":{ 
    "InputNames":["a1","name2"],
    "Expression":"a1+name2",
    "ExtentType":0,
    "CellsizeType":1,
    "Rasters":["$1","$2"]
  }
}

"rasterFunction": "Recast"

The Recast function reassigns argument values in an existing function template.

The arguments for the Recast function are based on the function it is overwriting.

{
  "rasterFunction" : "Recast",
  "rasterFunctionArguments" : {
    "<ArgumentName1>" : <ArgumentValue1>, //ArgumentName1 will be reassigned with ArgumentValue1
    "<ArgumentName2>" : <ArgumentValue2>, //ArgumentName1 will be reassigned with ArgumentValue2
    "..."
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

View the high vegetation and buildings class of a particular LAS in a mosaic. Set the mosaic rule to the following:

{
  {
  "mosaicMethod" : "esriMosaicLockRaster",
  "lockRasterIds": [1],
  "ascending" : true,
  "mosaicOperation" : "MT_FIRST",
  "itemRenderingRule":{
      "rasterFunction":"Recast",
      "rasterFunctionArguments":{"ClassTypes":[5,6]}
     }
}

LAS Function contains ClassTypes that can be used in REST API through the Recast function. ClassTypes include the following: 0=Never Classified, 1=Unclassified, 2=Ground, 3=Low Vegetation,4=Medium Vegetation,5=High Vegetation,6=Building,7=Noisy Low Point,8=Model Key Point, 9=Water,10=Rail, 11=Road surface,12=Reserved, 13=Wire guard, 14= Wire conductor, 15=Transmission tower, 16=Wire structure connector, 17=Bridge deck, 18=High noise

Change the ZFactor of an existing hillshade function on the first raster in the service.

{
  "rasterFunction" : "Recast",
  "rasterFunctionArguments" : {
       "ZFactor" : 3.5,
       "Raster":"$1"
     }  
}

"rasterFunction": "Remap"

The Remap function allows you to change or reclassify the pixel values of the raster data. For more information, see Remap function.

This function was added at 10.1.

The arguments for the Remap function are as follows:

{
  "rasterFunction" : "Remap",
  "rasterFunctionArguments" : {
    "InputRanges" : [<value1_from>, <value1_to>, …],//[double, double,…], input ranges are specified in pairs: from (inclusive) and to (exclusive).
    "OutputValues" : [<value1>, …],//[double, …], output values of corresponding input ranges
    "GeometryType":<geometryType>,//added at 10.3
    "Geometries":[<geometry1>, <geometry2>, ...],//added at 10.3
    "NoDataRanges" : [<nodatavalue1_from>, < nodatavalue1_to>, …],//[double, double, …], nodata ranges are specified in pairs: from (inclusive) and to (exclusive).
    "AllowUnmatched" : <true|false>,//Boolean, specify whether to keep the unmatched values or turn into nodata.
    "Raster":<raster>//optional, default is the image service 
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

Remap by pixel values.

{
  "rasterFunction" : "Remap",
  "rasterFunctionArguments" : {
    "InputRanges" : [0,100,101,200],
    "OutputValues" : [5,125],
  },
  "variableName" : "Raster"
}

Remap by geometries.

{
	"rasterFunction": "Remap",
	"rasterFunctionArguments": {
		"InputRanges": [50,51],
		"OutputValues": [71],
		"GeometryType": "esriGeometryEnvelope",		
		"Geometries": [{
		"spatialReference": {
			"wkid": 2264
		},
			"rings": [[[1432285,529578],[1436048,	529578],[1434048,531578],[1433285,533205],[1432285,529578]]]}]
	}
}

"rasterFunction": "Resample"

The Resample function resamples pixel values from a given resolution.

The arguments for the Resample function are as follows:

{
  "rasterFunction" : "Resample",
  "rasterFunctionArguments" : {
    "ResamplingType" : <ResamplingType>, //0=NearestNeighbor,1=Bilinear,2=Cubic,3=Majority,
                      4=BilinearInterpolationPlus,5=BilinearGaussBlur, 6=BilinearGaussBlurPlus
                      7=Average, 8=Minimum, 9=Maximum,10=VectorAverage(require two bands)
    "InputCellsize" : <InputCellsize>, //point that defines cellsize in source spatial reference
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

InputCellsize only supports source spatial reference.

Use this function only if the workflow has specific computing requirements, such as computing average wind magnitude-direction. Resampling from a designated resolution can be much slower than the default behavior (nearest resolution). In most cases, using the interpolation parameter in the exportImage request is sufficient.

Example

Resample a wind magnitude-direction raster using vector average from base resolution.

{
  "rasterFunction" : "Resample",
  "rasterFunctionArguments" : {
       "ResamplingType" : 10,
       "InputCellsize":{"x":0.125,"y":0.125}
     }  
}

"rasterFunction": "SegmentMeanShift"

The SegmentMeanShift function produces a segmented output. Pixel values in the output image represent the converged RGB colors of the segment. The input raster needs to be a 3-band 8-bit image. If the image service is not a 3-band 8-bit unsigned image, you can use the Stretch function before the SegmentMeanShift function.

LicenseLicense:

At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.6 Enterprise Advanced or ArcGIS Image Server to use this resource.

At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

The arguments for the SegmentMeanShift function are as follows:

{
  "rasterFunction" : "SegmentMeanShift",
  "rasterFunctionArguments" : {
    "SpectralDetail" : <SpectralDetail>, //double 0-21. Bigger value is faster and has more segments.
    "SpatialDetail":<SpatialDetail>, //int 0-21. Bigger value is faster and has more segments.
    "SpectralRadius":<MaxValue>, //double. Bigger value is slower and has less segments.
    "SpatialRadius":<UndefinedClass>, //int. Bigger value is slower and has less segments.
    "MinNumPixelsPerSegment":<MinNumPixelsPerSegment>,//int
    "Raster":<Raster> //the raster to be segmented. optional, default is the service.
    },
  "outputPixelType" : "<outputPixelType>",//optional
}

Example

Segment an image.

{
  "rasterFunction" : "SegmentMeanShift",
  "rasterFunctionArguments" : {
       "SpectralDetail" : 15.5,
       "SpatialDetail":15,
       "MinNumPixelsPerSegment":20,
       "Raster" : "$$"
     }  
}

"rasterFunction": "ShadedRelief"

Shaded relief is a color 3D model of the terrain, created by merging the images from the Elevation-coded and Hillshade methods. For more information, see Shaded relief function.

The arguments for the ShadedRelief function are as follows:

{
  "rasterFunction" : "ShadedRelief",
  "rasterFunctionArguments" : {
    "Azimuth" : <Azimuth>, //double (e.g. 215.0)
    "Altitude" : <Altitude>, //double (e.g. 75.0)
    "ZFactor" : <ZFactor>, //double (e.g. 0.3)
    "Colormap" : [
      [<value1>, <red1>, <green1>, <blue1>], //[int, int, int, int]
      [<value2>, <red2>, <green2>, <blue2>]
    ],
    "SlopeType":<SlopeType>,//new at 10.2. 1=DEGREE, 2=PERCENTRISE, 3=SCALED. default is 1.	
    "PSPower":<PSPower>,//new at 10.2. double, used together with SCALED slope type	
    "PSZFactor":<PSZFactor>,//new at 10.2. double, used together with SCALED slope type	
    "RemoveEdgeEffect":<SlopeType>,//new at 10.2. boolean, true of false 	
    "Raster":<raster>//optional, default is the image service 	
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "ShadedRelief",
  "rasterFunctionArguments" : {
    "Azimuth" : 215.0,
    "Altitude" : 75.0,
    "ZFactor" : 0.3,
    "Colormap" : [
      [1, 255, 0, 0],
      [2, 0, 255, 0],
      [3, 125, 25, 255],
      ...
    ],
    "Raster":<raster>//optional, default is the image service 	
  },
  "variableName" : "Raster"
}

"rasterFunction": "Slope"

Slope represents the rate of change of elevation for each pixel. For more information, see Slope function and How Slope works.

The arguments for the Slope function are as follows:

{
  "rasterFunction" : "Slope",
  "rasterFunctionArguments" : {
    "ZFactor" : <ZFactor> //double (e.g. 0.3)
    "SlopeType":<SlopeType>,//new at 10.2. 1=DEGREE, 2=PERCENTRISE, 3=SCALED. default is 1.	
    "PSPower":<PSPower>,//new at 10.2. double, used together with SCALED slope type	
    "PSZFactor":<PSZFactor>,//new at 10.2. double, used together with SCALED slope type	
    "RemoveEdgeEffect":<RemoveEdgeEffect>//new at 10.2. boolean, true of false
    "DEM":<raster>//optional, default is the image service 	
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "DEM"
}

Example

{
  "rasterFunction" : "Slope",
  "rasterFunctionArguments" : {
    "ZFactor" : 0.3
  }
}

"rasterFunction": "Speckle"

The Speckle function filters the speckled radar dataset to smooth out the noise while retaining the edges or sharp features in the image. Four speckle reduction filtering algorithms are provided through this function. For more information including required and optional parameters for each filter and the default parameter values, see the Speckle function.

This function was added at 10.6

{
  "rasterFunction": "Speckle",
  "rasterFunctionArguments":{
    "FilterType": <int>, //0: Lee, 1: Enhanced Lee, 2: Frost, 3: Kuan
    "FilterSize": <int>, //kernel size. 0: 3x3, 1: 5x5, 2: 7x7, 3: 9x9, 4: 11x11
    "NoiseModel": <int>, //for Lee filter only. 0: Multiplicative Noise, 1: Additive Noise, 2: Additive and Multiplicative Noise
    "NoiseVar": <double> //for Lee filter with NoiseModel 1 or 2 only.
    "AdditiveNoiseMean":  <double> //for lee filter with NoiseModel 2 only.
    "MultiplicativeNoiseMean":  <double> //for lee filter with NoiseModel 0 or 2 only.
    "NLooks": <int> //for Lee, Enhanced Lee, and Kuan filters.
    "DampFactor": <double>, //for Enhanced Lee and Frost filters.
    "Raster": <raster>
  }
}

Example

Despeckle a radar image service with Lee filter

{
  "rasterFunction": "Speckle",
  "rasterFunctionArguments":{
    "FilterType": 0,
    "FilterSize": 4,
    "NoiseModel": 0,
    "MultiplicativeNoiseMean":  1,
    "NLooks": 1,
    "Raster": "$$"
  }
}

"rasterFunction": "SpectralConversion"

The SpectralConversion function applies a matrix to a multi-band image to affect the spectral values of the output. In the matrix, different weights can be assigned to all the input bands to calculate each of the output bands. The column/row size of the matrix equals to the band count of input raster. For more information, see the Spectral Conversion function.

This function was added at 10.6.

The arguments for the SpectralConversion function are as follows:

{
  "rasterFunction" : "SpectralConversion",
  "rasterFunctionArguments" : {
    "ConversionMatrix":<array_of_double>, //a NxN length one-dimension matrix. N=band count.
    "Raster":<raster> //optional, default is the image service
  }
}

Example

Perform a linear transformation for a three-band input raster.

{
   "rasterfunction": "SpectralConversion",
   "rasterfunctionarguments": {
          "conversionmatrix": [0.3,0.2,0.5,0,1,0,1,0,0],
          "raster": "$$"
   }
}

Below is an illustration of how numbers in conversion matrix will be used.

Output band_1 = 0.3 * Input_band_1 + 0.2 * Input_band_2 + 0.5 * Input_band_3;
Output band_2 = 0 * Input_band_1 + 1 * Input_band_2 + 0 * Input_band_3;
Output band_3 = 1 * Input_band_1 + 0 * Input_band_2 + 0 * Input_band_3;

"rasterFunction": "Statistics"

The Statistics function calculates focal statistics for each pixel of an image based on a defined focal neighborhood. For more information, see Statistics function.

The arguments for the Statistics function are as follows:

{
  "rasterFunction" : "Statistics",
  "rasterFunctionArguments" : {
    "Type" : "<Min | Max | Mean | StandardDeviation>",
    "KernelColumns" : <KernelColumns>, //int (e.g. 3)
    "KernelRows" : <KernelRows> //int (e.g. 3)
    "Raster":<raster>//optional, default is the image service 
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

The following syntax is supported from 10.2.1. The existing syntax above is also supported.

{
  "rasterFunction" : "Statistics",
  "rasterFunctionArguments" : {
    "Type" : <Type>, //int 1=Min, 2=Max, 3=Mean, 4=StandardDeviation
    "Columns" : <Columns>, //int (e.g. 3)
    "Rows" : <Rows>, //int (e.g. 3)
    "FillNoDataOnly":<fillNoDataOnly>, //bool
    "Raster":<raster>//optional, default is the image service 
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "Statistics",
  "rasterFunctionArguments" : {
    "Type" : "Mean",
    "KernelColumns" : 3,
    "KernelRows" : 3
  },
  "variableName" : "Raster"
}

"rasterFunction": "StatisticsHistogram"

The StatisticsHistogram function is used to define the statistics and histogram of a raster. It is normally used for control the default display of exported image. For more information, see Statistics and Histogram function.

This function was added at 10.6.

The arguments for the StatisticsHistogram function are as follows:

{
  "rasterFunction": "StatisticsHistogram",
  "rasterFunctionArguments": {
    "Statistics": <array of statistics objects>, //predefined statistics for each band
"Histograms": <array of histogram objects>, //predefined histograms for each band
"Raster": <raster> //optional, default is the image service
  }
}

Example

Customize the statistics and histograms for input raster.

{
  "rasterFunction": "StatisticsHistogram",
  "rasterFunctionArguments": {
    "statistics": [{
     "min": 0,
      "max": 23.064547000000001,
      "mean": 4.547517,
      "standardDeviation": 2.6870280000000002,
      "count": 10000,
      "median": 5,
      "mode": 6
    }],
    "histograms": [{
      "size": 256,
      "min": 0,
      "max": 23.064547032777931,
      "counts": [559,
        172,
        217,
        ... //256 elements for each of the bins in this example
     ]
   }]
 }
}

"rasterFunction": "Stretch"

The Stretch function enhances an image through multiple stretch types. For more information, see Stretch function.

The arguments for the Stretch function are as follows:

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
    "StretchType" : <StretchType>, //int (0 = None, 3 = StandardDeviation, 4 = Histogram Equalization, 5 = MinMax, 6 = PercentClip, 9 = Sigmoid)
    "Min" : <min>, //double 
    "Max" : <max>, //double
    "NumberOfStandardDeviations" : <NumberOfStandardDeviations>, //double (e.g. 2.5)
    "Statistics" : [
      [<min1>, <max1>, <mean1>, <standardDeviation1>], //[double, double, double, double]
      [<min2>, <max2>, <mean2>, <standardDeviation2>]
    ],
    "DRA": <true|false>,//boolean. derive statistics from current request, Statistics parameter is ignored when DRA is true
    "MinPercent":<minPercent>, //double (e.g. 0.25), applicable to PercentClip
    "MaxPercent":<maxPercent>, //double (e.g. 0.5), applicable to PercentClip
    "UseGamma":<true|false>,
    "Gamma" : [<gamma1>, <gamma2>, <gamma3>], //array of doubles
    "ComputeGamma”:<true|false>, //optional, applicable to any stretch type when "UseGamma" is "true"
    "SigmoidStrengthLevel":<sigmoidStrengthLevel>, //int (1~6), applicable to Sigmoid 
    "Raster":<raster>//optional, default is the image service 
  },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example 1 (StandardDeviation)

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
    "StretchType" : 3,
    "NumberOfStandardDeviations" : 2.5,
    "Statistics" : [
      [0, 255, 56.7, 54.8],
      [0, 255, 97.5, 94.5],
      [0, 255, 87.5, 87.3]
    ],
    "UseGamma":true,
    "Gamma" : [1.25, 1.25, 1.25],
  },
  "outputPixelType":"U8",
  "variableName" : "Raster"
}

Example 2 (MinMax)

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
    "StretchType" : 5,
    "Statistics" : [
      [50, 200, 56.7, 54.8],
      [50, 200, 97.5, 94.5],
      [50, 200, 87.5, 87.3]
    ],
    "Min":100,
    "Max":255,
    "UseGamma" : false,
  },
  "outputPixelType":"U8",
  "variableName" : "Raster"
}

Example 3 (PercentClip)

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
    "StretchType" : 6,
    "MinPercent" : 0.25,
    "MaxPercent" : 0.25,
    "Gamma" : [1.25, 1.25, 1.25],
    "DRA":true,
    "Min":100,
    "Max":255,
  },
  "outputPixelType":"U8",
  "variableName" : "Raster"
}

Example 4 (None)

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
    "StretchType" : 0,
  },
  "variableName" : "Raster"
}

Example 5 (HistogramEqualization)

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
    "StretchType" : 4,
  },
  "outputPixelType":"U8",
  "variableName" : "Raster"
}

Example 6 (Sigmoid)

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
"StretchType" : 9,
"SigmoidStrengthLevel" : 1
  },
  "outputPixelType":"U8",
  "variableName" : "Raster"
}

"rasterFunction": "TasseledCap"

The TasseledCap function is designed to analyze and map vegetation and urban development changes detected by various satellite sensor systems. It is known as the Tasseled Cap transformation due to the shape of the graphical distribution of data. This function takes no arguments except a raster. The input for this function is the source raster of image service. There are no other parameters for this function because all the information is derived from the input's properties and key metadata (bands, data type, and sensor name). Only imagery from the Landsat MSS, Landsat TM, Landsat ETM+, IKONOS, QuickBird, WorldView-2 and RapidEye sensors are supported. Prior to applying this function, there should not be any functions that would alter the pixel values in the function chain, such as the Stretch, Apparent Reflectance or Pansharpening function. The only exception is for Landsat ETM+; when using Landsat ETM+, the Apparent Reflectance function must precede the Tasseled Cap function.

For more information, see the Tasseled Cap function.

This function was added at 10.6.

The arguments for the TasseledCap function are as follows:

{
  "rasterFunction" : "TasseledCap",
  "rasterFunctionArguments" : {
    "Raster":<raster> //optional, default is the image service
  }
}

"rasterFunction": "Threshold"

The binary Threshold function produces the binary image. It uses the Otsu method and assumes the input image to have a bi-modal histogram.

The arguments for the Threshold function are as follows:

{
  "rasterFunction" : "Threshold",
  "rasterFunctionArguments" : {
    "ThresholdType" : <ThresholdType>, //int 1=Otsu
    "Raster":<raster>//optional, default is the image service 
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

Otsu threshold

{
  "rasterFunction" : "Threshold",
  "rasterFunctionArguments" : {
       "ThresholdType" : 1,
       "Raster" : "$$"
     }  
}

"rasterFunction": "TransposeBits"

The TransposeBits function performs a bit operation. It extracts bit values from the source data and assigns them to new bits in the output data.

The arguments for the TransposeBits function are as follows:

{
  "rasterFunction" : "TransposeBits",
  "rasterFunctionArguments" : {
    "InputBitPositions" : <InputBitPositions>,//array of long, required
    "OutputBitPositions": <DirectionBandID>,//array of long, required
    "ConstantFillCheck":<true | false>,//bool, optional
    "ConstantFillValue":<ConstantFillValue>,//int, required
    "Raster":<Raster>, //optional, the input raster to be transposed, default is the service "$$"
    "FillRaster":<size>,//optional, the fill raster 
    },
  "outputPixelType" : "<outputPixelType>",//optional
}

If ConstantFillCheck is false, it assumes there is an input FillRaster. If an input FillRaster is not given, it falls back ConstantFillCheck to true and looks for ConstantFillValue. Filling is used to initialize pixel values of the output raster.

Landsat 8 has a quality assessment band. The following are the example input and output bit positions to extract confidence levels by mapping them to 0-3:

Example

Extract Landsat 8 Snow/Ice confidence levels.

{
  "rasterFunction" : "TransposeBits",
  "rasterFunctionArguments" : {
    "InputBitPositions" : [10,11],
    "OutputBitPositions": [0,1],
    "ConstantFillValue":0,
    "Raster":"$$",
    },
  "outputPixelType" : "U8",
}

Extract Landsat 8 Cirrus confidence levels and map to different colors for visualization.

{	
  "rasterFunction": "Colormap",
 	"rasterFunctionArguments": {
     "Colormap": [[0,255,0,0],[1,0,255,0],[2,0,0,255],[3,255,255,0]],
     "Raster": {
    			"rasterFunction": "TransposeBits",
       "rasterFunctionArguments": {
           "InputBitPositions": [12,13],
           "OutputBitPositions": [0,1],
           "ConstantFillValue": 0,
           	} 
        }
      }
}

"rasterFunction": "UnitConversion"

The UnitConversion function performs unit conversions.

The arguments for the UnitConversion function are as follows:

{
  "rasterFunction" : "UnitConversion",
  "rasterFunctionArguments" : {
    "FromUnit" : <FromUnit>,//units constant listed below (int)
    "ToUnit": <ToUnit>,//units constant listed below (int)
    "Raster":<Raster>, //the input raster, default is the service "$$"
    },
  "outputPixelType" : "<outputPixelType>",//optional
}

FromUnit and ToUnit take the following:

Example

Convert pixel values from feet to meters

{
  "rasterFunction" : "UnitConversion",
  "rasterFunctionArguments" : {
    "FromUnit" : 3,
    "ToUnit": 9,
    "Raster":"$$",
    },
  "outputPixelType" : "U8",
}

"rasterFunction": "VectorField"

The VectorField function is used to composite two single-band rasters (each raster represents U/V or Magnitude/Direction) into a two-band raster (each band represents U/V or Magnitude/Direction). Data combination type (U-V or Magnitude-Direction) can also be converted interchangeably with this function. For more information, see Vector Field function.

This function was added at 10.6.

The arguments for the VectorField function are as follows:

{
  "rasterFunction": "VectorField",
  "rasterFunctionArguments": {
    "Raster1": <raster>, //raster item representing “U” or “Magnitude” 
"Raster2": <raster>, //raster item representing “V” or “Direction”
    "InputDataType": <string>, //”Vector-UV” or “Vector-MagDir” per input used in “Raster1” and “Raster2”
    "AngleReferenceSystem": <int>, //optional when “InputDataType” is “Vector-UV”. 0: Geographic; 1: Arithmetic
    "OutputDataType": <string> //”Vector-UV” or “Vector-MagDir”
  }
}

Example

Perform a vector field data composite and then a conversion from two single-band Magnitude and Direction rasters into one U-V two-band raster.

{
  "rasterFunction": "VectorField",
  "rasterFunctionArguments": {
    "Raster1": $1,
    "Raster2": $2,
    "AngleReferenceSystem": 0,
    "InputDataType": Vector-MagDir,
    "OutputDataType": Vector-UV
  }
}

"rasterFunction": "VectorFieldRenderer"

The VectorFieldRenderer function symbolizes a U-V or Magnitude-Direction raster.

This function was added at 10.6.

The arguments for the VectorFieldRenderer function are as follows:

{
  "rasterFunction" : "VectorFieldRenderer",
  "rasterFunctionArguments" : {
    "MagnitudeBandID" : <MagnitudeBandID>,
    "DirectionBandID": <DirectionBandID>,
    "IsUVComponents":<true | false>,//bool
    "ReferenceSystem":<ReferenceSystem>,//int 1=Arithmetic, 2= Angular
    "MassFlowAngleRepresentation":<representation>, //int 0=from 1 =to
    "SymbolTileSize":<size>,
    "SymbolTileSizeUnits":<units>,
    "CalculationMethod":"<CalculationMethod>"//string, "Vector Average" |
    "SymbologyName":"<SymbologyName>", //string, "Single Arrow" |
    "MinimumMagnitude":<MinimumMagnitude>,
    "MaximumMagnitude":<MaximumMagnitude>,
    "MinimumSymbolSize":<MinimumSymbolSize>,
    "MaximumSymbolSize":<MaximumSymbolSize>,
    "Raster":<Raster> //optional
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

Example

{
  "rasterFunction" : "VectorFieldRenderer",
  "rasterFunctionArguments" : {
    "MagnitudeBandID" : 0,
    "DirectionBandID": 1,
    "IsUVComponents":true,
    "ReferenceSystem":1,
    "MassFlowAngleRepresentation":0,
    "SymbolTileSize":50,
    "SymbolTileSizeUnits":100,
    "CalculationMethod":"Vector Average",
    "SymbologyName":"Single Arrow",
    "MinimumMagnitude":1,
    "MaximumMagnitude":-1,
    "MinimumSymbolSize":20,
    "MaximumSymbolSize":80,
    "Raster":<Raster> //optional
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Raster"
}

"rasterFunction": "WeightedOverlay"

The WeightedOverlay function allows you to overlay several rasters using a common measurement scale and weights each according to its importance. For more information, see Weighted Overlay function.

LicenseLicense:

At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.6 Enterprise Advanced or ArcGIS Image Server to use this resource.

At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

The arguments for the WeightedOverlay function from 10.5.1 onward are as follows:

{
  "rasterFunction" : "WeightedOverlay",
  "rasterFunctionArguments" : {
    "Rasters": [<raster1>,<raster2>,...],  //array of rasters.
    "Fields": ["<field1>","<field2>",...], //[string, string, ...] 
    "Influences": [<influence1>,<influence2>,...], //[double, double, ...]
    "Remaps": ["<remap1>","<remap2>",...], //array of strings
     //["oldVal11 newVal11, oldVal12 newVal12, ...", "oldVal21 newVal21, oldVal22 newVal22, ...", ...]
    "EvalFrom": <evalfrom>, //required, numeric value of evaluation scale from
    "EvalTo": <evalto> //required, numeric value of evaluation scale to
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Rasters"//optional
}

Example

{
  "rasterFunction" : "WeightedOverlay",
  "rasterFunctionArguments" : {
       "Rasters": ["$$","$$","$$"],
       "Fields": ["Value","Value","Value"],
       "Influences": [0.5,0.2,0.3],
       "Remaps": ["0 1, 1 1, 5 5", "1 1, 5 5, 10 NODATA", "0 1, 1 1, 9 9, NODATA -1"]
       "EvalFrom": -1,
       "EvalTo": 9
      }  
}

"rasterFunction": "WeightedSum"

The WeightedSum function allows you to overlay several rasters, multiplying each by their given weight and summing them together. For more information, see Weighted Sum function.

LicenseLicense:

At 10.5, you must license your ArcGIS Server as ArcGIS Server 10.6 Enterprise Advanced or ArcGIS Image Server to use this resource.

At versions prior to 10.5, the hosting ArcGIS Server needs to have a Spatial Analyst license.

The arguments for the WeightedSum function from 10.5.1 onward are as follows:

{
  "rasterFunction" : "WeightedSum",
  "rasterFunctionArguments" : {
    "Rasters": [<raster1>,<raster2>,...],  //array of rasters.
    "Fields": ["<field1>","<field2>",...],//[string, string, ...] 
    "Weights": [<weight1>,<weight2>,...]  //[double, double, ...]
    },
  "outputPixelType" : "<outputPixelType>",//optional
  "variableName" : "Rasters"//optional
}

Example

{
  "rasterFunction" : "WeightedSum",
  "rasterFunctionArguments" : {
       "Rasters": ["$$","$$","$$"],
       "Fields": ["Value","Value","Value"],
       "Weights": [0.25,0.25,0.5]
      }  
}

Using a raster function template defined by the service

The name of the raster function template is displayed in the image service root resource. Function arguments are optional; argument names and default values are created by the author of the raster function template and are not known through REST. A client can simply provide the name of the raster function template only (to the RasterFunction property) or, optionally, provide arguments to overwrite the default values.

For more information about authoring server-side raster function templates, see Server-side raster functions.

{
  "rasterFunction" : "rasterFunctionTemplateName",
}

{
  "rasterFunction" : "rasterFunctionTemplateName",
  "rasterFunctionArguments" : {
  "ArgumentName1":, //overwrite default value of ArgumentName1, type and default value are defined by the author of the template
  "ArgumentName2":, //overwrite default value of ArgumentName2, type and default value are defined by the author of the template
  ...
  },
  "variableName":"" //variableName can be other than "Raster", as defined by the author of the template
}

Example

The following service has raster function templates defined:

http://sampleserver6.arcgisonline.com/arcgis/rest/services/CharlotteLAS/ImageServer?f=pjson

The root resource will advertise supported raster function templates.

"rasterFunctionInfos": [
  {
   "name": "None",
   "description": "A No-Op Function.",
   "help": ""
  },
  {
   "name": "RFTAspectColor",
   "description": "A raster function template.",
   "help": "This raster function template contains the following processing: aspect, remap, colormap and colormap to RGB functions. The remap function remaps divide 0       to 90 evenly to 8 directions, (N,NE,E,SE,S,SW,W,NW). The colormap function used the following colormap for the 8 categories:       [[0 176 176 176], [1 255 0 0],[2 255 166 0],[3 255 255 0],[4 0 255 0],[5 0 255 255],[6 0 166 255],[7 0 0 255],[8 255 0 255]].      To overwrite the default setting, use InputRanges (double array), NoDataRanges (double array),      and OutputValues (int array) for remapping, and use Colormap to change colors."
  },
  {
   "name": "RFTShadedReliefElevationColorRamp",
   "description": "A raster function template.",
   "help": "This raster function template uses a shaded relief function. The default values of ZFactor is 1, Altitude is 45, and Azimuth is 315. An elevation colorramp is used."
  }
 ]

A client can use this function with default function arguments.

{
  "rasterFunction" : "RFTShadedReliefElevationColorRamp"
}

http://sampleserver6.arcgisonline.com/arcgis/rest/services/CharlotteLAS/ImageServer/exportImage?bbox=1440000.0,535000.0,1455000.0,550000.0&bboxSR=&size=400,400&imageSR=&format=jpgpng&pixelType=UNKNOWN&noData=&interpolation=RSP_BilinearInterpolation&mosaicRule=&renderingRule={"rasterFunction" : "RFTShadedReliefElevationColorRamp"}&f=image

A client can also provide optional parameter values.

{
"rasterFunction" : "RFTShadedReliefElevationColorRamp",
"rasterFunctionArguments":{"ZFactor":10}},
"variableName" : "Raster"
}

http://sampleserver6.arcgisonline.com/arcgis/rest/services/CharlotteLAS/ImageServer/exportImage?bbox=1440000.0,535000.0,1455000.0,550000.0&bboxSR=&size=400,400&imageSR=&format=jpgpng&pixelType=UNKNOWN&noData=&interpolation=RSP_BilinearInterpolation&mosaicRule=&renderingRule={"rasterFunction" : "RFTShadedReliefElevationColorRamp","rasterFunctionArguments":{"ZFactor":10},"variableName":"Raster"}&f=image

Turning off a default raster function template

By default, the image service exportImage operation applies the first raster function template in its rasterFunctionInfos. You can use a different rendering rule by using the renderingRule parameter, or apply no additional processing by using the following rendering rule:

{
  "rasterFunction" : "None",
}

The following service has a Stretch function template applied by default (TorontoStretch):

http://sampleserver6.arcgisonline.com/arcgis/rest/services/Toronto/ImageServer/exportImage?bbox=-8844874.0651,5401062.402699997,-8828990.0651,5420947.402699997&bboxSR=&size=400,400&imageSR=&format=jpgpng&mosaicRule=&f=image

It can be turned off by specifying None as the raster function.

http://sampleserver6.arcgisonline.com/arcgis/rest/services/Toronto/ImageServer/exportImage?bbox=-8844874.0651,5401062.402699997,-8828990.0651,5420947.402699997&bboxSR=&size=400,400&imageSR=&format=jpgpng&mosaicRule=&renderingRule={"rasterFunction":"None"}&f=image

When a single-band image service has a raster attribute table and Red, Green, Blue colors are available in the attribute table, exportImage will automatically use it to render an image service by default, for example (NLCDLandCover2001):

http://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?bbox=-2364615.0,256035.0,2266845.0,3180435.0&bboxSR=&size=&imageSR=&time=&format=jpgpng&pixelType=UNKNOWN&noData=&interpolation= RSP_BilinearInterpolation&compressionQuality=&bandIds=&mosaicRule=&renderingRule=&f=image

It can be turned off the same way:

http://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?bbox=-2364615.0,256035.0,2266845.0,3180435.0&bboxSR=&size=&imageSR=&time=&format=jpgpng&pixelType=UNKNOWN&noData=&interpolation= RSP_BilinearInterpolation&compressionQuality=&bandIds=&mosaicRule=&renderingRule={"rasterFunction":"None"}&f=image

If the first raster function template is None, it means, by default, no raster function template is used. The image service can use a default renderer if needed (for example, the previous NLCDLandCover2001 example).

Defining a raster function template on the client side

This was added at 10.2.

A client can define a raster function template by assigning a well-known raster function object as the value of a raster function argument. The argument needs to take a raster as input, for example, Raster, DEM.

{
  "rasterFunction" : "<rasterFunctionName>",
  "rasterFunctionArguments" : {
      "argument1":<value1>,
      "argument2":<value2>,     
      "argumentn":<valuen>,
      "Raster": //this is the argument that takes raster inputs, e.g. DEM for the Hillshade function
                {
                 "rasterFunction" : "<rasterFunctionName>",
                 "rasterFunctionArguments" : {
                    "argument1":<value1>,
                    "argument2":<value2>,
                    "argumentn":<valuen>
                    },
                 "outputPixelType" : "<outputPixelType>",
                 "variableName" : "<variableName>" //the inner function's variableName
                 },
    },
  "outputPixelType" : "<outputPixelType>",      
}

Example

Red and blue color mapping for a temperature image service (above or below 0° C).

{
  "rasterFunction" : "Colormap",
  "rasterFunctionArguments" : {
    "Colormap" : [
      [0, 255, 0, 0],
      [2, 0, 0, 255]
    ],
    "Raster":{
               "rasterFunction": "Remap",
               "rasterFunctionArguments": {
                  "InputRanges": [-50.0,0,    0,   50],
                  "OutputValues": [0,2],
                  "Raster":"$$"
                  },
               "outputPixelType": "U8"
             }     
  },
  "outputPixelType": "U8"
}

Using rasters in rendering rules

The variableName of a rendering rule designates which argument has a type of raster (or rasters). It's optional for the following cases:

Among the raster function arguments, there's one or more arguments that take a raster or an array of rasters as input, for example, the Raster argument for the Remap function and the DEM argument for the Hillshade function. A raster value can be the image service ("$$") -- default, an image in the image service ("$oid"), or a result from another function (a rendering rule object). The argument name value pair can be optional in the following cases, and when not provided by the user, the default is the image service ("Raster":"$$"):

The ability to reference an image in an image service or the result from another function are available. When using an individual raster in an image service as input, the raster argument needs to be part of rasterFunctionArguments. The value of this argument is a dollar-objectid notation of the raster, for example, "Raster":"$1"). When using the image service as input, you can also use "$$" to represent the image service as part of rasterFunctionArguments (for example, "Raster":"$$").

Example 1 (Stretching the first raster)

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
    "StretchType" : 3,
    "NumberOfStandardDeviations" : 2.5,
    "Statistics" : [
      [0, 255, 56.7, 54.8],
      [0, 255, 97.5, 94.5],
      [0, 255, 87.5, 87.3]
    ],
    "Gamma" : [1.25, 1.25, 1.25],
			 "Raster":"$1"
  },
 "outputPixelType": "U8"
}

Example 2 (Stretching the service)

{
  "rasterFunction" : "Stretch",
  "rasterFunctionArguments" : {
    "StretchType" : 3,
    "NumberOfStandardDeviations" : 2.5,
    "Statistics" : [
      [0, 255, 56.7, 54.8],
      [0, 255, 97.5, 94.5],
      [0, 255, 87.5, 87.3]
    ],
    "Gamma" : [1.25, 1.25, 1.25],
			 "Raster":"$$"
  },
 "outputPixelType": "U8"
}

12/1/2017