Index
Well-known functions are as follows:
- ArgStatistics | Arithmetic | Aspect
- BandArithmetic
- CCDC | Classify | Clip | Colormap | ColormapToRGB | ColorspaceConversion | Complex | CompositeBand | ComputeChange | ContrastBrightness | Convolution | CreateColorComposite | Curvature
- DetectChange
- ElevationVoidFill | ExtractBand
- Geometric | Grayscale
- Identity
- Hillshade
- Local
- Mask | MLClassify | MultidimensionalRaster | MultidimensionalFilter
- NDVI | Pansharpening | ProcessRasterCollection
- RasterCalculator | Recast | Remap | Resample
- SegmentMeanShift | ShadedRelief | Slope | Speckle | SpectralConversion | SpectralUnmixing | Statistics | StatisticsHistogram | Stretch | SurfaceParamFunction
- TasseledCap | Threshold | TransposeBits | Trend | TrendAnalysis | TrendToRGB
- UnitConversion
- VectorField | VectorFieldRenderer
- WeightedOverlay | WeightedSum
Raster function templates are as follows:
Overview
The image service includes multiple operations that support the renderingRule parameter. A rendering rule defines how the requested image will 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 the Use rasters in rendering rules section for more information on how to use raster inputs and variableName.
The image service includes a few well-known raster functions that do not need to be preconfigured with the service. These well-known functions include the following:
- ArgStatistics
- Arithmetic
- Aspect
- BandArithmetic
- Classify
- Clip
- Colormap
- ColormapToRGB
- Complex
- CompositeBand
- ContrastBrightness
- Convolution
- CreateColorComposite
- Curvature
- ElevationVoidFill
- ExtractBand
- Geometric
- Greyscale
- Identity
- Hillshade
- Local
- Mask
- MLClassify
- NDVI
- Pansharpening
- RasterCalculator
- Recast
- Remap
- Resample
- SegmentMeanShift
- ShadedRelief
- Slope
- Statistics
- StatisticsHistogram
- Stretch
- SurfaceParamFunction
- TasseledCap
- Threshold
- TransposeBits
- UnitConversion
- Vectorfield
- VectorFieldRenderer
- WeightedSum
- WeightedOverlay
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 in the Image Service topic. A client can omit rasterFunctionArguments and use 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 Perform server-side processing with 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 it can resolve these rasters in a group using a tagged attribute, for example tag or variableName. The client can get this information from rasterFunctionInfos; the grouping and tagging are done on the server side, so the client can simply invoke the template.
At 10.5.1, Hillshade supports multidirectional and traditional hillshades.
At 10.9, all raster functions that support multiple multidimensional raster inputs also support the following two multidimensional arguments:
- MatchVariable—When this argument is set to true, the raster function will only proceed if the variables in the two or more input multidimensional rasters have the same name. This is the default. When it is set to false, the input multidimensional rasters can have variables with different names.
- UnionDimension—When this argument is set to true, the raster function will only proceed if the dimensions in the two or more input multidimensional rasters have the same name. This is the default. When it is set to false, the dimensions do not have to have matching names, and the result will be the union of the dimensions. For example, if you add two multidimensional rasters that both have an ocean temperature variable named "temp", but one measure along dimension Time and one measure along dimension Depth, the result will be a multidimensional raster with both Time and Depth dimensions in which the temperature variable has been added together for each combination of dimensions.
"rasterFunction": "ArgStatistics"
Introduced at 10.3, 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. For more information, see ArgStatistics function.
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": [ //array of rasters.
<raster1>,
<raster2>,
<raster3>
],
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example
This example demonstrates how to calculate the duration between 0.15 to 1 (the number of continuous bands that meet the condition):
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"
Introduced at 10.2.1, the Arithmetic function performs an arithmetic operation between two rasters or a raster and a scalar, and vice versa. For more information, see Arithmetic function.
The arguments for the Arithmetic function are as follows:
{
"rasterFunction": "Arithmetic",
"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; 0=esriExtentFirstOf, 1=esriExtentIntersectionOf, 2=esriExtentUnionOf, 3=esriExtentLastOf
"CellsizeType": <CellsizeType>, //int; optional; default 0; 0=esriCellsizeFirstOf, 1=esriCellsizeMinOf, 2=esriCellsizeMaxOf, 3=esriCellsizeMeanOf, 4=esriCellsizeLastOf
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>", //optional
}
Example
This example demonstrates the esriRasterMinus (W) operation:
{
"rasterFunction": "Arithmetic",
"rasterFunctionArguments": {
"Raster" : "$$",
"Raster2": "100",
"Operation" : 2
}
}
"rasterFunction": "Aspect"
The Aspect function identifies the downslope direction of the maximum rate of change in value from each cell to its neighbors. 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"
Introduced at 10.1, the BandArithmetic function performs an arithmetic operation on the bands of a raster dataset. For more information, see Band Arithmetic function.
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 band indexes 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.
- Normalized Difference Vegetation Index
- NDVI =
((NIR - Red)/(NIR + Red))
- BandIndexes: "NIR Red", e.g., "4 3"
- Reference: Pinty, B. and Verstraete, M. M. 1992, "GEMI: a non-linear index to monitor global vegetation from satellites," Plant Ecology, Vol. 101, 15-20.
- NDVI =
- Soil-Adjusted Vegetation Index
- SAVI =
((NIR - Red) / (NIR + Red + L)) x (1 + L)
- where L represents amount of green vegetative cover, e.g., 0.5
- "BandIndexes": "NIR Red L", for example, "4 3 0.33"
- Reference: Huete, A. R., 1988, "A soil-adjusted vegetation index (SAVI)," Remote Sensing of Environment, Vol 25, 295-309.
- SAVI =
- Transformed Soil Adjusted Vegetation Index
- TSAVI =
(s(NIR-s*Red-a))/(a*NIR+Red-a*s+X*(1+s^2))
- where a = the soil line intercept, s = the soil line slope, X = an adjustment factor that is set to minimize soil noise
- "BandIndexes": "NIR Red s a X", e.g., "4 3 0.33 0.50 1.50"
- Reference: Baret, F. and G. Guyot, 1991, "Potentials and limits of vegetation indices for LAI and APAR assessment," Remote Sensing of Environment, Vol. 35, 161-173.
- TSAVI =
- Global Environmental Monitoring Index
- GEMI =
eta*(1-0.25*eta)-((Red-0.125)/(1-Red))
- where eta =
(2*(NIR^2-Red^2)+1.5*NIR+0.5*Red)/(NIR+Red+0.5)
- "BandIndexes":"NIR Red", e.g., "4 3"
- Reference: Pinty, B. and Verstraete, M. M. 1992, "GEMI: a non-linear index to monitor global vegetation from satellites," Plant Ecology, Vol. 101, 15-20,
- GEMI =
- Green Vegetation Index - Landsat TM
- GVITM =
-0.2848*Band1-0.2435*Band2-0.5436*Band3+0.7243*Band4+0.0840*Band5-1.1800*Band7
- "BandIndexes":"Band1 Band2 Band3 Band4 Band5 Band7", e.g., "1 2 3 4 5 6"
- Reference: Todd, S. W., R. M. Hoffer, and D. G. Milchunas, 1998, "Biomass estimation on grazed and ungrazed rangelands using spectral indices," International Journal of Remote Sensing, Vol. 19, No. 3, 427-438.
- GVITM =
- Modified Soil Adjusted Vegetation Index
- MSAVI2 =
(1/2)*(2(NIR+1)-sqrt((2*NIR+1)^2-8(NIR-Red)))
- BandIndexes: "NIR Red", e.g., "4 3"
- Reference: Qi, J. et al., 1994, "A modified soil vegetation adjusted index, " Remote Sensing of Environment, Vol. 48, No. 2, 119-126.
- MSAVI2 =
- Perpendicular Vegetation Index
- PVI =
(NIR-a*Red-b)/(sqrt(1+a^2))
- where a = slope of the soil line, b = gradient of the soil line
- BandIndexes: "NIR Red a b", e.g., "4 3 0.3 0.5"
- PVI =
- Sultan's Formula (transform to 3 band 8 bit image)
- Band 1 =
(Band5 / Band6) x 100
- Band 2 =
(Band5 / Band1) x 100
- Band 3 =
(Band3 / Band4) x (Band5 / Band4) x 100
- "BandIndexes":"Band1 Band2 Band3 Band4 Band5 Band6", e.g., "1 2 3 4 5 6"
- Band 1 =
- Visible Atmospherically Resistant Index
- VARI =
(Green - Red)/(Green + Red - Blue)
- BandIndexes: "Red Green Blue", e.g., "3 2 1"
- Reference: Anatoly A. Gitelson, Yoram J. Kaufman, Robert Stark, and Don Rundquist, 2002, "Novel algorithms for remote estimation of vegetation fraction," Remote Sensing of Environment, Vol. 80, 76-87.
- VARI =
- User Defined
- Use a single-line algebraic formula to create a single-band output. The supported operators are -, +, /, *, and unary -.
- To identify the bands, prepend the band number with a B or b. For example: "BandIndexes":"(B1 + B2) / (B3 * B5)"
Example
This example demonstrates the BandArithmetic function.
{
"rasterFunction": "BandArithmetic",
"rasterFunctionArguments": {
"Method": 0,
"BandIndexes": "(B3 - B1 / B3 + B1)",
"Raster": <raster> //optional, default is the image service
},
"variableName": "Raster"
}
"rasterFunction": "CCDC"
Introduced at 10.8.1, the CCDC function evaluates changes in pixel values over time using the Continuous Change Detection and Classification (CCDC) algorithm and generates a multidimensional raster containing the model results. For more information, see CCDC Analysis function.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the CCDC function are as follows:
{
"rasterFunction": "CCDC",
"rasterFunctionArguments": {
"Raster": <Raster>, //the input raster
"BandIDs": [
<Band1>,
<band2>,
…
],//int, optional
"TmaskBandIDs": [
<Band2>,
<Band4>,
…
], //int, optional
"ChiSquareProb": <ChiSquareProb>, //int, optional
"MinNumberAnomaly": <MinNumberAnomaly>, //int, optional
"UpdatingFrequency": <UpdatingFrequency> //int, optional
}
}
Example
This example demonstrates the CCDC function.
{
"rasterFunction": CCDC",
"rasterFunctionArguments": {
"Raster": "$$",
"BandIDs": [
1,
2
]
}
}
"rasterFunction": "Classify"
Introduced at 10.3, the Classify function classifies a segmented raster to a categorical raster. For more information, see Classify function.
License:
At 10.5, ArcGIS Server must be licensed as ArcGIS Server Advanced or ArcGIS Image Server to use this resource. For earlier versions, the hosting ArcGIS Server installation must have an ArcGIS Spatial Analyst extension license.
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.
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example
This example demonstrates how to classify a segmented image using the 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"
Introduced at 10.1, the Clip function clips a raster using a rectangular shape according to the extents defined, or clips a raster to the shape of an input polygon feature class. The shape defining the clip can include the extent of the raster or an area within the raster. For more information, see Clip function.
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
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example
This example demonstrates the Clip function.
{
"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"
Introduced at 10.6, 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. You can display raster data using a predefined ColorrampName or a customized Colorramp object. Several ArcGIS predefined color ramps are provided.
Predefined color ramp graphics and their corresponding names can be viewed from the layer's properties windowon 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.
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": {ColorRamp_json}comment //a json object that defines a range of colors,
"Raster": <raster>//optional, default is the image service
},
"outputPixelType": "<outputPixelType>",//optional
"variableName": "Raster"
}
Example 1
This example demonstrates the Colormap function.
{
"rasterFunction": "Colormap",
"rasterFunctionArguments": {
"ColormapName": "Random"
},
"variableName": "Raster"
}
Example 2
This example also demonstrates the Colormap function.
{
"rasterFunction": "Colormap",
"rasterFunctionArguments": {
"Colormap": [
[1,255,0,0],
[2,0,255,0],
[3,125,25,255]
]
},
"variableName": "Raster"
}
Example 3
This example also demonstrates the Colormap function.
{
"rasterFunction": "Colormap",
"rasterFunctionArguments": {
"ColorrampName": "Blue Bright"
},
"variableName": "Raster"
}
Example 4
This example also demonstrates the Colormap function.
{
"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"
Introduced at 10.6, the ColormapToRGB function works with single band image service that has an internal color map. It converts the image to a three-band 8-bit RGB raster. This function takes no arguments except an input raster. For a 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 the client requests to export the image to JPG or PNG format. For more information, see Colormap To RGB function.
Note:
At 10.6.1, the UnmappedAsRandomColor parameter was added with false as the default value . If this parameter is set to true and colormap doesn’t specify how a raster pixel value will be mapped into RGB values, it will assign a random RGB color to the pixel.
The arguments for the ColormapToRGB function are as follows:
{
"rasterFunction": "ColormapToRGB",
"rasterFunctionArguments": {
"Raster": <raster>, //optional, default is the image service
"UnmappedAsRandomColor": <true|false>, //new at 10.6.1, boolean, optional, default is false
}
}
"rasterFunction": " ColorspaceConversion"
Introduced at 10.6, the ColorspaceConversion function converts the color model of a three-band unsigned 8-bit image from hue, saturation, and value (HSV) to red, green, and blue (RGB) or vice versa. The ExtractBand function or Stretch function are sometimes used for converting the imagery into valid input for the ColorspaceConversion function. For more information, see Color Model Conversion function.
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
This example demonstrates how to perform an RGB to HSV color model conversion on an input raster.
{
"rasterFunction": "ColorspaceConversion",
"rasterFunctionArguments": {
"ConversionType": 0,
"raster": "$$"
}
}
"rasterFunction": "Complex"
Introduced at 10.6, the Complex function is used when the input raster has a complex pixel type. It computes magnitude from the complex value to convert the pixel type to floating point for each pixel. It takes no arguments except an optional input raster. For more information, see Complex function.
The arguments for the Complex function are as follows:
{
"rasterFunction": "Complex",
"rasterFunctionArguments": {
"Raster": <raster> //optional, default is the image service
}
}
"rasterFunction": "CompositeBand"
Introduced at 10.2.1, the CompositeBand function combines multiple images to form a multiband image. For more information, see Composite Bands function.
The arguments for the CompositeBand function are as follows:
{
"rasterFunction": "CompositeBand",
"rasterFunctionArguments": {
"Rasters": [ //array of rasters
<raster>,
<raster>,
<raster>
]
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
"rasterFunction": "ComputeChange"
Introduced at 10.8.1, the ComputeChange function computes changes between two rasters. For more information, see Compute Change function.
At 11.0, three methods for computing change between multiband rasters were added: Spectral Euclidean Distance, Spectral Angle Difference, and Band with Most Change. The difference, relative difference, and categorical methods are for computing change between single-band rasters only.
Note:
This function will only work if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the ComputeChange function are as follows:
{
"rasterFunction": "ComputeChange",
"rasterFunctionArguments": {
"Raster": <Raster>, //the input raster
"Raster2": <Raster2>, //the input raster
"Method": < Method> //int, compute change method, 0 = difference, 1 = relative difference, 2 = categorical, 3 = Spectral Euclidean Distance, 4 = Spectral Angle Difference, 5 = Band with Most Change
}
}
Example
This example demonstrates the ComputeChange function.
{
"rasterFunction": "ComputeChange",
"rasterFunctionArguments": {
"Raster": "$1",
"Raster2": "$2",
"Method": 0
}
}
"rasterFunction": "ContrastBrightness"
Introduced at 10.2.1, the ContrastBrightness function enhances the appearance of raster data (imagery) by modifying the brightness or contrast of the image. This function works on 8-bit input rasters only. For more information, see Contrast and Brightness function.
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
This example demonstrates the ContrastBrightness function.
{
"rasterFunction": "ContrastBrightness",
"rasterFunctionArguments": {
"ContrastOffset": 30,
"BrightnessOffset": 10,
"Raster": "$$"
}
}
"rasterFunction": "Convolution"
Introduced at 10.1, the Convolution function filters the pixel values in an image, which can be used for sharpening an image, blurring an image, detecting edges in an image, or other kernel-based enhancements. For more information, see Convolution function.
The arguments for the Convolution function are as follows:
{
"rasterFunction": "Convolution",
"rasterFunctionArguments": {
"Columns": <Columns>,
"Rows": <Rows>,
"Kernel": [ //an array that has m x n elements
<k11>,
<k12>,
...
]
"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
This example demonstrates the Convolution function.
{
"rasterFunction": "Convolution",
"rasterFunctionArguments": {
"Type": 11
},
"variableName": "Raster"
}
"rasterFunction": "CreateColorComposite"
Introduced at 11.0, the CreateColorComposite function creates a three-band raster from a multiband raster dataset in which each band can use an algebraic calculation based on band algebra. For more information, see Create Color Composite function.
The arguments for the CreateColorComposite function are as follows:
{ "rasterFunction":"CreateColorComposite",
"rasterFunctionArguments": { "Method":<0> or <1>, // 0 – band names, 1 – band ids;
"BandIndexesR": <band name> or <band id> or <expression using bands>, // define for R band
"BandIndexesG": <band name> or <band id> or <expression using bands>, // define for G band
"BandIndexesB": <band name> or <band id> or <expression using bands>, // define for B band
"Raster": <raster> // optional, default is the image service
}
}
Example
This example demonstrates the CreateColorComposite function.
{
"rasterFunction":"CreateColorComposite",
"rasterFunctionArguments": { "Method":1,
"BandIndexesR":"B1",
"BandIndexesG":"B2",
"BandIndexesB":"B1-B2",
"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 determine which by reviewing the curvature value. The curvature is calculated by computing the second derivative of the surface. For more information, see Curvature function.
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
This example demonstrates the Curvature function.
{
"rasterFunction": "Curvature",
"rasterFunctionArguments": {
"Type": 0,
"ZFactor": 1
}
}
"rasterFunction": "DetectChange"
Introduced at 10.8.1, the DetectChange function generates a raster layer containing pixel change information using the output change analysis raster from the Analyze Changes Using CCDC tool. For more information, see Detect Change Using Change Analysis function.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the DetectChange function are as follows:
{
"rasterFunction": "DetectChange",
"rasterFunctionArguments": {
"Raster": <Raster>, //the input raster
"ChangeType": <ChangeType>, //int, 0=time of latest change, 1=time of earliest change, 2=time of largest, 3=number of changes
"MaxNumberChanges": <MaxNumberChanges> //int
}
}
Example
This example demonstrates how to detect the time of the latest change.
{
"rasterFunction": "DetectChange",
"rasterFunctionArguments": {
"Raster": "$$",
"ChangeType": 0,
"MaxNumberChanges": 1
}
}
"rasterFunction": "ElevationVoidFill"
The ElevationVoidFill function creates pixels where holes exist in the elevation. For more information, see Elevation Void Fill function.
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
}
Note:
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 the spatial reference system.
Example
This example demonstrates the ElevationVoidFill function.
{
"rasterFunction": "ElevationVoidFill",
"rasterFunctionArguments": {
"MaxVoidWidth": 0
}
}
"rasterFunction": "ExtractBand"
Introduced at 10.2.1, the ExtractBand function allows you to extract one or more bands from a raster, or it can reorder the bands in a multiband image. For more information, see Extract Band function.
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
This example demonstrates the ExtractBand function.
{
"rasterFunction": "ExtractBand",
"rasterFunctionArguments": {
"BandIDs": [3,2,1],
"Raster": "$$"
}
}
"rasterFunction": "Geometric"
Introduced at 10.1, the Geometric function transforms the image (for example, orthorectification) based on a sensor definition and a terrain model. For more information, see Geometric function.
The arguments for the Geometric function are as follows:
{
"rasterFunction": "Geometric",
"rasterFunctionArguments": {
"GeodataTransforms": <GeodataTransform>, //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
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example
This example demonstrates the Geometric function.
{
"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"
Introduced at 10.6, the Grayscale function converts a multiband image to a single-band grayscale image. Specified weights are applied to each input band, and a normalization is applied for output. For more information, see Grayscale function.
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
This example demonstrates how to 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"
The Hillshade function produces 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
This example demonstrates the Hillshade function.
{
"rasterFunction": "Hillshade",
"rasterFunctionArguments": {
"Azimuth": 215.0,
"Altitude": 75.0,
"ZFactor": 0.3
},
"variableName": "DEM"
}
"rasterFunction": "Identity"
Introduced at 10.6, the Identity function defines the source raster as part of the default mosaicking behavior of the mosaic dataset. It is a no-op function and takes no arguments except a raster. For more information, see Identity function
The arguments for the Identity function are as follows:
{
"rasterFunction": "Identity",
"rasterFunctionArguments": {
"Raster": <raster>
}
}
"rasterFunction": "Local"
The Local function performs bitwise, conditional, logical, mathematical, and statistical operations on a pixel-by-pixel basis. The Local function works on single-band imagery or the first band of an image only, and the output is single band. For more information, see Local function. There are many operations supported by the Local function, see esriGeoAnalysisFunctionEnum Constants for more information.
License:
At 10.5, ArcGIS Server must be licensed as ArcGIS Server 11.2 Enterprise Advanced or ArcGIS Image Server to use this resource. For earlier versions, the hosting ArcGIS Server installation must have an ArcGIS Spatial Analyst extension license.
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
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>",//optional
"variableName": "Rasters"//optional
}
Example
This example demonstrates the Local function.
{
"rasterFunction": "Local",
"rasterFunctionArguments": {
"Operation": 2,
"Rasters": ["$$",100]
}
}
"rasterFunction": "Mask"
Introduced at 10.2.1, the Mask function changes the image by specifying a pixel value or a range of pixel values as no data. For more information, see Mask function.
The arguments for the Mask function are as follows:
{
"rasterFunction": "Mask",
"rasterFunctionArguments": {
"NoDataValues": [ //array of string
"band0_val",
"band1_val",
...
],
"IncludedRanges": [ //array of double
band0_lowerbound,
band0_upperbound,
band1
...
],
"NoDataInterpretation": <NoDataInterpretation>, //int 0=esriNoDataMatchAny, 1=esriNoDataMatchAll
"Raster": <raster> //optional, default is the image service
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example
This example demonstrates the Mask function.
{
"rasterFunction": "Mask",
"rasterFunctionArguments": {
"NoDataValues": ["-100"],
"IncludedRanges": [-800,100],
"NoDataInterpretation": 0
},
"variableName": "Raster"
}
"rasterFunction": "MLClassify"
Introduced at 10.2.1, the MLClassify function performs a supervised classification using the maximum likelihood classification algorithm. The hosting ArcGIS Server installation must have an ArcGIS Spatial Analyst extension license. For more information, see ML Classify functionML_Classify.
License:
At 10.5, ArcGIS Server must be licensed as ArcGIS Server 11.2 Enterprise Advanced or ArcGIS Image Server to use this resource. For earlier versions, the hosting ArcGIS Server installation must have an ArcGIS Spatial Analyst extension license.
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": "MultidimensionalRaster"
Introduced at 10.8.1, the MultidimensionalRaster function adds a multidimensional dataset, such as NetCDF, GRIB, and HDF data; a multidimensional mosaic dataset; or a multidimensional CRF to a multidimensional raster. For more information, see Multidimensional Raster function.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the MultidimensionalRaster function are as follows:
{
"rasterFunction": "MultidimensionalRaster",
"rasterFunctionArguments": {
"Variables": [ //array of string
"<variable1_name>",
"<variable2_name",
…
]
"InterpolationMethod": <int>, //optional, used when the input raster is not regular grids. 0="Nearest Neighbor", 1="Linear Tinning", 2="Natural Neighbor", and 3="Inverse Distance Weighted". Default value is 0 .
"InterpolationCellsize": <double>, //optional, used when the input raster is not regular grids. Defines the cell size of the output raster. Default value = 1
"Raster": <raster> //optional, default is the image service
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example
This example demonstrates how to add NetCDF data in a data store to a multidimensional raster.
{
"rasterFunction": "MultidimensionalRaster",
"rasterFunctionArguments": {
"Variables": [
"salinity",
"water_temp"
]
"Raster": "$$"
}
}
"rasterFunction": "MultidimensionalFilter"
Introduced at 10.8.1, the MultidimensionalFilter function filters a multidimensional raster using specified variables and dimensions. For more information, see Multidimensional Filter function.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the MultidimensionalFilter function are as follows:
{
"rasterFunction": "MultidimensionalFilter",
"rasterFunctionArguments": {
"Filter": <filter_json>, //a json object that defines the filter definition.
"Raster": <raster> //optional, default is the image service
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example 1
This example demonstrates how to filter a raster using two variables, salinity and surf_el, with all slices.
{
"rasterFunction": "MultidimensionalFilter",
"rasterFunctionArguments": {
"Filter": {
"variables": [
"salinity",
"surf_el"
],
"definitionType": "ALL"
},
"Raster": "$$"
}
}
Example 2
This example demonstrates how to filter a raster using two variables, salinity and surf_el, with slices having StdTime as "2013-05-17T00:00:00" and "2013-05-17T15:00:00".
{
"rasterFunction": "MultidimensionalFilter",
"rasterFunctionArguments": {
"Filter": {
"variables": [
"salinity",
"surf_el"
],
"definitionType": "BY_VALUES",
"dimensions": [
"StdTime",
"StdTime"
],
"values": [
"2013-05-17T00:00:00",
"2013-05-17T15:00:00"
]
},
"Raster": "$$"
}
}
Example 3
This example demonstrates how to filter a raster using two variables, salinity and surf_el, with slices having StdTime in the [ "2013-05-17T00:00:00", "2013-05-17T12:00:00"] range and StdZ in the [-40, 0] range.
{
"rasterFunction": "MultidimensionalFilter",
"rasterFunctionArguments": {
"Filter": {
"variables": [
"salinity",
"surf_el"
],
"definitionType": "BY_RANGES",
"dimensions": [
"StdTime",
"StdZ"
],
"minValues": [
"2013-05-17T03:00:00",
"-40"
],
"maxValues": [
"2013-05-17T12:00:00",
"0"
]
},
"Raster": "$$"
}
}
Example 4
This example demonstrates how to filter a raster using two variables, salinity and surf_el, with slices having StdTime and stepping from "2013-05-17T03:00:00" to "2013-05-18T18:00:00" every three hours.
{
"rasterFunction": "MultidimensionalFilter",
"rasterFunctionArguments": {
"Filter": {
"variables": [
"salinity",
"surf_el"
],
"definitionType": "BY_ITERATION",
"dimension": "StdTime",
"startValue": "2013-05-17T03:00:00",
"endValue": "2013-05-18T18:00:00",
"stepValue": 3,
"units": "HOURS"
},
"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 uses 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. The NDVI function detects relative biomass (greenness) in a raster image. For more information, see NDVI function.
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.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
This example demonstrates the NDVI function.
{
"rasterFunction": "NDVI",
"rasterFunctionArguments": {
"VisibleBandID": 2,
"InfraredBandID": 1
},
"variableName": "Raster"
}
"rasterFunction": "Pansharpening"
Introduced at 10.6, the Pansharpening function uses a higher-resolution panchromatic raster to fuse with a lower-resolution multiband raster. It can generate a colorized multispectral image with higher resolution. For more information, see Pan-sharpening function.
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.
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
}
}
Example
This example demonstrates the Pansharpening function using Landsat 8 data with the Gram-Schmidt method. The image service is published from the Landsat 8 mosaic dataset "$oid"="$band_number".
{
"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": "ProcessRasterCollection"
Introduced at 10.8.1, the ProcessRasterCollection function processes each slice in a multidimensional raster or each item in a mosaic raster using different functions. This function can also aggregate multiple slices into a single slice. For more information including supported operators, see Process Raster Collection function.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the ProcessRasterCollection function are as follows:
{
"rasterFunction": "ProcessRasterCollection",
"rasterFunctionArguments": {
"ItemFunction": <function_template_file>, // optional, the path to a function template file (.rft.xml) to process each slice or each item in the raster
"AggregationFunction": <function_template_file>, // optional, the path to a function template file (.rft.xml) to aggregate multiple slices into a single slice
"ProcessingFunction": <function_template_file>, // optional, the path to a function template file (.rft.xml) to process the raster , e.g., add a colormap to render
"AggregationDefinition": <json>, // optional, used when AggregationFunction is specified.
"Raster": <raster>
}
}
Example 1
This example demonstrates how to calculate the NDVI for each item in the mosaic dataset.
{
"rasterFunction": "ProcessRasterCollection",
"rasterFunctionArguments": {
"ItemFunction": "/fileShares/rft/NDVI.rft.xml",
"Raster": "$$"
}
}
Example 2
This example demonstrates how to calculate the maximum temperature across all time slices.
{
"rasterFunction": "ProcessRasterCollection",
"rasterFunctionArguments": {
"AggregationFunction": "/fileShares/rft/CellStatisticsMax.rft.xml",
"AggregationDefinition": {"definitionType":"ALL","dimension":"StdTime"},
"Raster": "$$"
}
}
Example 3
This example demonstrates how to calculate the maximum temperature per year.
{
"rasterFunction": "ProcessRasterCollection",
"rasterFunctionArguments": {
"AggregationFunction": "/fileShares/rft/CellStatisticsMax.rft.xml",
"AggregationDefinition": {
"definitionType": "INTERVAL_KEYWORD",
"dimension": "StdTime",
"intervalKeyword": "YEARLY"
},
"Raster": "$$"
}
}
Example 4
This example demonstrates how to calculate the maximum temperature within the [2001-01-01T00:00:00, 2008-01-01T00:00:00] range.
{
"rasterFunction": "ProcessRasterCollection",
"rasterFunctionArguments": {
"AggregationFunction": "/fileShares/rft/CellStatisticsMax.rft.xml",
"AggregationDefinition": {
"definitionType": "INTERVAL_RANGES",
"dimension": "StdTime",
"minValues": ["2001-01-01T00:00:00"],
"maxValues": ["2008-01-01T00:00:00"]
},
"Raster": "$$"
}
}
Example 5
This example demonstrates how to calculate the maximum temperature every five days.
{
"rasterFunction": "ProcessRasterCollection",
"rasterFunctionArguments": {
"AggregationFunction": "/fileShares/rft/CellStatisticsMax.rft.xml",
"AggregationDefinition": {
"definitionType": "INTERVAL_VALUE",
"dimension": "StdTime",
"intervalValue": 5,
"intervalUnits": "DAYS"
},
"Raster": "$$"
}
}
Example 6
This example demonstrates how to calculate the NDVI for each scene, return the maximum NDVI value across different items, and apply an NDVI color map.
{
"rasterFunction": "ProcessRasterCollection",
"rasterFunctionArguments": {
"ItemFunction": "/fileShares/rft/NDVI.rft.xml",
"AggregationFunction": "/fileShares/rft/CellStatisticsMax.rft.xml",
"AggregationDefinition": {
"definitionType": "ALL",
"dimension": "StdTime"
},
"ProcessingFunction": "/fileShares/rft/Colormap.rft.xml",
"Raster": "$$"
}
}
"rasterFunction": "RasterCalculator"
Introduced at 10.6, the RasterCalculator function provides access to all existing math functions so you can make calls to them when building expressions. The RasterCalculator function requires single-band inputs. To perform expressions on bands in a multispectral image as part of a function chain, you can use the ExtractBandfunction before the RasterCalculator function. For more information including supported operators, see Calculator function.
The arguments for the RasterCalculator function are as follows:
{
"rasterFunction": "RasterCalculator",
"rasterFunctionArguments": {
"InputNames": [ //array of strings for arbitrary raster names
"raster1_Name",
"raster2_Name",
"raster3_Name",
…
],
"Expression": "raster1_Name + raster2_Name - raster3_Name", //string, expression to calculate output raster from input rasters
"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
"Rasters": [ //array of rasters
<raster1>,
<raster2>,
<raster3>,
…
],
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example
This example demonstrates adding 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. For more information, see Recast function.
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 1
This example demonstrates how to view the high vegetation and buildings class of a particular LAS in a mosaic.
The following LAS ClassTypes options can be used in REST API with the Recast function:
- 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
{
"mosaicMethod": "esriMosaicLockRaster",
"lockRasterIds": [1],
"ascending": true,
"mosaicOperation": "MT_FIRST",
"itemRenderingRule": {
"rasterFunction": "Recast",
"rasterFunctionArguments": {
"ClassTypes": [5,6]
}
}
}
Example 2
This example demonstrates how to change the z-factor of an existing hillshade function on the first raster in the service.
{
"rasterFunction": "Recast",
"rasterFunctionArguments": {
"ZFactor": 3.5,
"Raster": "$1"
}
}
"rasterFunction": "Remap"
Introduced at 10.1, the Remap function changes or reclassifies the pixel values of the raster data. For more information, see Remap function.
The arguments for the Remap function are as follows:
{
"rasterFunction": "Remap",
"rasterFunctionArguments": {
"InputRanges": [ //[double, double,…], input ranges are specified in pairs: from (inclusive) and to (exclusive).
<value1_from>,
<value1_to>,
…
],
"OutputValues": [ //[double, …], output values of corresponding input ranges
<value1>,
…
],
"GeometryType": <geometryType>, //added at 10.3
"Geometries": [ //added at 10.3
<geometry1>,
<geometry2>,
...
],
"NoDataRanges": [ //[double, double, …], nodata ranges are specified in pairs: from (inclusive) and to (exclusive).
<nodatavalue1_from>,
<nodatavalue1_to>,
…
],
"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 1
This example demonstrates how to remap pixel values.
{
"rasterFunction": "Remap",
"rasterFunctionArguments": {
"InputRanges": [
0,
100,
101,
200
],
"OutputValues": [
5,
125
]
},
"variableName": "Raster"
}
Example 2
This example demonstrates how to use the Remap function with geometry values
{
"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. For more information, see Resample function.
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.
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"
}
Note:
InputCellsize only supports source spatial reference.
Example
This example demonstrates how to 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 must be a three-band 8-bit image. If the image service is not a three-band 8-bit unsigned image, you can use the Stretch function before the SegmentMeanShift function. For more information, see Segment Mean Shift function.
License:
At 10.5, ArcGIS Server must be licensed as ArcGIS Server 11.2 Enterprise Advanced or ArcGIS Image Server to use this resource. For earlier versions, the hosting ArcGIS Server installation must have an ArcGIS Spatial Analyst extension 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": <MaxValue>, //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
}
Note:
When specifying arguments for SegmentMeanShift, use either SpectralDetail,SpatialDetail as a pair or SpectralRadius, SpatialRadius. They have an inverse relationship (SpectralRadius = 21 - SpectralDetail, SpatialRadius = 21 - SpectralRadius).
Example
This example demonstrates how to segment an image.
{
"rasterFunction": "SegmentMeanShift",
"rasterFunctionArguments": {
"SpectralDetail": 15.5,
"SpatialDetail": 15,
"MinNumPixelsPerSegment": 20,
"Raster": "$$"
}
}
"rasterFunction": "ShadedRelief"
The ShadedRelief function creates a color 3D model of the terrain by merging the images from the elevation-coded and hillshade methods. For more information, see Shaded Relief function. You can specify a colormap or colorramp value to render the shaded relief results. For more predefined color ramps, see the colorrampname parameter in the colormap raster function.
The arguments for the ShadedRelief function are as follows:
{
"rasterFunction": "ShadedRelief",
"rasterFunctionArguments": {
"HillshadeType": <HillshadeType>, //new at 10.8.1. 0=Traditional, 1=Multidirectional. Default is 0.
"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>]
],
"Colorramp": "<Black To White | Yellow To Red | Slope | more…>"
"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
This example demonstrates the ShadedRelief function.
{
"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>
},
"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
This example demonstrates the Slope function.
{
"rasterFunction": "Slope",
"rasterFunctionArguments": {
"ZFactor": 0.3
}
}
"rasterFunction": "Speckle"
Introduced at 10.6, 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 Speckle function.
The arguments for the Speckle function are as follows:
{
"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
This example demonstrates how to despeckle a radar image service with the Lee filter
{
"rasterFunction": "Speckle",
"rasterFunctionArguments": {
"FilterType": 0,
"FilterSize": 4,
"NoiseModel": 0,
"MultiplicativeNoiseMean": 1,
"NLooks": 1,
"Raster": "$$"
}
}
"rasterFunction": "SpectralConversion"
Introduced at 10.6, the SpectralConversion function applies a matrix to a multiband 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 output band. The column and row size of the matrix equals the band count of the input raster. For more information, see Spectral Conversion function.
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
This example demonstrates how to 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": "$$"
}
}
The following shows how numbers in the 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": "SpectralUnmixing"
Introduced at 10.8.1, the SpectralUnmixing function classifies subpixels and calculates the fractional abundance of land-cover types for individual pixels. For more information including supported operators, see Linear Spectral Unmixing function.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the SpectralUnmixing function are as follows:
{
"rasterFunction": "SpectralUnmixing",
"rasterFunctionArguments": {
"SpectralProfileType": <int>, //0=using Spectral profile file, value, 1=using training feature
"SpectralProfileFile": <string>, //the path to a ECD file or a JSON file. Optional, used when SpectralProfileType is 0.
"TrainingFeature": <string>, //the path to a training feature dataset. used when SpectralProfileType is 1.
"SpectralProfileDefinition": <json>, //a json object that defines the spectral profile parameters.
"NonNegative": <bool>, //constrains the outputs to be non-negative. Default: False
"SumToOne": <bool>, //constrains the outputs to sum to one. Default: False
"Raster": <raster> //optional, default is the image service
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example
This example demonstrates how to use the SpectralUnmixing function with the SpectralProfile definition for linear spectral unmixing.
{
"rasterFunction": "SpectralUnmixing",
"rasterFunctionArguments": {
"NonNegative": true,
"SumToOne": true,
"Raster": "$$",
"SpectralProfileDefinition": {
"EsriClassifierDefinitionFile": 0,
"FileVersion": 3,
"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,
110.11684
]
]
}
]
}
]
}
}
}
"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
This example demonstrates the Statistics function.
{
"rasterFunction": "Statistics",
"rasterFunctionArguments": {
"Type": "Mean",
"KernelColumns": 3,
"KernelRows": 3
},
"variableName": "Raster"
}
"rasterFunction": "StatisticsHistogram"
Introduced at 10.6, the StatisticsHistogram function defines the statistics and histogram of a raster. It is typically used to control the default display of an exported image. For more information, see Statistics and Histogram function.
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
This example demonstrates how to customize the statistics and histograms for an 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, the output minimum value that will be stretched to.
"Max": <max>, //double, the output maximum value that will be stretched to.
"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"
}
The Gamma stretch works with all stretch types. The Gamma parameter is needed when UseGamma is set to true. Min and Max can be used to define minimum and maximum output . DRA is used to get statistics from the extent in the exportImage request. ComputeGamma automatically calculates the best gamma value to render an exported image based on the empirical model. Stretch type values and their requirements are as follows:
- 0 (None)—Does not require other parameters.
- 3 (StandardDeviation)—Requires NumberOfStandardDeviations, Statistics, or DRA as true.
- 4 (Histogram Equalization)—Requires the source dataset to have histograms or additional DRA as true.
- 5 (MinMax)—Requires Statistics or DRA as true.
- 6 (PercentClip)—Requires MinPercent, MaxPercent, and DRA as true, or histograms from the source dataset.
- 9 (sigmoid)—Does not require other parameters. Optionally, set SigmoidStrengthLevel (1 to 6) to adjust the curvature of the Sigmoid curve used in color stretch.
Example 1 (StandardDeviation)
This example demonstrates the Stretch function using 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]
],
"Min": 100,
"Max": 255,
"UseGamma": true,
"Gamma": [1.25, 1.25, 1.25]
},
"outputPixelType": "U8",
"variableName": "Raster"
}
Example 2 (MinMax)
This example demonstrates the Stretch function using 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)
This example demonstrates the Stretch function using 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)
This example demonstrates the Stretch function using no stretch type.
{
"rasterFunction": "Stretch",
"rasterFunctionArguments": {
"StretchType": 0
},
"variableName": "Raster"
}
Example 5 (HistogramEqualization)
This example demonstrates the Stretch function using HistogramEqualization.
{
"rasterFunction": "Stretch",
"rasterFunctionArguments": {
"StretchType": 4
},
"outputPixelType": "U8",
"variableName": "Raster"
}
Example 6 (Sigmoid)
This example demonstrates the Stretch function using Sigmoid.
{
"rasterFunction": "Stretch",
"rasterFunctionArguments": {
"StretchType": 9,
"SigmoidStrengthLevel": 1
},
"outputPixelType": "U8",
"variableName": "Raster"
}
"rasterFunction": "SurfaceParamFunction"
Introduced at 11.1, the SurfaceParamFunction function determines parameters of a raster surface such as aspect, slope, and several types of curvatures using geodesic methods. For more information, see How Surface Parameters works in the Spatial Analyst tool help.
The arguments for the SurfaceParamFunction function are as follows:
{
"rasterFunction": "SurfaceParamFunction",
"rasterFunctionArguments": {
"SurfaceCalculation": <int> //Optional, 1=Mean curvature, 2=Profile curvature, 3=Tangential curvature, 4=Slope, 5=Aspect, 6=Plan curvature, 7=Contour geodesic torsion, 8=Gaussian curvature, 9=Casorati curvature. Default is 4.
"LocalSurface": <int>, //Optional, 1=Quadratic, 2=Biquadratic. Default is 1.
"AnalysisScaleWithUnits": <string >, //Optional. The output will be calculated over this distance from the target cell. Minimum value is the input raster cell size. Default is the input raster cell size and units.
"UseAdaptiveScale": <boolean>, //Optional. Default is false.
"ZUnit": <string> //Optional. Default is Meters. Options are: Centimeters, Decimal degrees, Decimeters, Feet, Inches, Kilometers, Meters, Miles, Millimeters, Nautical Miles, Points, Unknown and Yards.
"SlopeType": <int> //Optional, only applicable when SurfaceCalculation=4. 1=Degree, 2=Percent Rise
"ProjectAzimuths": <boolean> // Optional, only applicable when SurfaceCalculation=5. Default is false.
"UseEquatorialAspect": <boolean> //Optional, only applicable when SurfaceCalculation=5.
“Raster”: <raster>
},
}
Example
This example demonstrates how to use SurfaceParamFunction to calculate aspect using a window whose size will adapt to the terrain described in the input raster.
{
"rasterFunction": "SurfaceParamFunction",
"rasterFunctionArguments": {
"SurfaceCalculation":5,
"AnalysisScaleWithUnits": "1 Meters",
"UseAdaptiveScale":true,
"Raster": "$$"
},
}
"rasterFunction": "TasseledCap"
Introduced at 10.6, the TasseledCap function analyzes and maps 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 an 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. Before applying this function, confirm that there are no functions in the function chain that would alter the pixel values, such as the Stretch, Apparent Reflectance, or Pansharpening functions. The only exception is when using Landsat ETM+: the Apparent Reflectance function must precede the TasseledCapfunction. For more information, see Tasseled Cap function.
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 the input image is assumed to have a bimodal histogram. For more information, see Binary Thresholding function.
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
This example demonstrates the 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. For more information, see Transpose Bits function.
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 is assumed there is an input FillRaster value. If an input FillRaster value is not provided, ConstantFillCheck reverts to true and checks for a ConstantFillValue value. Filling is used to initialize pixel values of the output raster.
Landsat 8 has a quality assessment band. The following are example input and output bit positions to extract confidence levels by mapping them to 0-3:
- Landsat 8 Water: {"InputBitPositions":[4,5],"OutputBitPositions":[0,1]}
- Landsat 8 Cloud Shadow: {"InputBitPositions":[6,7],"OutputBitPositions":[0,1]}
- Landsat 8 Vegetation: {"InputBitPositions":[8,9],"OutputBitPositions":[0,1]}
- Landsat 8 Snow/Ice: {"InputBitPositions":[10,11],"OutputBitPositions":[0,1]}
- Landsat 8 Cirrus: {"InputBitPositions":[12,13],"OutputBitPositions":[0,1]}
- Landsat 8 Cloud: {"InputBitPositions":[14,15],"OutputBitPositions":[0,1]}
- Landsat 8 Designated Fill: {"InputBitPositions":[0],"OutputBitPositions":[0]}
- Landsat 8 Dropped Frame: {"InputBitPositions":[1],"OutputBitPositions":[0]}
- Landsat 8 Terrain Occlusion: {"InputBitPositions":[2],"OutputBitPositions":[0]}
Example 1
This example demonstrates how to extract Landsat 8 Snow/Ice confidence levels.
{
"rasterFunction": "TransposeBits",
"rasterFunctionArguments": {
"InputBitPositions": [10,11],
"OutputBitPositions": [0,1],
"ConstantFillValue": 0,
"Raster": "$$",
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "U8",
}
Example 2
This example demonstrates how to 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": "Trend"
Introduced at 10.8.1, the Trend function computes a forecasted multidimensional raster layer using the output trend raster from the Generate Trend function or Generate Trend Raster geoprocessing tool.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the Trend function are as follows:
{
"rasterFunction": "Trend",
"rasterFunctionArguments": {
"DimensionDefinitionType": <int>, // 0 means by value, 1 means by interval
"DimensionValues": <string>, // optional. used when DimensionDefinitionType is 0. Multiple dimension values are separated by semicolon, e.g., "0;-2" or "1990-01-01T00:00:00;1990-01-02T00:00:00"
"DimensionStart": <string>, //optional. used when DimensionDefinitionType is 1. Defines the start of the dimension interval, e.g., "-10" or "1990-01-01T00:00:00"
"DimensionEnd": <string>, //optional. used when DimensionDefinitionType is 1. Defines the end of the dimension interval, e.g., "0" or "1991-01-01T00:00:00"
"DimensionInterval": <int>, //optional. used when DimensionDefinitionType is 1. Defines the step of each interval
"DimensionUnit": <string>, //optional. Used when DimensionDefinitionType is 1 and the dimension along which the trend is calculated is time related. Its value is one of the following: "YEARS", "MONTHS", "WEEKS", "DAYS", "HOURS".
"Raster": <raster> //optional, default is the image service
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example 1
This example demonstrates how to predict the values at DimensionValues 0, -2, and -4.
{
"rasterFunction": "Trend",
"rasterFunctionArguments": {
"DimensionDefinitionType": 0,
"DimensionValues": "0;-2;-4",
"Raster": "$$"
}
}
Example 2
This example demonstrates how to predict the values on the first day of each month in 1990.
{
"rasterFunction": "Trend",
"rasterFunctionArguments": {
"DimensionDefinitionType": 1,
"DimensionStart": "1990-01-01T00:00:00",
"DimensionEnd": "1990-12-31T00:00:00",
"DimensionInterval": 1,
"DimensionUnit": "MONTHS",
"Raster": "$$"
}
}
"rasterFunction": "TrendAnalysis"
Introduced at 10.8.1, the TrendAnalysis function estimates the trend for each pixel along a dimension for one or more variables in a multidimensional raster.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the TrendAnalysis function are as follows:
{
"rasterFunction": "TrendAnalysis",
"rasterFunctionArguments": {
"DimensionName": <string>, //the name of the dimension, along which the trend analysis is performed. e.g., "StdTime", "StdZ", etc.
"RegressionType": <int>, //0=Linear (Default), 1=Harmonic, 2=Polynomial
"Frequency": <int>, //optional. Used when RegressionType = 1 (Harmonic). Default value of Frequency is 1, means that the seasonal pattern repeats once per year
"Order": <int>, //optional. Used when RegressionType = 2 (Polynomial). Default value of Order is 2, means 2nd order polynomial regression
"IgnoreNoData": <bool>, //optional. Default value is True, which means only cells that are not noData value will be used in fitting the trend curve
"Raster": <raster> //optional, default is the image service
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Raster"
}
Example1 (Linear Trend)
This example demonstrates the TrendAnalysis function using linear trend.
{
"rasterFunction": "TrendAnalysis",
"rasterFunctionArguments": {
"DimensionName": "StdTime",
"RegressionType": 0,
"Raster": "$$"
}
}
Example 2 (Harmonic Trend)
This example demonstrates the TrendAnalysis function using harmonic trend.
{
"rasterFunction": "TrendAnalysis",
"rasterFunctionArguments": {
"DimensionName": "StdTime",
"RegressionType": 1,
"Frequency": 2,
"Raster": "$$"
}
}
Example 3 (Polynomial Trend)
This example demonstrates the TrendAnalysis function using polynomial trend.
{
"rasterFunction": "TrendAnalysis",
"rasterFunctionArguments": {
"DimensionName": "StdZ",
"RegressionType": 2,
"Order": 3,
"Raster": "$$"
}
}
"rasterFunction": "TrendToRGB"
Introduced at 10.8.1, the TrendToRGB function converts a trend raster to a three-band (red, green, and blue) raster. For more information, see Trend to RGB function.
Note:
This function only works if the service provider is arcobjects11 or arcobjectsrasterrendering.
The arguments for the TrendToRGB function are as follows:
{
"rasterFunction": "TrendToRGB",
"rasterFunctionArguments": {
"Raster": <Raster>, //the input raster
"ModelType": <ModelType> //int, 0 = linear,1 = harmonic
}
}
Example
This example demonstrates how to convert the linear trend information using the TrendToRGB function.
{
"rasterFunction": "TrendToRGB",
"rasterFunctionArguments": {
"Raster": "$$",
"ModelType": 0
}
}
"rasterFunction": "UnitConversion"
The UnitConversion function performs unit conversions. For more information, see Unit Conversion function.
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:
- Speed units—100=esriMetersPerSecond, 101=esriKilometersPerHour, 102 =esriKnots, 103 =esriFeetPerSecond, 104=esriMilesPerHour
- Temperature units—200=esriCelsius,201=esriFahrenheit,202=esriKelvin
- Distance units—1=esriInches, 2=esriPoints, 3=esriFeet,4=esriYards,5=esriMiles, 6=esriNauticalMiles,7=esriMillimeters,8=esriCentimeters,9=esriMeters,10=esriKilometers,11=esriDecimalDegrees,12=esriDecimeters
Example
This example demonstrates how to convert pixel values from feet to meters.
{
"rasterFunction": "UnitConversion",
"rasterFunctionArguments": {
"FromUnit": 3,
"ToUnit": 9,
"Raster": "$$"
},
"outputPixelType": "U8",
}
"rasterFunction": "VectorField"
Introduced at 10.6, the VectorField function composites and converts 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). The data combination type (U-V or Magnitude-Direction) can also be converted interchangeably with this function. For more information, see Vector Field function.
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”
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
}
}
Example
This example demonstrates how to perform a vector field data composite and 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"
Introduced at 10.6, the VectorFieldRenderer function symbolizes a U-V or Magnitude-Direction raster.
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>" //"Vector Average", "Nearest neighbor", "Bilinear", "Cubic", "Minimum", "Maximum" |
"SymbologyName": "<SymbologyName>", //"Simple Scalar", "Single Arrow", "Wind Barb", "Beaufort Wind (Knots)", "Beaufort Wind (MetersPerSecond)", "Ocean Current (Knots)", "Ocean Current (MetersPerSecond)." |
"MinimumMagnitude": <MinimumMagnitude>,
"MaximumMagnitude": <MaximumMagnitude>,
"MinimumSymbolSize": <MinimumSymbolSize>,
"MaximumSymbolSize": <MaximumSymbolSize>
},
"variableName": "Raster"
}
Example
This example demonstrates the VectorFieldRenderer function.
{
"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 overlays several rasters using a common measurement scale and weight each according to its importance. For more information, see Weighted Overlay function.
License:
At 10.5, ArcGIS Server must be licensed as ArcGIS Server 11.2 Enterprise Advanced or ArcGIS Image Server to use this resource. For earlier versions, the hosting ArcGIS Server installation must have an ArcGIS Spatial Analyst extension license.
The arguments for the WeightedOverlay function at 10.5.1 and later 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
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Rasters" //optional
}
Example
This example demonstrates the WeightedOverlay function.
{
"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 overlays several rasters, multiplies each by their given weight, and adds them together. For more information, see Weighted Sum function.
License:
At 10.5, ArcGIS Server must be licensed as ArcGIS Server 11.2 Enterprise Advanced or ArcGIS Image Server to use this resource. For earlier versions, the hosting ArcGIS Server installation must have an ArcGIS Spatial Analyst extension license.
The arguments for the WeightedSum function at 10.5.1 and later are as follows:
{
"rasterFunction": "WeightedSum",
"rasterFunctionArguments": {
"Rasters": [<raster1>,<raster2>,...], //array of rasters.
"Fields": ["<field1>","<field2>",...], //[string, string, ...]
"Weights": [<weight1>,<weight2>,...], //[double, double, ...]
"MatchVariable": <true|false>, //new at 10.9, boolean, optional, default is true
"UnionDimension": <true|false> //new at 10.9, boolean, optional, default is true
},
"outputPixelType": "<outputPixelType>", //optional
"variableName": "Rasters" //optional
}
Example 1
This example demonstrates the WeightedSum function.
{
"rasterFunction": "WeightedSum",
"rasterFunctionArguments": {
"Rasters": ["$$","$$","$$"],
"Fields": ["Value","Value","Value"],
"Weights": [0.25,0.25,0.5]
}
}
Example 2
This example also demonstrates the WeightedSum function.
{
"rasterFunction": "WeightedSum",
"rasterFunctionArguments": {
"Rasters": ["$$","$$","$$"],
"Fields": ["Value","Value","Value"],
"Weights": [0.25,0.25,0.5],
"MatchVariable": false,
"UnionDimension": true
}
}
Use 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 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 processing with raster functions.
{
"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:
https://sampleserver6.arcgisonline.com/arcgis/rest/services/CharlotteLAS/ImageServer?f=pjson
The root resource shows the 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 color map 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"
}
https://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"
}
https://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
Turn off a default raster function template
By default, the image service exportImage operation applies the first raster function template in rasterFunctionInfos. You can change the rendering rule using the renderingRule parameter, or apply no additional processing using the following rendering rule:
{
"rasterFunction": "None",
}
The following service has a Stretch function template applied by default (TorontoStretch):
It can be turned off by specifying None as the raster function.
When a single-band image service has a raster attribute table and RGB colors are available in the attribute table, exportImage automatically uses it to render an image service by default, for example (NLCDLandCover2001):
It can be turned off the same way:
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).
Define 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 must 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
This example demonstrates 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"
}
Use rasters in rendering rules
The variableName value of a rendering rule designates which argument has a type of raster or rasters. It's optional for the following cases:
- Well-known functions—The image service can find them based on the raster function name.
- Service-defined raster function templates that use Raster or Rasters as the variableName.
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, the default is the image service ("Raster":"$$"):
- Well-known functions—Functions that use Raster or DEM as the argument name.
- Service-defined raster function templates if the argument name is Raster; otherwise, it must be provided.
You can reference an image in an image service or the result from another function. When using an individual raster in an image service as input, the raster argument must 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 (stretch the first raster)
This example demonstrates 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 (stretch the service)
This example demonstrates 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"
}