rasterFunctionUtils

AMD: require(["esri/layers/support/rasterFunctionUtils"], (rasterFunctionUtils) => { /* code goes here */ });
ESM: import * as rasterFunctionUtils from "@arcgis/core/layers/support/rasterFunctionUtils.js";
Object: esri/layers/support/rasterFunctionUtils
Since: ArcGIS Maps SDK for JavaScript 4.28
beta

Various utility functions that create RasterFunction for imagery processing. Utility methods in this module makes the raster function generations easier when applying raster functions to ImageryLayer and ImageryTileLayer.

Property Overview

Name Type Summary Object
"$$"

A token representing the image service raster.

more details
rasterFunctionUtils

Property Details

defaultRaster "$$"readonly

A token representing the image service raster.

Method Overview

Name Return Type Summary Object
RasterFunction

Creates a raster function that calculates the absolute value of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the inverse cosine of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the inverse hyperbolic cosine of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the inverse sine of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the inverse hyperbolic sine of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Aspect function to identify the downslope direction of the maximum rate of change in value from each cell to its neighbors.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the inverse tangent of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the inverse tangent (based on x,y) of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the inverse hyperbolic tangent of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate BAI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate CIg.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate CIre.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate ClayMinerals.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate EVI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate FerrousMinerals.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate GEMI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate GNDVI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate GVITM.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate IronOxide.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate MNDWI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate MSAVI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate MTVI2.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate RTVICore.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate NBR.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate NDBI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate NDMI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate NDSI.

more details
rasterFunctionUtils
RasterFunction

Creates a custom Band Arithmetic function.

more details
rasterFunctionUtils
RasterFunction

Creates a NDVI function.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate NDVIre.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate NDWI.

more details
rasterFunctionUtils
RasterFunction

CCreates a Band Arithmetic function to calculate PVI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate SAVI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate SR.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate SRre.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate Sultan index.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate TSAVI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate VARI.

more details
rasterFunctionUtils
RasterFunction

Creates a Band Arithmetic function to calculate WNDWI.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Bitwise And operation on the binary values of two input rasters.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Bitwise Left Shift operation on the binary values of two input rasters.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Bitwise Not (complement) operation on the binary value of an input raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Bitwise Or operation on the binary values of two input rasters.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Bitwise Right Shift operation on the binary values of two input rasters.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Bitwise Xor operation on the binary values of two input rasters.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Boolean And operation on the pixel values of two input rasters See Boolean And function.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Boolean Not (complement) operation on the pixel values of the input raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Boolean Or operation on the pixel values of two input rasters See Boolean Or function.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a Boolean Xor operation on the pixel values of two input rasters See Boolean Xor function.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates a statistic from multiple rasters, on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a Colormap function to define a colormap for a raster by specifying a corresponding color for each pixel value.

more details
rasterFunctionUtils
RasterFunction

Creates a Composite Bands function to combine multiple inputs into one multiband raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that sets the truthy pixels (value is not 0) to the pixel value from a true raster, and falsy pixels (value is 0) to the pixel value of the false raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Contrast And Brightness function that enhances the appearance of raster data by modifying the brightness and contrast within the image.

more details
rasterFunctionUtils
RasterFunction

Creates a Convolution function that performs filtering using the given kernel to enhance the image, e.g.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the cosine of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the hyperbolic cosine of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Curvature function that calculates the shape or curvature of the slope.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that divides the values of two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs an equal-to operation on two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the base e exponential of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the base 2 exponential of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the base 10 exponential of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates an Extract Band function to extract one or more bands from a multiband raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that converts each pixel value of a raster into a floating-point representation.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a relational greater-than operation on two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a relational greater-than-or-equal-to operation on two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that converts each pixel value of a raster to an integer by truncation.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that determines which values from the input raster are NoData on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a relational less-than operation on two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a relational less-than-or-equal-to operation on two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the natural logarithm (base e) of each pixel in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the base 2 logarithm of each pixel in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the base 10 logarithm of each pixel in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Mask function to specify one or more NoData values, or a range of valid pixel values, to be removed from an output raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that subtracts the value of the second input raster from the value of the first input raster on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that finds the remainder (modulo) of the first raster when divided by the second raster on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that finds the changes the sign (multiplies by -1) of the pixel values of the input raster on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that performs a relational not-equal-to operation on two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that adds (sums) the values of two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that raises the pixel values in a raster to the power of the values found in another raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Remap function to change or reclassify the pixel values of the raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that returns the next lower integer, as a floating-point value, for each pixel in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that returns the next higher integer, as a floating-point value, for each pixel in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that sets the truthy pixels (value is not 0) to NoData, and falsy pixels (value is 0) to the pixel value of the false raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the sine of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the hyperbolic sine of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Slope function that calculates the rate of change of elevation for each digital elevation model (DEM) cell.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the square root of the pixel values in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the square of the pixel values in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Statistics function that calculates focal statistics for each pixel of an image based on a defined focal neighborhood.

more details
rasterFunctionUtils
RasterFunction

Creates a Statistics And Histogram function to define the statistics and histogram of a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a Stretch function using min-max stretch type.

more details
rasterFunctionUtils
RasterFunction

Creates a Stretch function using percent-clip stretch type.

more details
rasterFunctionUtils
RasterFunction

Creates a Stretch function using standard-deviation stretch type.

more details
rasterFunctionUtils
RasterFunction

Creates a Stretch function without a specific stretch method.

more details
rasterFunctionUtils
RasterFunction

Creates an Attribute Table function to specify an attribute table for the input categorical raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the tangent of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that calculates the hyperbolic tangent of the pixels in a raster.

more details
rasterFunctionUtils
RasterFunction

Creates a raster function that multiplies the values of two rasters on a pixel-by-pixel basis.

more details
rasterFunctionUtils

Method Details

abs(parameters){RasterFunction}

Creates a raster function that calculates the absolute value of the pixels in a raster. See Abs function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.abs({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
acos(parameters){RasterFunction}

Creates a raster function that calculates the inverse cosine of the pixels in a raster. See ACos function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.acos({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
acosh(parameters){RasterFunction}

Creates a raster function that calculates the inverse hyperbolic cosine of the pixels in a raster. See Acosh function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.acosh({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
asin(parameters){RasterFunction}

Creates a raster function that calculates the inverse sine of the pixels in a raster. See ASin function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.asin({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
asinh(parameters){RasterFunction}

Creates a raster function that calculates the inverse hyperbolic sine of the pixels in a raster. See Asinh function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.asinh({
  raster: rasterFunctionUtils.defaultRaster,
   outputPixelType: "f32"
});
aspect(parameters){RasterFunction}

Creates a Aspect function to identify the downslope direction of the maximum rate of change in value from each cell to its neighbors. Aspect can be thought of as the slope direction. The values of the output raster are the compass direction of the aspect. See Aspect function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Create aspect from elevation data.
const aspect = rasterFunctionUtils.aspect({});
atan(parameters){RasterFunction}

Creates a raster function that calculates the inverse tangent of the pixels in a raster. See Atan function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.atan({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
atan2(parameters){RasterFunction}

Creates a raster function that calculates the inverse tangent (based on x,y) of the pixels in a raster. See Atan2 function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.atan2({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
atanh(parameters){RasterFunction}

Creates a raster function that calculates the inverse hyperbolic tangent of the pixels in a raster. See Atanh function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.atanh({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
bandArithmeticBAI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate BAI. The Burn Area Index (BAI) uses the reflectance values in the red and NIR portion of the spectrum to identify the areas of the terrain affected by fire. See BAI raster function.

Equation: BAI = 1/((0.1 -RED) * (0.1 -RED) + (0.06 - NIR) * (0.06 - NIR))

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
redBandId Number

The 0-based red band id.

nirBandId Number

The 0-based near infrared band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
//Creates BAI from a 4-band image whose bands are arranged in BGRI order.
const bai = rasterFunctionUtils.bandArithmeticBAI({
  redBandId: 1,
  nirBandId: 3
});
bandArithmeticCIg(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate CIg. Chlorophyll index - Green (CIG) method is a vegetation index for estimating the chlorophyll content in leaves using the ratio of reflectivity in the NIR and green bands. See CIg raster function.

Equation: CIg = (NIR / Green)-1

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

greenBandId Number

The 0-based green band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates CI (green) from a 4-band image whose bands are arranged in BGRI order.
const rtviCore = rasterFunctionUtils.bandArithmeticCIg({
  nirBandId: 3,
  greenBandId: 1
});
bandArithmeticCIre(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate CIre. The Chlorophyll Index - Red-Edge (CIre) method is a vegetation index for estimating the chlorophyll content in leaves using the ratio of reflectivity in the NIR and red-edge bands. See CIre raster function.

Equation: CIre = (NIR / RedEdge)-1

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

reBandId Number

The 0-based red edge band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates CI (Red-Edge).
const cire = rasterFunctionUtils.bandArithmeticCIre({
  nirBandId: 3,
  reBandId: 4
});
bandArithmeticClayMinerals(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate ClayMinerals. The Clay Minerals (clayMinerals) ratio method is a geological index for identifying mineral features containing clay and alunite using two shortwave infrared (SWIR) bands. It is used in mineral composite mapping. See ClayMinerals raster function.

Equation: CM = SWIR1 / SWIR2

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
swir1BandId Number

The 0-based shortwave infrared band id centering around 1.5—1.75µm.

swir2BandId Number

The 0-based shortwave infrared band id centering around 2.08—2.35µm.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
//Creates ClayMinerals index.
const ironOxide = rasterFunctionUtils.bandArithmeticClayMinerals({
  swir1BandId: 6,
  swir2BandId: 7
});
bandArithmeticEVI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate EVI. The Enhanced Vegetation Index (EVI) method is an optimized vegetation index that accounts for atmospheric influences and vegetation background signal. It's similar to NDVI but is less sensitive to background and atmospheric noise, and it does not become as saturated as NDVI when viewing areas with very dense green vegetation. See EVI raster function.

Equation: EVI = 2.5 * (NIR - Red) / (NIR + 6 * Red - 7.5 * Blue + 1)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

blueBandId Number

The 0-based blue band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates EVI from a 4-band image whose bands are arranged in BGRI order.
const ndvi = rasterFunctionUtils.bandArithmeticEVI({
  nirBandId: 3,
  redBandId: 2,
  blueBandId: 0
});
bandArithmeticFerrousMinerals(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate FerrousMinerals. The Ferrous Minerals (ferrousMinerals) ratio method is a geological index for identifying rock features containing some quantity of iron-bearing minerals using the SWIR and NIR bands. It is used in mineral composite mapping. See FerrousMinerals raster function.

Equation: FM = SWIR / NIR

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
swir1BandId Number

The 0-based shortwave infrared band id.

nirBandId Number

The 0-based near infrared band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates FerrousMinerals index.
const ironOxide = rasterFunctionUtils.bandArithmeticIronOxide({
  swir1BandId: 6,
  nirBandId: 3
});
bandArithmeticGEMI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate GEMI. The Global Environmental Monitoring Index (GEMI) method is a nonlinear vegetation index for global environmental monitoring from satellite imagery. It's similar to NDVI, but it's less sensitive to atmospheric effects. It is affected by bare soil; therefore, it's not recommended for use in areas of sparse or moderately dense vegetation. See GEMI raster function.

Equation: GEMI = eta * (1 - 0.25 * eta)-((Red - 0.125)/(1 - Red)) eta = (2 * (NIR * NIR - Red * Red) + 1.5 * NIR + 0.5 * Red)/(NIR + Red + 0.5)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates GEMI from a 4-band image whose bands are arranged in BGRI order.
const gemi = rasterFunctionUtils.bandArithmeticGEMI({
  nirBandId: 3,
  redBandId: 2
});
bandArithmeticGNDVI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate GNDVI. The Green Normalized Difference Vegetation Index (GNDVI) method is a vegetation index for estimating photo synthetic activity and is a commonly used vegetation index to determine water and nitrogen uptake into the plant canopy. See GNDVI raster function.

Equation: GNDVI = (NIR-Green)/(NIR+Green)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

greenBandId Number

The 0-based green band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates GNDVI from a 4-band image whose bands are arranged in BGRI order.
const gndvi = rasterFunctionUtils.bandArithmeticGNDVI({
  nirBandId: 3,
  greenBandId: 1
});
bandArithmeticGVITM(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate GVITM. The Green Vegetation Index (GVI) method was originally designed from Landsat MSS imagery and has been modified for Landsat TM imagery. It's also known as the Landsat TM Tasseled Cap green vegetation index. It can be used with imagery whose bands share the same spectral characteristics. See GVITM raster function.

Equation: GVI = -0.2848 * Band1 - 0.2435 * Band2 - 0.5436 * Band3 + 0.7243 * Band4 + 0.0840 * Band5 - 1.1800 * Band7

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
bandIds Number[]

The bandIds array representing Landsat band 1, 2, 3, 4, 5, 7.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates GVITM from a Landsat TM multispectral scene.
const gvitm = rasterFunctionUtils.bandArithmeticGVITM({
  bandIds: [0, 1, 2, 3, 4, 5]
});
bandArithmeticIronOxide(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate IronOxide. The Iron Oxide (ironOxide) ratio method is a geological index for identifying rock features that have experienced oxidation of iron-bearing sulfides using the red and blue bands. It is useful in identifying iron oxide features below vegetation canopies and is used in mineral composite mapping. See IronOxide raster function.

Equation: IronOxide = Red / Blue

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
redBandId Number

The 0-based red band id.

blueBandId Number

The 0-based blue band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
//Creates IronOxide from a 4-band image whose bands are arranged in BGRI order.
const ironOxide = rasterFunctionUtils.bandArithmeticIronOxide({
  redBandId: 2,
  blueBandId: 0
});
bandArithmeticMNDWI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate MNDWI. The Modified Normalized Difference Water Index (MNDWI) uses green and SWIR bands for the enhancement of open water features. It also diminishes built-up area features that are often correlated with open water in other indices.

Equation: MNDWI = (Green - SWIR) / (Green + SWIR)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
greenBandId Number

The 0-based green band id.

swirBandId Number

The 0-based shortwave infrared band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates MNDWI.
const mndwi = rasterFunctionUtils.bandArithmeticMNDWI({
  greenBandId: 1,
  swirBandId: 6
});
bandArithmeticMSAVI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate MSAVI. The Modified Soil Adjusted Vegetation Index (MSAVI) method minimizes the effect of bare soil on the SAVI. See MSAVI raster function.

Equation: MSAVI2 = (1/2)(2(NIR+1)-sqrt((2NIR+1)(2NIR+1)-8(NIR-Red)))

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates MSAVI from a 4-band image whose bands are arranged in BGRI order.
const msavi = rasterFunctionUtils.bandArithmeticMSAVI({
  nirBandId: 3,
  redBandId: 2
});
bandArithmeticMTVI2(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate MTVI2. The Modified Triangular Vegetation Index (MTVI2) method is a vegetation index for detecting leaf chlorophyll content at the canopy scale while being relatively insensitive to leaf area index. It uses reflectance in the green, red, and NIR bands. See MTVI2 raster function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

greenBandId Number

The 0-based green band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates MTVI2 from a 4-band image whose bands are arranged in BGRI order.
const mtvi2 = rasterFunctionUtils.bandArithmeticMTVI2({
  nirBandId: 3,
  redBandId: 2,
  greenBandId: 1
});
bandArithmeticMTVI2(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate RTVICore. The Red-Edge Triangulated Vegetation Index (RTVICore) method is a vegetation index for estimating leaf area index and biomass. This index uses reflectance in the NIR, red-edge, and green spectral bands. See RTVICore raster function.

Equation: RTVICore = 100 * (NIR - RedEdge) - 10 * (NIR - Green)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

reBandId Number

The 0-based red edge band id.

greenBandId Number

The 0-based green band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates RTVICore from a 4-band image whose bands are arranged in BGRI order.
const rtviCore = rasterFunctionUtils.bandArithmeticRTVICore({
  nirBandId: 3,
  redBandId: 2,
  greenBandId: 1
});
bandArithmeticNBR(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate NBR. The Normalized Burn Ratio Index (NBRI) uses the NIR and SWIR bands to emphasize burned areas, while mitigating illumination and atmospheric effects. Your images should be corrected to reflectance values before using this index. See NBR raster function.

Equation: NBR = (NIR - SWIR) / (NIR+ SWIR)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

swirBandId Number

The 0-based shortwave infrared band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates NBR index.
const nbr = rasterFunctionUtils.bandArithmeticNBR({
  nirBandId: 3,
  swirBandId: 5
});
bandArithmeticNDBI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate NDBI. The Normalized Difference Built-up Index (NDBI) uses the NIR and SWIR bands to emphasize manufactured built-up areas. It is ratio based to mitigate the effects of terrain illumination differences as well as atmospheric effects. See NDBI raster function.

Equation: NDBI = (SWIR - NIR) / (SWIR + NIR)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
swirBandId Number

The 0-based shortwave infrared band id.

nirBandId Number

The 0-based near infrared band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates NDBI index.
const ndbi = rasterFunctionUtils.bandArithmeticNDBI({
  nirBandId: 3,
  swirBandId: 5
});
bandArithmeticNDMI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate NDMI. The Normalized Difference Moisture Index (NDMI) is sensitive to the moisture levels in vegetation. It is used to monitor droughts and fuel levels in fire-prone areas. It uses NIR and SWIR bands to create a ratio designed to mitigate illumination and atmospheric effects. See NDMI raster function.

Equation: NDMI = (NIR - SWIR1)/(NIR + SWIR1)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

swirBandId Number

The 0-based shortwave infrared band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates NDMI index.
const ndmi = rasterFunctionUtils.bandArithmeticNDMI({
  nirBandId: 3,
  swirBandId: 5
});
bandArithmeticNDSI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate NDSI. The Normalized Difference Snow Index (NDSI) is designed to use MODIS (band 4 and band 6) and Landsat TM (band 2 and band 5) for identification of snow cover while ignoring cloud cover. Since it is ratio based, it also mitigates atmospheric effects. See NDSI raster function.

Equation: NDSI = (Green - SWIR) / (Green + SWIR)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
greenBandId Number

The 0-based green band id.

swirBandId Number

The 0-based shortwave infrared band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Calculates NDSI using Landsat 8.
const ndvi = rasterFunctionUtils.bandArithmeticNDSI({
  greenBandId: 2,
  swirBandId: 5
});
bandArithmeticNDSI(parameters){RasterFunction}

Creates a custom Band Arithmetic function. ser defined method. When using the user defined method to define your band arithmetic algorithm, you can enter a single-line algebraic formula to create a single-band output. The supported operators are -,+,/,*, and unary -. To identify the bands, add B or b to the beginning of the band number. See Band Arithmetic function.

equation: (b1 - b0) / (b1 + b0)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
bandIndexes String

The custom band index, e.g. (b1 - b0) / (b1 + b0)

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
//Creates a custom band arithmetic index that creates a normalized differential band ratio.
const ndvi = rasterFunctionUtils.bandArithmeticCustom({
  bandIndexes: "(b1 - b0) / (b1 + b0)"
});
bandArithmeticNDVI(parameters){RasterFunction}

Creates a NDVI function. The Normalized Difference Vegetation Index (NDVI) method is a standardized index allowing you to generate an image displaying greenness (relative biomass). This index takes advantage of the contrast of the characteristics of two bands from a multispectral raster dataset—the chlorophyll pigment absorptions in the red band and the high reflectivity of plant materials in the NIR band.

Equation: NDVI = ((NIR - Red)/(NIR + Red))

See NDVI function and NDVI.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

scientificOutput Boolean
optional

Output values are linearly scaled to 0 to 200 when scientificOutput is false. Default is true.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates NDVI from a 4-band image whose bands are arranged in BGRI order.
const ndvi = rasterFunctionUtils.bandArithmeticNDVI({
  nirBandId: 3,
  redBandId: 2
});
const colormap = rasterFunctionUtils.colormap({
  colorRampName: "NDVI3",
  raster: ndvi
});
layer.rasterFunction = colormap;
bandArithmeticNDVIre(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate NDVIre. The Red-Edge NDVI (NDVIre) method is a vegetation index for estimating vegetation health using the red-edge band. It is especially useful for estimating crop health in the mid to late stages of growth, when the chlorophyll concentration is relatively higher. Also, NDVIre can be used to map the within-field variability of nitrogen foliage to understand the fertilizer requirements of crops. See NDVIre raster function.

Equation: NDVIre = (NIR - RedEdge)/(NIR + RedEdge)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

reBandId Number

The 0-based red edge band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates NDVI (rededge).
const ndvire = rasterFunctionUtils.bandArithmeticNDVIre({
  nirBandId: 3,
  reBandId: 4
});
bandArithmeticNDWI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate NDWI. The Normalized Difference Water Index (NDWI) method is an index for delineating and monitoring content changes in surface water. It is computed with the NIR and green bands. See NDWI raster function.

Equation: NDWI = (Green - NIR) / (Green + NIR)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

greenBandId Number

The 0-based green band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates NDWI from a 4-band image whose bands are arranged in BGRI order.
const ndwi = rasterFunctionUtils.bandArithmeticNDWI({
  nirBandId: 3,
  greenBandId: 1
});
bandArithmeticPVI(parameters){RasterFunction}

CCreates a Band Arithmetic function to calculate PVI. The Transformed Soil Adjusted Vegetation Index (TSAVI) method is a vegetation index that minimizes soil brightness influences by assuming the soil line has an arbitrary slope and intercept. See PVI raster function.

Equation: PVI = (NIR - a * Red - b) / (sqrt(1 + a*a)) a = slope of the soil line b = gradient of the soil line

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

slope Boolean
optional

The soil line slope. Default is 0.3.

gradient Boolean
optional

The soil line gradient. Default is 0.5.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates PVI from a 4-band image whose bands are arranged in BGRI order.
const pvi = rasterFunctionUtils.bandArithmeticPVI({
  nirBandId: 3,
  redBandId: 2,
  slope: 0.3,
  gradient: 0.5
});
bandArithmeticSAVI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate SAVI. The Soil-Adjusted Vegetation Index (SAVI) method is a vegetation index that attempts to minimize soil brightness influences using a soil-brightness correction factor. This is often used in arid regions where vegetative cover is low, and it outputs values between -1.0 and 1.0.

Equation: SAVI = ((NIR - Red) / (NIR + Red + L)) x (1 + L)

L = The amount of green vegetation cover

See SAVI raster function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

factor Boolean
optional

The amount of green vegetation cover from 0 to 1. Default is 0.33.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates SAVI from a 4-band image whose bands are arranged in BGRI order.
const index = rasterFunctionUtils.bandArithmeticSAVI({
  nirBandId: 3,
  redBandId: 2,
  factor: 0.33
});
bandArithmeticSR(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate SR. The Simple Ratio (SR) method is a common vegetation index for estimating the amount of vegetation. It is the ratio of light scattered in the NIR and absorbed in red bands, which reduces the effects of atmosphere and topography. See SR raster function.

Equation: SR = NIR / Red

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates SR from a 4-band image whose bands are arranged in BGRI order.
const sr = rasterFunctionUtils.bandArithmeticSR({
  nirBandId: 3,
  redBandId: 2
});
bandArithmeticSRre(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate SRre. The Red-Edge Simple Ratio (SRre) method is a vegetation index for estimating the amount of healthy and stressed vegetation. It is the ratio of light scattered in the NIR and red-edge bands, which reduces the effects of atmosphere and topography. See SRre raster function.

Equation: SRre = NIR / RedEdge

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

reBandId Number

The 0-based red edge band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates SR (rededge).
const srre = rasterFunctionUtils.bandArithmeticSRre({
  nirBandId: 3,
  reBandId: 4
});
bandArithmeticSultan(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate Sultan index. Creates a BandArithmetic function.The Sultan's process takes a six-band 8-bit image and uses the Sultan's Formula method to produce a three-band 8-bit image. The resulting image highlights rock formations called ophiolites on coastlines. This formula was designed based on the TM or ETM bands of a Landsat 5 or 7 scene.

See Sultan raster function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
bandIds Number[]

The bandIds array representing band 1, 2, 3, 4, 5, 6.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates Sultan 3 band output from a 6-band Landsat TM multispectral scene.
const sultan = rasterFunctionUtils.bandArithmeticSultan({
  bandIds: [0, 1, 2, 3, 4, 5]
});
bandArithmeticTSAVI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate TSAVI. The Transformed Soil Adjusted Vegetation Index (TSAVI) method is a vegetation index that minimizes soil brightness influences by assuming the soil line has an arbitrary slope and intercept. See TSAVI raster function.

Equation: TSAVI = (s * (NIR - s * Red - a)) / (a * NIR + Red - a * s + X * (1 + s * s)) s = the soil line slope a = the soil line intercept X = an adjustment factor that is set to minimize soil noise

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
nirBandId Number

The 0-based near infrared band id.

redBandId Number

The 0-based red band id.

slope Boolean
optional

The soil line slope. Default is 0.33.

intercept Boolean
optional

The soil line intercept. Default is 0.5.

factor Boolean
optional

The adjustment factor to minimize soil noise. Default is 1.5.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates TSAVI from a 4-band image whose bands are arranged in BGRI order.
const tsavi = rasterFunctionUtils.bandArithmeticTSAVI({
  nirBandId: 3,
  redBandId: 2,
  slope: 0.33,
  intercept: 0.5,
  factor: 1.5
});
bandArithmeticVARI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate VARI. The Visible Atmospherically Resistant Index (VARI) method is a vegetation index for estimating vegetation fraction quantitatively with only the visible range of the spectrum. See VARI raster function.

Equation: VARI = (Green - Red) / (Green + Red – Blue)

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
redBandId Number

The 0-based red band id.

greenBandId Number

The 0-based green band id.

blueBandId Number

The 0-based blue band id.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates VARI from a typical drone image.
const index = rasterFunctionUtils.bandArithmeticVARI({
  redBandId: 0,
  greenBandId: 1,
  blueBandId: 2
});
bandArithmeticWNDWI(parameters){RasterFunction}

Creates a Band Arithmetic function to calculate WNDWI. The Weighted Normalized Difference Water Index (WNDWI) method is a water index developed to reduce errors typically encountered in other water indices, including water turbidity, small water bodies, or shadow in remote sensing scenes.

Equation: WNDWI = [Green – α * NIR – (1 – α) * SWIR ] / [Green + α * NIR + (1 – α) * SWIR]

where a is weighted coefficient ranging from 0 to 1.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
greenBandId Number

The 0-based green band id.

nirBandId Number

The 0-based near infrared band id.

swirBandId Number

The 0-based shortwave infrared band id.

alpha Number
optional

A weighted coefficient ranging from 0 to 1. Default is 0.5.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates WNDWI.
const wndwi = rasterFunctionUtils.bandArithmeticWNDWI({
  greenBandId: 1,
  nirBandId: 3,
  swirBandId: 6
});
bitwiseAnd(parameters){RasterFunction}

Creates a raster function that performs a Bitwise And operation on the binary values of two input rasters. See Bitwise And function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.bitwiseAnd({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
bitwiseLeftShift(parameters){RasterFunction}

Creates a raster function that performs a Bitwise Left Shift operation on the binary values of two input rasters. See Bitwise Left Shift function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.bitwiseLeftShift({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
bitwiseNot(parameters){RasterFunction}

Creates a raster function that performs a Bitwise Not (complement) operation on the binary value of an input raster. See Bitwise Not function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.bitwiseNot({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "s16"
});
bitwiseOr(parameters){RasterFunction}

Creates a raster function that performs a Bitwise Or operation on the binary values of two input rasters. See Bitwise Or function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.bitwiseOr(
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
bitwiseRightShift(parameters){RasterFunction}

Creates a raster function that performs a Bitwise Right Shift operation on the binary values of two input rasters. See Bitwise Right Shift function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.bitwiseRightShift({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
bitwiseXor(parameters){RasterFunction}

Creates a raster function that performs a Bitwise Xor operation on the binary values of two input rasters. See Bitwise Xor function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.bitwiseXor({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
booleanAnd(parameters){RasterFunction}

Creates a raster function that performs a Boolean And operation on the pixel values of two input rasters See Boolean And function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.booleanAnd({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
booleanNot(parameters){RasterFunction}

Creates a raster function that performs a Boolean Not (complement) operation on the pixel values of the input raster. See Boolean Not function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.booleanNot({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "u8"
});
booleanOr(parameters){RasterFunction}

Creates a raster function that performs a Boolean Or operation on the pixel values of two input rasters See Boolean Or function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.booleanOr({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
booleanXor(parameters){RasterFunction}

Creates a raster function that performs a Boolean Xor operation on the pixel values of two input rasters See Boolean Xor function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.booleanXor({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
cellStatistics(parameters){RasterFunction}

Creates a raster function that calculates a statistic from multiple rasters, on a pixel-by-pixel basis. The available statistics are majority, maximum, mean, median, minimum, minority, percentile, range, standard deviation, sum, and variety. See Cell Statistics function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification

The input rasters.

statType String

The true raster, if the first input is a raster.

Possible Values:"min"|"max"|"majority"|"mean"|"minority"|"range"|"stddev"|"sum"|"variety"|"median"

processAsMultiband Boolean
optional

When true, process the single input raster as multiple bands. Default is true.

outputPixelType String
optional

The output pixel type. Default is unknown (determined by input data).

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.conditional({
  rasters: [rasterFunctionUtils.defaultRaster],
  statType: "majority",
  processAsMultiband: true
});
colormap(parameters){RasterFunction}

Creates a Colormap function to define a colormap for a raster by specifying a corresponding color for each pixel value. See Colormap function.

Parameter

The parameters object.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Examples
// Creates a colormap to map pixel value 0 to red and 10 to green.
const colormap = rasterFunctionUtils.colormap({
  colormap: [
    [0, 255, 0, 0],
    [10, 0, 255, 0]
  ]
});
// Creates a colormap to map pixel value 0 to red and 10 to green.
const colormap = rasterFunctionUtils.colormap({
  colormap: [
    {value: 0, color: "red"},
    {value: 10, color: "green"}
  ]
});
// Creates a colormap to map pixel value 0 to red and 10 to green.
const colormap = rasterFunctionUtils.colormap({
  colormap: [
    {value: 0, color: "#FF0000"},
    {value: 10, color: "#00FF00"}
  ]
});
// Creates a colormap to map pixel value using a named colorramp
const colormap = rasterFunctionUtils.colormap({
  colorRampName: "red-to-green"
});
compositeBands(parameters){RasterFunction}

Creates a Composite Bands function to combine multiple inputs into one multiband raster. See Composite Bands function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
conditional(parameters){RasterFunction}

Creates a raster function that sets the truthy pixels (value is not 0) to the pixel value from a true raster, and falsy pixels (value is 0) to the pixel value of the false raster. See Con function.

Parameter

The conditional parameters object.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.conditional({
  raster: rasterFunctionUtils.defaultRaster,
  trueRaster: 100,
  falseRaster: 10,
  outputPixelType: "u8"
});
contrastBrightness(parameters){RasterFunction}

Creates a Contrast And Brightness function that enhances the appearance of raster data by modifying the brightness and contrast within the image. See Contrast And Brightness function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
contrastOffset Number

Contrast offset from -100 to 100.

brightnessOffset Number

Brightness offset from -100 to 100.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.contrastBrightness({
  contrastOffset: 10,
  brightnessOffset: 8
});
convolution(parameters){RasterFunction}

Creates a Convolution function that performs filtering using the given kernel to enhance the image, e.g. sharpening an image, blurring an image, and detecting edges et al. See Convolution function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
convolutionType String

Choose a predefined kernel.

Possible Values:"user-defined"|"line-detection-horizontal"|"line-detection-vertical"|"line-detection-left-diagonal"|"line-detection-right-diagonal"|"gradient-north"|"gradient-west"|"gradient-east"|"gradient-south"|"gradient-north-east"|"gradient-north-west"|"smooth-arithmetic-mean"|"smoothing3x3"|"smoothing5x5"|"sharpening3x3"|"sharpening5x5"|"laplacian3x3"|"laplacian5x5"|"sobel-horizontal"|"sobel-vertical"|"sharpen"|"sharpen2"|"point-spread"|"none"

rows Number
optional

The number of rows, only needed for user-defined kernel.

cols Number
optional

The number of columns, only needed for user-defined kernel

kernel Number[]
optional

The kernel size of rows x columns arranged in row-major order.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Sharpen the image
layer.rasterFunction = rasterFunctionUtils.convolution({
  convolutionType: "sharpen"
});
cos(parameters){RasterFunction}

Creates a raster function that calculates the cosine of the pixels in a raster. See Cos function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.cos({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
cosh(parameters){RasterFunction}

Creates a raster function that calculates the hyperbolic cosine of the pixels in a raster. See Cosh function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.cosh({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
curvature(parameters){RasterFunction}

Creates a Curvature function that calculates the shape or curvature of the slope. A part of a surface can be concave or convex; you can tell that by looking at the curvature value. The curvature is calculated by computing the second derivative of the surface. See Curvature function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
curvatureType String

The curvature type

Possible Values:"standard"|"platform"|"profile"

zFactor Number

A ratio of z unit / xy unit, with optional exaggeration factored in.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Create curvature from elevation data.
const slope = rasterFunctionUtils.curvature({
  curvatureType: "standard",
  zFactor: 1
});
divide(parameters){RasterFunction}

Creates a raster function that divides the values of two rasters on a pixel-by-pixel basis. See Divide function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.divide({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
equalTo(parameters){RasterFunction}

Creates a raster function that performs an equal-to operation on two rasters on a pixel-by-pixel basis. See Equal To function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.equalTo({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
exp(parameters){RasterFunction}

Creates a raster function that calculates the base e exponential of the pixels in a raster. See Exp function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.exp({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
exp2(parameters){RasterFunction}

Creates a raster function that calculates the base 2 exponential of the pixels in a raster. See Exp2 function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.exp2({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
exp10(parameters){RasterFunction}

Creates a raster function that calculates the base 10 exponential of the pixels in a raster. See Exp10 function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.exp10({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
extractBand(parameters){RasterFunction}

Creates an Extract Band function to extract one or more bands from a multiband raster. To use bandNames or bandWavelengths, the data source must have corresponding key properties information. See Extract Band function.

Parameters
Specification

The parameters object.

Specification
optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Creates a false color composite from a Landsat TM multispectral image.
const nrg = rasterFunctionUtils.extractBand({
  bandIds: [3, 2, 1]
});

const nrg = rasterFunctionUtils.extractBand({
  bandNames: ["NearInfrared_1", "Red", "Green"]
});

const nrg = rasterFunctionUtils.extractBand({
  bandWavelengths: [800, 650, 550]
});
float(parameters){RasterFunction}

Creates a raster function that converts each pixel value of a raster into a floating-point representation. See Float function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.float({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
greaterThan(parameters){RasterFunction}

Creates a raster function that performs a relational greater-than operation on two rasters on a pixel-by-pixel basis. See Greater Than function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.greaterThan({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
greaterThanEqual(parameters){RasterFunction}

Creates a raster function that performs a relational greater-than-or-equal-to operation on two rasters on a pixel-by-pixel basis. See Greater Than Equal function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.greaterThanEqual({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
int(parameters){RasterFunction}

Creates a raster function that converts each pixel value of a raster to an integer by truncation. See Int function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.int({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "u32"
});
isNull(parameters){RasterFunction}

Creates a raster function that determines which values from the input raster are NoData on a pixel-by-pixel basis. See Is Null function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.isNull({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "u8"
});
lessThan(parameters){RasterFunction}

Creates a raster function that performs a relational less-than operation on two rasters on a pixel-by-pixel basis. See Less Than function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.lessThan({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
lessThanEqual(parameters){RasterFunction}

Creates a raster function that performs a relational less-than-or-equal-to operation on two rasters on a pixel-by-pixel basis. See Less Than Equal function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.lessThanEqual({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
log(parameters){RasterFunction}

Creates a raster function that calculates the natural logarithm (base e) of each pixel in a raster. See Ln function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.log({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
log2(parameters){RasterFunction}

Creates a raster function that calculates the base 2 logarithm of each pixel in a raster. See Log2 function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.log2({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
log10(parameters){RasterFunction}

Creates a raster function that calculates the base 10 logarithm of each pixel in a raster. See Log10 function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.log10({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
mask(parameters){RasterFunction}

Creates a Mask function to specify one or more NoData values, or a range of valid pixel values, to be removed from an output raster. See Mask function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
includedRanges Number[][]

The included values for each band. Each band is specified using a range [from, to].

noDataValues Number[][]

The nodata values for each band.

noDataInterpretation String
optional

Result is no data if all bands are nodata when match-all is specified, any if any band is nodata when match-any is specified.

Possible Values:"match-any"|"match-all"

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Only show sea surface temperature above 10 degrees.
const warmWater = rasterFunctionUtils.mask({
  includedRanges: [[10, 50]]
});
minus(parameters){RasterFunction}

Creates a raster function that subtracts the value of the second input raster from the value of the first input raster on a pixel-by-pixel basis. See Minus function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.minus({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1,
  outputPixelType: "s16"
});
mod(parameters){RasterFunction}

Creates a raster function that finds the remainder (modulo) of the first raster when divided by the second raster on a pixel-by-pixel basis. See Mod function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.mod({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
negate(parameters){RasterFunction}

Creates a raster function that finds the changes the sign (multiplies by -1) of the pixel values of the input raster on a pixel-by-pixel basis. See Negate function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.negate({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
notEqual(parameters){RasterFunction}

Creates a raster function that performs a relational not-equal-to operation on two rasters on a pixel-by-pixel basis. See Not Equal function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.notEqual({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
plus(parameters){RasterFunction}

Creates a raster function that adds (sums) the values of two rasters on a pixel-by-pixel basis. See Plus function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.plus({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 100,
  outputPixelType: "u16"
});
power(parameters){RasterFunction}

Creates a raster function that raises the pixel values in a raster to the power of the values found in another raster. See Power function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.power({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});
remap(parameters){RasterFunction}

Creates a Remap function to change or reclassify the pixel values of the raster. See Remap function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification

Range maps.

allowUnmatched Boolean
optional

Unmatched pixel values are passed through when true, or set to NoData when false.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Remap costal elevation values into flood risk categories.
const warmWater = rasterFunctionUtils.remap({
  rangeMaps: [
   { range: [-100, 10], output: 0 },
   { range: [10, 1000], output: 200 }
  ]
});
roundDown(parameters){RasterFunction}

Creates a raster function that returns the next lower integer, as a floating-point value, for each pixel in a raster. See Round Down function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.roundDown({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "s16"
});
roundUp(parameters){RasterFunction}

Creates a raster function that returns the next higher integer, as a floating-point value, for each pixel in a raster. See Round Up function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.roundUp({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "s16"
});
setNull(parameters){RasterFunction}

Creates a raster function that sets the truthy pixels (value is not 0) to NoData, and falsy pixels (value is 0) to the pixel value of the false raster. See Set Null function.

Parameter
parameters SetNullParameters

The set null parameters object.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.setNull({
  raster: rasterFunctionUtils.defaultRaster,
  falseRaster: 1,
  outputPixelType: "u8"
});
sin(parameters){RasterFunction}

Creates a raster function that calculates the sine of the pixels in a raster. See Sin function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.sin({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
sinh(parameters){RasterFunction}

Creates a raster function that calculates the hyperbolic sine of the pixels in a raster. See Sinh function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.sinh({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
slope(parameters){RasterFunction}

Creates a Slope function that calculates the rate of change of elevation for each digital elevation model (DEM) cell. It's the first derivative of a DEM. See Slope function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
slopeType String

The slope type

Possible Values:"degree"|"percent-rise"|"adjusted"

zFactor Number

A ratio of z unit / xy unit, with optional exaggeration factored in.

pixelSizePower Number
optional

Pixel size factor accounts for changes in scale as the viewer zooms in and out on the map display. It controls the rate at which the Z Factor changes. This parameter is only valid when the scalingType is adjusted.

pixelSizeZFactor Number
optional

Pixel Size Power accounts for the altitude changes (or scale) as the viewer zooms in and out on the map display. It is the exponent applied to the pixel size term in the equation that controls the rate at which the Z Factor changes to avoid significant loss of relief. This parameter is only valid when the scalingType is adjusted.

removeEdgeEffect Boolean
optional

Remove edge effect when true

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Create a slope from elevation data.
const slope = rasterFunctionUtils.slope({
  slopeType: "degree",
  zFactor: 1
});
sqrt(parameters){RasterFunction}

Creates a raster function that calculates the square root of the pixel values in a raster. See Suqare Root function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.sqrt({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
square(parameters){RasterFunction}

Creates a raster function that calculates the square of the pixel values in a raster. See Square function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.square({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
statistics(parameters){RasterFunction}

Creates a Statistics function that calculates focal statistics for each pixel of an image based on a defined focal neighborhood. See Statistics function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
statisticsType String

The statistics type

Possible Values:"min"|"max"|"majority"|"mean"|"minority"|"stddev"|"median"

rows Number

Number of rows.

cols Number

Number of columns.

fillNoDataOnly Boolean
optional

When true only fills noData pixels

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Create majority statistics function to get rid of noises in the image.
const slope = rasterFunctionUtils.statistics({
  statisticsType: "majority",
  rows: 3,
  cols: 3
});
statisticsHistogram(parameters){RasterFunction}

Creates a Statistics And Histogram function to define the statistics and histogram of a raster. See Statistics And Histogram function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
optional

The statistics parameter.

histograms RasterHistogram[]
optional

The histogram parameter.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// attach statistics and histograms to the input imagery.
const statsHistFunction = rasterFunctionUtils.statisticsHistogram({
  statistics: [{ min: 1, max: 5, mean: 3, standardDeviation: 1 }],
  histograms: [{ min: 1, max: 5, counts: [100, 200, 100, 200, 100] }]
});
stretchMinMax(parameters){RasterFunction}

Creates a Stretch function using min-max stretch type. Pixel values inside [min, max] defined in the band's statistics are stretched to [outputMin, outputMax], those fall outside are clamped to [outputMin, outputMax]. See Stretch function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
optional

Default is the input data source's statistics.

outputMin Number
optional

The minimum output value. Default is 0.

outputMax Number
optional

The maximum output value. Default is 255.

useGamma Boolean
optional

When true, gamma stretch is applied.

gamma Number[]
optional

The gamma values used for each band, needed when useGamma is true.

dynamicRangeAdjustment Boolean
optional

When true, perform dynamic range adjustment (not supported on client side).

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// stretch NDVI values from -1 to 1 to 0 to 255.
layer.rasterFunction = rasterFunctionUtils.stretchMinMax({
  statistics: [{min: -1, max: 1, avg: 0, stddev: 0.1}],
  outputPixelType: "u8"
});
stretchPercentClip(parameters){RasterFunction}

Creates a Stretch function using percent-clip stretch type. The input data must have histograms for it to work properly. See Stretch function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
minPercent Number

Percentage of the lowest pixel vlaues to be excluded.

maxPercent Number

Percentage of the highest pixel vlaues to be excluded.

outputMin Number
optional

The minimum output value. Default is 0.

outputMax Number
optional

The maximum output value. Default is 255.

useGamma Boolean
optional

When true, gamma stretch is applied.

gamma Number[]
optional

The gamma values used for each band, needed when useGamma is true.

dynamicRangeAdjustment Boolean
optional

When true, perform dynamic range adjustment (not supported on client side)

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Stretch Landsat imagery using percent clip, pixels values within both lower 2% and
// upper 2% are clamped to output min (0) and output max (255).
layer.rasterFunction = rasterFunctionUtils.stretchPercentClip({
  minPercent: 2,
  maxPercent: 2,
  outputPixelType: "u8"
});
stretchStandardDeviation(parameters){RasterFunction}

Creates a Stretch function using standard-deviation stretch type. Pixel values inside the defined number of standard deviations are stretched to [outputMin, outputMax], those fall outside are clamped to [outputMin, outputMax]. See Stretch function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
numberOfStandardDeviations Number

Values with in the given number of standard deviations are stretched to [outputMin, outputMax], those fall outside are clamped.

outputMin Number
optional

The minimum output value. Default is 0.

outputMax Number
optional

The maximum output value. Default is 255.

useGamma Boolean
optional

When true, gamma stretch is applied.

gamma Number[]
optional

The gamma values used for each band, needed when useGamma is true.

optional

The avg and stddev in each band's statistics is used along with numberOfStandardDeviations to calculate the cut off pixels values beling stretched. Default is the input data source's statistics.

dynamicRangeAdjustment Boolean
optional

When true, perform dynamic range adjustment (not supported on client side).

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Stretch elevation values with in 2 standard deviations to 0 to 255.
layer.rasterFunction = rasterFunctionUtils.stretchStandardDeviation({
  numberOfStandardDeviations: 2,
  statistics: [{min: 20, max: 1200, avg: 600, stddev: 100}],
  outputPixelType: "u8"
});
stretchStandardDeviation(parameters){RasterFunction}

Creates a Stretch function without a specific stretch method. Since output range can differ from pixel type's range, pixel values are projected to the output range linearly based on pixel type. For aerial or satellite imagery, it simply adjusts radiometric resolution and preserves DN values relatively. This is a no-op for all unsigned 8 bit images. See Stretch function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
outputMin Number
optional

The minimum output value. Default is 0.

outputMax Number
optional

The maximum output value. Default is 255.

useGamma Boolean
optional

When true, gamma stretch is applied.

gamma Number[]
optional

The gamma values used for each band, needed when useGamma is true.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
// Apply no additional stretch, pixel values are simply fitted into 0 to 255 range.
layer.rasterFunction = rasterFunctionUtils.stretchNone({
  outputPixelType: "u8"
});
table(parameters){RasterFunction}

Creates an Attribute Table function to specify an attribute table for the input categorical raster. See Attribute Table function.

Parameters
Specification
parameters Object

The parameters object has the following properties.

Specification
attributeTable FeatureSet

The attribute table represented using a feature set.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
Attach a classification table to the categorical imagery data.

const attributeTable = FeatureSet.fromJSON({
 displayFieldName: "",
 fields: [
   {
     name: "ObjectID",
     type: "esriFieldTypeOID",
     alias: "OID"
   },
   {
     name: "Value",
     type: "esriFieldTypeInteger",
     alias: "Value"
   },
   {
     name: "ClassName",
     type: "esriFieldTypeString",
     alias: "ClassName",
     length: 256
   },
   {
     name: "Red",
     type: "esriFieldTypeInteger",
     alias: "Red"
   },
   {
     name: "Green",
     type: "esriFieldTypeInteger",
     alias: "Green"
   },
   {
     name: "Blue",
     type: "esriFieldTypeInteger",
     alias: "Blue"
   },
   {
     name: "Alpha",
     type: "esriFieldTypeInteger",
     alias: "Alpha"
    }
  ],
  features: [
    {
      attributes: {
        ObjectID: 1,
        Value: 10,
        ClassName: "c0",
        Red: 255,
        Green: 190,
        Blue: 190,
        Alpha: 255
      }
    },
    {
      attributes: {
        ObjectID: 2,
        Value: 11,
        ClassName: "c1",
        Red: 255,
        Green: 127,
        Blue: 127,
        Alpha: 255
      }
    }
  ]
});
const tableFunction = rasterFunctionUtils.table({ attributeTable });
tan(parameters){RasterFunction}

Creates a raster function that calculates the tangent of the pixels in a raster. See Tan function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.tan({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
tanh(parameters){RasterFunction}

Creates a raster function that calculates the hyperbolic tangent of the pixels in a raster. See Tanh function.

Parameter

Input parameters for performing math operations on an input raster.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.tanh({
  raster: rasterFunctionUtils.defaultRaster,
  outputPixelType: "f32"
});
times(parameters){RasterFunction}

Creates a raster function that multiplies the values of two rasters on a pixel-by-pixel basis. See Times function.

Parameter

Input parameters for performing math operations on two input rasters.

Returns
Type Description
RasterFunction Returns a RasterFunction.
Example
layer.rasterFunction = rasterFunctionUtils.times({
  raster: rasterFunctionUtils.defaultRaster,
  raster2: 1
});

Type Definitions

ConditionalParameters Object

Conditional parameters

Properties

The input raster.

trueRaster RasterArgument

The true raster.

falseRaster RasterArgument

The false raster.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

ExtractBandByIdParameters Object

Extract bands parameters specified using band ids.

Properties
bandIds Number[]

The 0-based band ids.

missingBandAction String
optional

Indicate whether to use best possible matching band when the requested band is missing.

Possible Values:"fail"|"best-match"

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

ExtractBandByNameParameters Object

Extract bands parameters specified using band wavelengths.

Properties
bandWavelengths Number[]

The band wavelengths.

missingBandAction String
optional

Indicate whether to use best possible matching band when the requested band is missing.

Possible Values:"fail"|"best-match"

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

ExtractBandByWavelengthParameters Object

Extract bands parameters specified using band names.

Properties
bandNames String[]

The band names.

missingBandAction String
optional

Indicate whether to use best possible matching band when the requested band is missing.

Possible Values:"fail"|"best-match"

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Math1RasterParameters Object

Input parameters for performing math operations on one input raster.

Properties

The first raster.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Math2RastersParameters Object

Input parameters for perform math operations between two rasters.

Properties

The first raster input.

raster2 RasterArgument

The second raster input.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

PixelValueRangeMap Object

Range map pixel values.

Properties
range Number[]

The pixel value range.

output Number

The mapped pixel value. Null or undefined will produce NoData as the output.

RasterArgument RasterFunction|String|Number

Raster argument used to specify raster(s) used in raster processing. When the input raster is the image service itself and if the raster function takes:

  • A single input raster: the raster parameter can be omitted.
  • Multiple input rasters: the image service raster needs to be represented using defaultRaster as ("$$").

When the input raster is the result of a another raster function processing:

  • Set the raster parameter to a result of a raster function.

When the raster function takes more than one input rasters:

  • One of the input (usually the first) must be either another raster function or an image service raster
  • Additional rasters can also be specified in the form of a scalar, e.g. 100. When the function is applied on a dynamic image service:
  • $RasterId (e.g. "$1") can be used to reference a raster by its objectId.
RasterColormapByMapParameters Object

Raster colormap input parameters specified using a colormap.

Properties

The colormap.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

RasterColormapByNameParameters Object

Raster colormap input parameters specified using colormap name.

Properties
colorRampName String

The name of a predefined colorramp or colormap.

Possible Values:"aspect"|"black-to-white"|"blue-bright"|"blue-light-to-dark"|"blue-green-bright"|"blue-green-light-to-dark"|"brown-light-to-dark"|"brown-to-blue-green-diverging-right"|"brown-to-blue-green-diverging-dark"|"coefficient-bias"|"cold-to-hot-diverging"|"condition-number"|"cyan-to-purple"|"cyan-light-to-blue-dark"|"distance"|"elevation1"|"elevation2"|"errors"|"gray-light-to-dark"|"green-bright"|"green-light-to-dark"|"green-to-blue"|"orange-bright"|"orange-light-to-dark"|"partial-spectrum"|"partial-spectrum-1-diverging"|"partial-spectrum-2-diverging"|"pink-to-yellow-green-diverging-bright"|"pink-to-yellow-green-diverging-dark"|"precipitation"|"prediction"|"purple-bright"|"purple-to-green-diverging-bright"|"purple-to-green-diverging-dark"|"purple-blue-bright"|"purple-blue-light-to-dark"|"purple-red-bright"|"purple-red-light-to-dark"|"red-bright"|"red-light-to-dark"|"red-to-blue-diverging-bright"|"red-to-blue-diverging-dark"|"red-to-green"|"red-to-green-diverging-bright"|"red-to-green-diverging-dark"|"slope"|"spectrum-full-bright"|"spectrum-full-dark"|"spectrum-full-light"|"surface"|"temperature"|"white-to-black"|"yellow-to-dark-red"|"yellow-to-green-to-dark-blue"|"yellow-to-red"|"yellow-green-bright"|"yellow-green-light-to-dark"|"random"|"elevation"|"gray"|"hillshade"|"ndvi"|"ndvi2"|"ndvi3"

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

RasterColormapByRampParameters Object

Raster colormap input parameters specified using a colorramp.

Properties

A colorramp

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

RasterValueToColor Object

A pixel value to color mapping.

Properties
value Number

Pixel value.

Color represented using [r,g,b] or [r,g,b,a], or the color's name or hex string.

optional

The input raster. Default is the image service.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

SetNullParameters Object

SetNull parameters

Properties

The input raster.

falseRaster RasterArgument

The false raster.

outputPixelType String
optional

The output pixel type, default is unknown.

Possible Values:"unknown"|"s8"|"s16"|"s32"|"u8"|"u16"|"u32"|"f32"|"f64"

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.