Skip to content
Types
import type { ArcGISImageService } from "@arcgis/core/layers/mixins/ArcGISImageService.js";
Subclasses:
ImageryLayer

ArcGISImageService is a mixin that adds a set of properties and methods for managing image services for ImageryLayer.

Properties

bandIds

Property
Type
number[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.19

Defines a band combination using 0-based band indexes. Set the bandIds to the desired band when applying a RasterStretchRenderer to the layer to get the correct result.

capabilities

readonly Property
Type
ImageryLayerCapabilities
Since
ArcGIS Maps SDK for JavaScript 4.16

Describes the layer's supported capabilities.

compressionQuality

Property
Type
number | null | undefined

The compression quality value. Controls how much loss the image will be subjected to by the compression algorithm. Valid value ranges of compression quality are from 0 to 100. Only valid when using jpg or jpgpng image format.

compressionTolerance

Property
Type
number

Controls the tolerance of the lerc compression algorithm. The tolerance defines the maximum possible error of pixel values in the compressed image. It's a double value.

Default value
0.01
Property
Type
string | null | undefined

The copyright text as defined by the service.

defaultMosaicRule

readonly Property
Type
MosaicRule | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.28

Default mosaic rule of the image service.

definitionExpression

Property
Type
string | null | undefined

The SQL where clause used to filter rasters. Only the rasters that satisfy the definition expression are displayed in the View. This property overrides the mosaicRule's MosaicRule.where property if both properties are set on the layer.

fields

readonly Property
Type
Field[]

An array of fields in the layer. Each field represents an attribute that may contain a value for each raster in the layer.

See also

fieldsIndex

readonly Property
Type
FieldsIndex<Field> | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.21

A convenient property that can be used to make case-insensitive lookups for a field by name. This property is only available after the ImageryLayer has been loaded.

See also
Example
// lookup a field by name, name is case-insensitive
const fieldsIndex = layer.fieldsIndex.get("OBjecTID");
// if there's a field by that name, print it to the console
if (fieldsIndex) {
console.log("fieldsIndex: ", fieldsIndex);
}

format

Property
Type
RasterFormats

The format of the exported image.

hasMultidimensions

readonly Property
Type
boolean

Indicates if the layer has multidimensionalInfo.

Default value
false

imageMaxHeight

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 4.4

Indicates the maximum height of the image exported by the service.

Default value
4100

imageMaxWidth

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 4.4

Indicates the maximum width of the image exported by the service.

Default value
4100

interpolation

Property
Type
RasterInterpolation
Since
ArcGIS Maps SDK for JavaScript 4.12

Defines how to interpolate pixel values.

mosaicRule

autocast Property
Type
MosaicRule

Defines how overlapping images should be mosaicked.

multidimensionalInfo

readonly Property
Type
RasterMultidimensionalInfo | null | undefined

The multidimensional information associated with the layer if the layer's hasMultidimensions property is true. If defined, multidimensional information contains data in multiple dimensions like time and depth/height, and contains multiple variables. Defining slices of particular dimensions in the layer is handled with the MosaicRule.multidimensionalDefinition property of the mosaicRule.

See also

multidimensionalSubset

autocast Property
Type
MultidimensionalSubset | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.25

Represents a multidimensional subset of raster data. This includes subsets of both variables and dimensions. When the multidimensionalSubset is defined on a layer, the MosaicRule.multidimensionalDefinition must be within the defined multidimensionalSubset, otherwise nothing will be displayed.

See also
Example
// set a multi dimensional subset on the imagery layer
// so that users can only access sea temperature data in the atlantic ocean
// between April 7 - 18, 2014 and at depths between -500 - 0.
const multidimensionalSubset = new MultidimensionalSubset({
// area over atlantic ocean
areaOfInterest: new Extent({
type: "extent",
xmax: 3041935.5384527617,
xmin: -10166382.94922227,
ymax: 12406741.274438996,
ymin: -5908793.695137047,
spatialReference: {
wkid: 102100
}
}),
subsetDefinitions: [
{
variableName: "water_temp",
dimensionName: "StdTime",
values: [1396828800000, 1397779200000], // 4/7 - 4/18
isSlice: false
},
{
variableName: "water_temp",
dimensionName: "StdZ",
values: [-500, 0],
isSlice: false
}
],
});
layer.multidimensionalSubset = multidimensionalSubset;

noData

Property
Type
number | number[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.12

The pixel value representing no available information. Can be a number (same value for all bands) or array (specific value for each band).

noDataInterpretation

Property
Type
RasterNoDataInterpretation | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.12

Interpretation of the noData setting.

ValueDescription
anyPixel is transparent if any band matches noData value.
allPixel is transparent only if all bands match noData value.

objectIdField

readonly Property
Type
string

The name of an oid field containing a unique value or identifier for each raster in the layer.

See also

pixelFilter

Property
Type
PixelFilterFunction | null | undefined

A function that processes ImageryLayerView.pixelData. The pixelData object contains a PixelBlock property that gives you access to all of the pixels in the raster on the client.

Inside the pixelFilter you may loop through all the PixelBlock.pixels found in the pixelBlock property of the pixelData object and process them. This function may be used to hide some pixels from the view, alter their values, and change their color. The pixelFilter should be used when the imagery layer's format is lerc or tiff as these formats return raw pixel data to the client.

See also
Example
let layer = new ImageryLayer({
url: // url to the image service
pixelFilter: colorize // see the colorize() function below
});
// This function is applied to the pixelFilter property of the layer.
// It takes the original value of each pixel and converts it to an RGB
// representation to color the layer on a blue - red ramp. Blue pixels
// represent low values and red pixels represent high values. View the sample
// referenced above to see how this function works
function colorize(pixelData) {
// If there isn't pixelData, a pixelBlock, nor pixels, exit the function
if (pixelData === null || pixelData.pixelBlock === null || pixelData.pixelBlock.pixels === null) {
return;
}
// The pixelBlock stores the values of all pixels visible in the view
let pixelBlock = pixelData.pixelBlock;
// Get the min and max values of the data in the current view
let minValue = pixelBlock.statistics[0].minValue;
let maxValue = pixelBlock.statistics[0].maxValue;
// The mask is an array that determines which pixels are visible to the client
let mask = pixelBlock.mask;
// The pixels visible in the view
let pixels = pixelBlock.pixels;
// The number of pixels in the pixelBlock
let numPixels = pixelBlock.width * pixelBlock.height;
// Calculate the factor by which to determine the red and blue
// values in the colorized version of the layer
let factor = 255.0 / (maxValue - minValue);
// Get the pixels containing temperature values in the only band of the data
let band1 = pixels[0];
// Create empty arrays for each of the RGB bands to set on the pixelBlock
let rBand = [];
let gBand = [];
let bBand = [];
// Loop through all the pixels in the view
for (i = 0; i < numPixels; i++) {
// Get the pixel value recorded at the pixel location
let tempValue = band1[i];
// Calculate the red value based on the factor
let red = (tempValue - minValue) * factor;
// Sets a color between blue (lowest) and red (highest) in each band
rBand[i] = red;
gBand[i] = 0;
bBand[i] = 255 - red;
}
// Set the new pixel values on the pixelBlock (now three bands)
pixelData.pixelBlock.pixels = [rBand, gBand, bBand];
pixelData.pixelBlock.pixelType = "u8"; // u8 is used for color
}

pixelType

Property
Type
RasterPixelType | null | undefined

Raster source pixel type.

ValueRange of values that each cell can contain
unknownPixel type is unknown
s8-128 to 127
s16-32768 to 32767
s32-2147483648 to 2147483647
u80 to 255
u160 to 65535
u320 to 4294967295
f32-3.402823466e+38 to 3.402823466e+38
f640 to 18446744073709551616

rasterFields

readonly Property
Type
Field[]

A complete list of fields that consists of raster attribute table fields, item pixel value, service pixel value, service pixel value with various server defined function templates, and raster attribute table fields. This list is used for layer's ImageryLayer.popupTemplate.

It is essential in many imagery workflows to show pixel values and related categorical information (if applicable) in a popup. To meet this requirement, there're additional raster fields used in image service popups, representing pixel values and corresponding attributes if the service has additional rasterAttributeTable resource. These raster fields are prefixed with Raster. to indicate that they are special fields and avoid any potential conflict with fields from service info.

Pixel value fields

Below is a list of raster fields that return different types of pixel values and their descriptions.

Read More
Service pixel value

The Raster.ServicePixelValue field returns a pixel value at the identifying location, after dynamic mosaicking (if applicable) and processing is done using layer's current mosaicRule and rasterFunction settings. This field exists for all image services. The server side dynamic mosaicking process is only applicable if the service is published from a mosaic dataset.

Raw service pixel value

The Raster.ServicePixelValue.Raw field returns a pixel value at the identifying location, after dynamic mosaicking (if applicable) but without further processing. It uses layer's current mosaicRule and None raster function. This field only exists if the image service info has allowRasterFunction: true, and has a None entry in rasterFunctionInfos.

Service pixel value from server side raster functions

The Raster.ServicePixelValue.RFTNAME field returns a pixel value at the identifying location, after dynamic mosaicking (if applicable) and processing using any predefined sever side raster function. The list of available functions is defined by rasterFunctionInfos in image service root resource, except None function, which is already mapped as Raw Service Pixel Value. This field only exists if the image service info has allowRasterFunction: true.

Item pixel value

The Raster.ItemPixelValue field returns a pixel value representing pixel values of each of the individual images in the image service. This is only applicable to image services published from a mosaic dataset. It can be retrieved from the image service using either the identify() or the getSamples() method.

For example, for a service published from a mosaic dataset with the following raster functions:

rasterFunctionInfos": [
{ "name": "None", "description": "", "help": ""},
{ "name": "EVI", "description": "", "help": ""}],
{ "name": "VI", "description": "", "help": ""}
]

You can have the following additional raster fields: Raster.ServicePixelValue, Raster.ServicePixelValue.Raw, Raster.ServicePixelValue.EVI, Raster.ServicePixelValue.VI and Raster.ItemPixelValue.

Pixel value fields support formatting. Since an image service can have multiple bands, pixel value represents multiple bands, and shouldn't be assumed as a single number. This needs to be considered when formatting values.

Categorical attributes fields for pixel value

When working with categorical data (e.g. Land Cover data), image service info may have an associated rasterAttributeTable resource, indicated in root resource via the hasRasterAttributeTable flag. A raster attribute table always has a Value field, and each record in the table represents a pixel value mapping to associated categorical fields, such as the ClassName (Raster.ClassName), Count (Raster.Count) or color representation (Raster.Red, Raster.Green and Raster.Blue) fields of the value.

Vector fields

The Raster.Magnitude and Raster.Direction fields return magnitude and direction values from a multidimensional dataset with a vector field.

Example
layer.when(() => {
// print out field names returned in layer.rasterFields
layer.rasterFields.forEach((field) => {
console.log(field.name);
});
});

rasterFunction

autocast Property
Type
RasterFunction | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.27

Specifies the rule for how the requested image should be processed. When rasterFunction applied, the server returns an updated service information that reflects a custom processing as defined by the raster function.

Use helper functions from the rasterFunctionUtils module when creating raster functions that apply to ImageryLayers.

See also
Examples
// apply NDVI and colormap raster function to an imagery layer
// use rasterFunctionUtils convenience methods to create raster functions
const ndvi = rasterFunctionUtils.bandArithmeticNDVI({
nirBandId: 4,
redBandId: 3,
scientificOutput: false
});
const colormap = rasterFunctionUtils.colormap({
colorRampName: "NDVI3",
raster: ndvi
});
layer.rasterFunction = colormap;
const stretchFunction = new RasterFunction({
functionName: "Stretch",
functionArguments: {
StretchType: 5, // (0 = None, 3 = StandardDeviation, 4 = Histogram Equalization, 5 = MinMax, 6 = PercentClip, 9 = Sigmoid)
Min: 0,
Max: 255,
Raster: "$$" // $$(default) refers to the entire image service, $2 refers to the second image of the image service
},
outputPixelType: "u8"
});
const colorFunction = new RasterFunction({
functionName: "Colormap",
functionArguments: {
ColorrampName: "Temperature", // other examples: "Slope", "Surface", "Blue Bright"....
Raster: stretchFunction // chaining multiple raster functions
}
});
const imageryLayer = new ImageryLayer({
url:
"https://sampleserver6.arcgisonline.com/arcgis/rest/services/ScientificData/SeaTemperature/ImageServer"
});
imageryLayer.rasterFunction = colorFunction;

rasterFunctionInfos

readonly Property
Type
ServiceRasterFunctionInfo[] | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.22

Returns raster function information for the image services, including the name, description, help, function type, and a thumbnail of pre-configured raster function templates.

renderer

autocast Property
Type
RasterRendererUnion | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.11

The renderer assigned to the layer. The renderer defines how to visualize pixels in the imagery layer. Depending on the renderer type, the pixels may be stretched across the color ramp, classified, have different symbols based on values, or show shaded reliefs.

If both renderer and pixelFilter is applied to an ImageryLayer then pixelFilter will override the renderer.

Known Limitations

Currently, the VectorFieldRenderer is not supported in 3D SceneView.

See also

serviceRasterInfo

readonly Property
Type
RasterInfo
Since
ArcGIS Maps SDK for JavaScript 4.12

Source raster information of the image service. The layer must be ImageryLayer.loaded before serviceRasterInfo can be accessed.

See also

sourceJSON

Property
Type
any
Since
ArcGIS Maps SDK for JavaScript 4.13

The image service's metadata JSON exposed by the ArcGIS REST API. While most commonly used properties are exposed on the ImageryLayer class directly, this property gives access to all information returned by the image service. This property is useful if working in an application built using an older version of the API which requires access to image service properties from a more recent version.

sourceType

readonly Property
Type
SourceType
Since
ArcGIS Maps SDK for JavaScript 4.28

Image service data source type.

spatialReference

readonly Property
Type
SpatialReference

The spatial reference of the image service.

url

Property
Type
string | null | undefined

The URL to the REST endpoint of the layer. The URL may either point to a resource on ArcGIS Enterprise or ArcGIS Online.

Example
// This url must point to an Image Service
let layer = new ImageryLayer({
url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/CharlotteLAS/ImageServer"
});

version

readonly Property
Type
number

The version of ArcGIS Server in which the image service is published.

Example
// Prints the version number to the console - e.g. 10.91, 11.2, 11.3
console.log(layer.version);

Methods

MethodSignatureClass
calculateVolume(parameters: ImageVolumeParameters | ImageVolumeParametersProperties, requestOptions?: RequestOptions): Promise<ImageVolumeResult>
computeAngles(parameters: ImageAngleParameters | ImageAngleParametersProperties, requestOptions?: RequestOptions): Promise<ImageAngleResult>
computeHistograms(parameters: ImageHistogramParameters | ImageHistogramParametersProperties, requestOptions?: RequestOptions): Promise<ImageServiceHistogramsResult>
computePixelSpaceLocations(parameters: ImagePixelLocationParameters | ImagePixelLocationParametersProperties, requestOptions?: RequestOptions): Promise<ImagePixelLocationResult>
computeStatisticsHistograms(parameters: ImageHistogramParameters | ImageHistogramParametersProperties, requestOptions?: RequestOptions): Promise<ImageServiceStatisticsHistogramsResult>
fetchPixels(extent: Extent, width: number, height: number, options?: DynamicFetchRasterOptions): Promise<PixelData>
findImages(parameters: FindImagesParameters | FindImagesParametersProperties, requestOptions?: RequestOptions): Promise<FindImagesResult>
generateRasterInfo(rasterFunction: RasterFunction | RasterFunctionProperties | null | undefined, options?: AbortOptions): Promise<RasterInfo>
getCatalogItemICSInfo(rasterId: number, options?: AbortOptions): Promise<object | undefined>
getCatalogItemRasterInfo(rasterId: number, options?: AbortOptions): Promise<RasterInfo>
getImageUrl(parameters: ImageUrlParameters | ImageUrlParametersProperties, requestOptions?: RequestOptions): Promise<ImageUrlResult>
getSamples(parameters: ImageSampleParameters | ImageSampleParametersProperties, requestOptions?: RequestOptions): Promise<ImageSampleResult>
identify(parameters: ImageIdentifyParameters | ImageIdentifyParametersProperties, requestOptions?: RequestOptions): Promise<ImageIdentifyResult>
imageToMap(parameters: ImageToMapParameters | ImageToMapMultirayParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
imageToMapMultiray(parameters: ImageToMapMultirayParameters | ImageToMapMultirayParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
mapToImage(parameters: MapToImageParameters | MapToImageParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
measureAreaAndPerimeter(parameters: ImageAreaParameters | ImageAreaParametersProperties, requestOptions?: RequestOptions): Promise<ImageAreaResult>
measureAreaFromImage(parameters: MeasureFromImageParameters, requestOptions?: RequestOptions): Promise<MeasureAreaFromImageResult>
measureDistanceAndAngle(parameters: ImageDistanceParameters | ImageDistanceParametersProperties, requestOptions?: RequestOptions): Promise<ImageDistanceResult>
measureHeight(parameters: ImageHeightParameters | ImageHeightParametersProperties, requestOptions?: RequestOptions): Promise<ImageHeightResult>
measureLengthFromImage(parameters: MeasureFromImageParameters, requestOptions?: RequestOptions): Promise<MeasureLengthFromImageResult>
measurePointOrCentroid(parameters: ImagePointParameters | ImagePointParametersProperties, requestOptions?: RequestOptions): Promise<ImagePointResult>
queryBoundary(parameters?: ImageBoundaryParameters | ImageBoundaryParametersProperties, requestOptions?: RequestOptions): Promise<ImageBoundaryResult>
queryExtent(query?: QueryProperties | null | undefined, requestOptions?: RequestOptions): Promise<{ count: number; extent: Extent | null; }>
queryGPSInfo(parameters?: ImageGPSInfoParametersProperties, requestOptions?: RequestOptions): Promise<ImageGPSInfoResult>
queryObjectIds(query?: QueryProperties | null | undefined, requestOptions?: RequestOptions): Promise<number[]>
queryRasterCount(query?: QueryProperties | null | undefined, requestOptions?: RequestOptions): Promise<number>
queryRasters(query?: QueryProperties | null | undefined, requestOptions?: RequestOptions): Promise<FeatureSet>

calculateVolume

Method
Signature
calculateVolume (parameters: ImageVolumeParameters | ImageVolumeParametersProperties, requestOptions?: RequestOptions): Promise<ImageVolumeResult>
Since
ArcGIS Maps SDK for JavaScript 4.32

Calculates volume on the elevation data for the specified ImageVolumeParameters.mosaicRule, base surface type and Polygon or Extent geometries. If no mosaic rule is provided, the default mosaic rule from the layer will be applied.

See also
Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for calculating volume.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageVolumeResult>

When resolved, ImageVolumeResult is returned containing an array of ImageVolume.

Example
const params = new ImageVolumeParameters({
geometries: [
new Extent({
xmin: 1450000,
ymin: 540000,
xmax: 1451000,
ymax: 541000,
spatialReference: new SpatialReference({ wkid: 2264 })
}),
new Extent({
xmin: 1450500,
ymin: 540000,
xmax: 1451000,
ymax: 541000,
spatialReference: new SpatialReference({ wkid: 2264 })
})],
constantZ: 1,
baseType: "constant"
});
layer.calculateVolume(params).then((result) => {
// use the returned result
console.log(result);
});

computeAngles

Method
Signature
computeAngles (parameters: ImageAngleParameters | ImageAngleParametersProperties, requestOptions?: RequestOptions): Promise<ImageAngleResult>
Since
ArcGIS Maps SDK for JavaScript 4.22

Computes the rotation angle of a ImageryLayer at a given location. This operation is supported at 10.9.1 and later.

See also
Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for computing angles.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageAngleResult>

When resolved, returns an instance of ImageAngleResult containing computed north and up angles.

computeHistograms

Method
Signature
computeHistograms (parameters: ImageHistogramParameters | ImageHistogramParametersProperties, requestOptions?: RequestOptions): Promise<ImageServiceHistogramsResult>
Since
ArcGIS Maps SDK for JavaScript 4.18

Computes histograms based on the provided ImageHistogramParameters. If a raster function and a mosaic rule are not specified, the current settings on the layer will be used. This operation is supported by an image service published with a mosaic dataset or a raster dataset at ArcGIS Server 10.4 and later. The result of this operation contains histograms computed for the given extent.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for computing histograms.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageServiceHistogramsResult>

Resolves to an object containing histogram results. See the object specification table below for details.

PropertyTypeDescription
histograms[]RasterHistogramResult containing raster histograms.
Example
// set the pixel size parameter to match the current
// resolution of the view and spatial reference
let pixelSize = {
x:view.resolution,
y:view.resolution,
spatialReference: {
wkid: view.spatialReference.wkid
}
}
// set the histogram parameters to request
// data for the current view extent and resolution
let params = new ImageHistogramParameters({
geometry: view.extent,
pixelSize: pixelSize
});
// request for histograms for the specified parameters
layer.computeHistograms(params).then(function(results){
// results are returned and process it as needed.
console.log("histograms and stats", results);
})
.catch(function(err){
console.log("err", err)
});

computePixelSpaceLocations

Method
Signature
computePixelSpaceLocations (parameters: ImagePixelLocationParameters | ImagePixelLocationParametersProperties, requestOptions?: RequestOptions): Promise<ImagePixelLocationResult>
Since
ArcGIS Maps SDK for JavaScript 4.22

Computes the corresponding pixel location in columns and rows for an image based on input geometry. Requires that the raster catalog item has a valid icsToPixel resource.

See also
Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for computing image space pixel location.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImagePixelLocationResult>

When resolved, returns an instance of ImagePixelLocationResult containing x and y values for the column and row of each input geometry.

computeStatisticsHistograms

Method
Signature
computeStatisticsHistograms (parameters: ImageHistogramParameters | ImageHistogramParametersProperties, requestOptions?: RequestOptions): Promise<ImageServiceStatisticsHistogramsResult>
Since
ArcGIS Maps SDK for JavaScript 4.18

Computes statistics and histograms for the provided ImageHistogramParameters. If a raster function and a mosaic rule are not specified, the current settings on the layer will be used. This operation is supported by an image service published with a mosaic dataset or a raster dataset at ArcGIS Server 10.4 and later.

The result of this operation contains both statistics and histograms computed for the given extent or polygon. Note that the given extent or polygon is first projected to the spatial reference of the service, then the source pixels are requested at the specified resolution for the projected geometry's extent. The statistics and histogram are then computed based on the source pixel's values.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for computing statistics and histograms.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageServiceStatisticsHistogramsResult>

Resolves to an object containing histogram and statistics results. See the object specification table below for details.

PropertyTypeDescription
histograms[]RasterHistogramResult containing raster histograms.
bandStatistics[]RasterBandStatisticsRaster band statistics.
Example
// set the pixel size parameter to match the current
// resolution of the view and spatial reference
let pixelSize = {
x:view.resolution,
y:view.resolution,
spatialReference: {
wkid: view.spatialReference.wkid
}
}
// set the histogram parameters to request
// data for the current view extent and resolution
let params = new ImageHistogramParameters({
geometry: view.extent,
pixelSize: pixelSize
});
// request for histograms and statistics for the specified parameters
layer.computeStatisticsHistograms(params).then(function(results){
// results are returned and process it as needed.
console.log("histograms and stats", results);
})
.catch(function(err){
console.log("err", err)
});

fetchPixels

Method
Signature
fetchPixels (extent: Extent, width: number, height: number, options?: DynamicFetchRasterOptions): Promise<PixelData>
Since
ArcGIS Maps SDK for JavaScript 4.33

Fetches raw pixel data for a specified extent, width, and height, preserving full pixel depth and including all bands without applying renderer to the layer. The operation uses the following layer properties: mosaicRule, rasterFunction, compressionTolerance, definitionExpression, noData, noDataInterpretation, and multidimensionalSubset.

Parameters
ParameterTypeDescriptionRequired
extent

The extent of the image to export.

width

The width of the image in pixels.

height

The height of the image in pixels.

options

The parameter options is an object with the following properties.

Returns
Promise<PixelData>

Resolves to an object containing the parameters of the exported pixels including PixelBlock. The pixelBlock contains the value of each pixel in the image.

findImages

Method
Signature
findImages (parameters: FindImagesParameters | FindImagesParametersProperties, requestOptions?: RequestOptions): Promise<FindImagesResult>
Since
ArcGIS Maps SDK for JavaScript 4.29

Finds images based on the provided FindImagesParameters. It locates all images that contain the FindImagesParameters.toGeometry value and sorts them accordingly. The FindImagesParameters.fromGeometry can be a 3D SceneView's camera position and FindImagesParameters.toGeometry is a clicked location on the map.

This operation is supported with ArcGIS Enterprise version 11.2 or higher image services.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies the find images parameters.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<FindImagesResult>

Resolves to a FindImagesResult containing images that meet the search requirements.

generateRasterInfo

Method
Signature
generateRasterInfo (rasterFunction: RasterFunction | RasterFunctionProperties | null | undefined, options?: AbortOptions): Promise<RasterInfo>
Since
ArcGIS Maps SDK for JavaScript 4.12

Generates raster info for the specified raster function.

Parameters
ParameterTypeDescriptionRequired
rasterFunction

Raster function for the requested raster info.

options

An object with the following properties.

Returns
Promise<RasterInfo>

When resolved, a RasterInfo containing info specific to the requested raster function is returned.

getCatalogItemICSInfo

Method
Signature
getCatalogItemICSInfo (rasterId: number, options?: AbortOptions): Promise<object | undefined>
Since
ArcGIS Maps SDK for JavaScript 4.13

Gets the image coordinate system information of a catalog item in an image service. The returned object can be used to set the 2D MapView's MapView.spatialReference and MapView.extent so that the image can be displayed in its original coordinate system. The image service must have a catalog capability.

See also
Parameters
ParameterTypeDescriptionRequired
rasterId

Raster catalog id.

options

An object with the following properties.

Returns
Promise<object | undefined>

When resolved, returns an object containing image coordinate system of the raster catalog item.

Example
// get image coordinate system of the specified catalog item
// for example Raster.OBJECTID = 1600
layer.getCatalogItemICSInfo(imageId).then(function(info) {
// create a spatialReference object and set its
// imageCoordinateSystem property
let sr = { // autocasts to esri/geometry/SpatialReference
imageCoordinateSystem: { id: imageId }
};
// Calculate an extent for the mapview based on the image's extent
// in its original coordinate system
const width = document.getElementById("viewDiv").getBoundingClientRect().width;
const height = document.getElementById("viewDiv").getBoundingClientRect().height;
const newExt = info.icsExtent.clone();
const scaleFactor = 5;
newExt.xmin = (newExt.xmin + newExt.xmax - width * scaleFactor) / 2;
newExt.xmax = newExt.xmin + width * scaleFactor;
newExt.ymin = (newExt.ymin + newExt.ymax - height * scaleFactor) / 2;
newExt.ymax = newExt.ymin + height * scaleFactor;
newExt.spatialReference = sr;
// set the MapView's spatialReference to the image's coordinate system
// and the extent to the extent calculated above
view = new MapView({
container: "viewDiv",
map: map,
spatialReference: sr,
extent: newExt
});
});

getCatalogItemRasterInfo

Method
Signature
getCatalogItemRasterInfo (rasterId: number, options?: AbortOptions): Promise<RasterInfo>
Since
ArcGIS Maps SDK for JavaScript 4.13

Get the raster info of a catalog item in an image service. Each raster catalog item represents a feature in the raster catalog. Each such feature has an associated raster. The image service must have a catalog capability.

Parameters
ParameterTypeDescriptionRequired
rasterId

Raster catalog id.

options

An object with the following properties.

Returns
Promise<RasterInfo>

When resolved, a RasterInfo containing info specific to the catalog item is returned.

getImageUrl

Method
Signature
getImageUrl (parameters: ImageUrlParameters | ImageUrlParametersProperties, requestOptions?: RequestOptions): Promise<ImageUrlResult>
Since
ArcGIS Maps SDK for JavaScript 4.30

Retrieves an image's url using the provided ImageUrlParameters. This operation is supported with ArcGIS Enterprise version 11.3 or higher image services.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies the image url parameters.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageUrlResult>

Resolves to a ImageUrlResult containing the image's url.

getSamples

Method
Signature
getSamples (parameters: ImageSampleParameters | ImageSampleParametersProperties, requestOptions?: RequestOptions): Promise<ImageSampleResult>
Since
ArcGIS Maps SDK for JavaScript 4.20

Returns sample point locations, pixel values and corresponding resolutions of the source data for a given geometry. When the input geometry is a Polyline, Extent, or Polygon, the sampling is based on ImageSampleParameters.sampleCount or ImageSampleParameters.sampleDistance parameters. When the geometry is a Point or Multipoint, the point or points are used directly.

The number of sample locations in the response is based on the sampleDistance or sampleCount parameter and cannot exceed the limit imposed by the image service. The sample points are located at the intersection of the provided geometry and the raster item's footprints. They are also filtered by the ImageSampleParameters.mosaicRule and ImageSampleParameters.pixelSize parameters.

Parameters
ParameterTypeDescriptionRequired
parameters

The parameters used in the getSamples operation.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageSampleResult>

When resolved, ImageSampleResult is returned containing an array of ImageSamples.

Example
// get all sample points along a polyline
// at the specified sample distance and pixel size
const param = {
geometry: polyline
returnFirstValueOnly: false,
// resolution - unit of the view's spatial reference
pixelSize: {
x:12,
y:12,
spatialReference: view.spatialReference
},
interpolation: "nearest",
// unit of the geometry's spatial reference is used
sampleDistance: 30,
outFields: ["*"]
};
imageryLayer.getSamples(param).then((results) => {
// use the getSamples results as needed.
console.log(results);
})
.catch(function(error){
console.log(error)
})

identify

Method
Signature
identify (parameters: ImageIdentifyParameters | ImageIdentifyParametersProperties, requestOptions?: RequestOptions): Promise<ImageIdentifyResult>
Since
ArcGIS Maps SDK for JavaScript 4.18

Sends a request to the ArcGIS REST image service to identify content based on the specified ImageIdentifyParameters. If a raster function and a mosaic rule are not specified, then the current layer settings will be used.

Parameters
ParameterTypeDescriptionRequired
parameters

The identify parameters used in the identify operation.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageIdentifyResult>

When resolved, a ImageIdentifyResult is returned.

imageToMap

Method
Signature
imageToMap (parameters: ImageToMapParameters | ImageToMapMultirayParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
Since
ArcGIS Maps SDK for JavaScript 4.29

Converts a geometry from an image space to a map space using the provided ImageToMapParameters. This operation is supported with ArcGIS Enterprise version 11.2 or higher image services.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies the image to map parameters.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<GeometryUnion>

Resolves to a geometry object.

imageToMapMultiray

Method
Signature
imageToMapMultiray (parameters: ImageToMapMultirayParameters | ImageToMapMultirayParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
Since
ArcGIS Maps SDK for JavaScript 4.29

Creates a map space geometry from multiray image space geometries using the provided ImageToMapMultirayParameters. For example, a house is shown in several raster items. Users can specify the house location on each image using the ImageToMapMultirayParameters.geometries parameter. Then in the ImageToMapMultirayParameters.rasterIds parameter, specify the rasterIds of the images in the same order as the geometries. The imageToMapMultiray method will find and return the house location in the map space on all specified images.

This operation is supported with ArcGIS Enterprise version 11.2 or higher image services.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies the image to map multiray parameters.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<GeometryUnion>

Resolves to a geometry object where the coordinates are in map coordinates.

mapToImage

Method
Signature
mapToImage (parameters: MapToImageParameters | MapToImageParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
Since
ArcGIS Maps SDK for JavaScript 4.29

Converts a given geometry from a map space to an image space using the provided MapToImageParameters. This operation is supported with ArcGIS Enterprise version 11.2 or higher image services.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies the map to image parameters.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<GeometryUnion>

Resolves to a geometry object where the coordinates are in image space.

measureAreaAndPerimeter

Method
Signature
measureAreaAndPerimeter (parameters: ImageAreaParameters | ImageAreaParametersProperties, requestOptions?: RequestOptions): Promise<ImageAreaResult>
Since
ArcGIS Maps SDK for JavaScript 4.26

Calculates the area and perimeter of a given geometry on an image service. The result of this operation includes the name of the raster dataset being used, the sensor name, and measured values.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for measuring the area and perimeter for a given geometry on an image service.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageAreaResult>

When resolved, returns an instance of ImageAreaResult containing the name of the raster dataset being used, the sensor name, and measured values.

Example
// calculate an area and perimeter of an image visible in the view
const params = new ImageAreaParameters({
geometry: view.extent,
areaUnit: "square-kilometers",
linearUnit: "kilometers"
});
layer.measureAreaAndPerimeter(params).then((result)=>{
// use the area and perimeter measure values
console.log(result);
});

measureAreaFromImage

Method
Signature
measureAreaFromImage (parameters: MeasureFromImageParameters, requestOptions?: RequestOptions): Promise<MeasureAreaFromImageResult>
Since
ArcGIS Maps SDK for JavaScript 4.29

Measures the area and the perimeter of a polygon in an image space on a selected raster when the following conditions are met:

  • Image service must be published from a mosaic dataset.
  • Raster items in the mosaic dataset must have 3D transformation (e.g. mosaic dataset built with UAV raster type).
Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for measuring the area and the perimeter.

requestOptions

Additional options to be used for the data request.

Returns
Promise<MeasureAreaFromImageResult>

When resolved, returns an instance of MeasureAreaFromImageResult containing the polygon's geometry in a map space, and its length, area and center.

measureDistanceAndAngle

Method
Signature
measureDistanceAndAngle (parameters: ImageDistanceParameters | ImageDistanceParametersProperties, requestOptions?: RequestOptions): Promise<ImageDistanceResult>
Since
ArcGIS Maps SDK for JavaScript 4.26

Calculates the distance and angle between two points on an image service. The result of this operation includes the name of the raster dataset being used, the sensor name, and measured values.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for measuring the distance and angle between two points on an image service.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageDistanceResult>

When resolved, returns an instance of ImageDistanceResult containing the name of the raster dataset being used, the sensor name, and measured values.

measureHeight

Method
Signature
measureHeight (parameters: ImageHeightParameters | ImageHeightParametersProperties, requestOptions?: RequestOptions): Promise<ImageHeightResult>
Since
ArcGIS Maps SDK for JavaScript 4.26

Calculates the height of an object between two points on an image service if the sensor info is available. The result of this operation includes the name of the raster dataset being used, the sensor name, and measured values. See the ImageHeightParameters.operationType documentation for types of height measurements.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for measuring the height of an object between two points on an image service.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageHeightResult>

When resolved, returns an instance of ImageHeightResult containing the name of the raster dataset being used, the sensor name, and measured values.

measureLengthFromImage

Method
Signature
measureLengthFromImage (parameters: MeasureFromImageParameters, requestOptions?: RequestOptions): Promise<MeasureLengthFromImageResult>
Since
ArcGIS Maps SDK for JavaScript 4.29

Measures the length of a polyline in an image space on a selected raster when the following conditions are met:

  • Image service must be published from a mosaic dataset.
  • Raster items in the mosaic dataset must have 3D transformation (e.g. mosaic dataset built with UAV raster type).
Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for measuring the length of a polyline.

requestOptions

Additional options to be used for the data request.

Returns
Promise<MeasureLengthFromImageResult>

When resolved, returns an instance of MeasureLengthFromImageResult containing the Polyline in a map space and its length.

measurePointOrCentroid

Method
Signature
measurePointOrCentroid (parameters: ImagePointParameters | ImagePointParametersProperties, requestOptions?: RequestOptions): Promise<ImagePointResult>
Since
ArcGIS Maps SDK for JavaScript 4.26

Returns the location for a given point or centroid of a given area on an image service.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies parameters for determining a point location or a centroid of a given area on the image service.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImagePointResult>

When resolved, returns an instance of ImagePointResult containing the name of the raster dataset being used, the sensor name, and measured values.

queryBoundary

Method
Signature
queryBoundary (parameters?: ImageBoundaryParameters | ImageBoundaryParametersProperties, requestOptions?: RequestOptions): Promise<ImageBoundaryResult>
Since
ArcGIS Maps SDK for JavaScript 4.29

Returns the boundary of an image for the provided ImageBoundaryParameters. This operation is supported with ArcGIS Enterprise version 10.6 or higher image services.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies the imagery boundary parameters.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageBoundaryResult>

Resolves to an object containing boundary geometry of an image service.

queryExtent

Method
Signature
queryExtent (query?: QueryProperties | null | undefined, requestOptions?: RequestOptions): Promise<{ count: number; extent: Extent | null; }>
Since
ArcGIS Maps SDK for JavaScript 5.0

Executes a Query against the image service and returns the Extent of rasters that satisfy the query.

Parameters
ParameterTypeDescriptionRequired
query

Specifies the attributes and spatial filter of the query. If no parameters are specified, then the extent and count of all rasters satisfying the layer's configuration/filters are returned.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<{ count: number; extent: Extent | null; }>

When resolved, returns the extent and count of the rasters that satisfy the input query. See the object specification table below for details.

PropertyTypeDescription
countNumberThe number of rasters that satisfy the input query.
extentExtent | nullThe extent of the rasters that satisfy the query.
Example
// Queries for the extent of all images matching the layer's configurations
// e.g. definitionExpression
layer.queryExtent().then(function(results){
// go to the extent of the results satisfying the query
view.goTo(results.extent);
});

queryGPSInfo

Method
Signature
queryGPSInfo (parameters?: ImageGPSInfoParametersProperties, requestOptions?: RequestOptions): Promise<ImageGPSInfoResult>
Since
ArcGIS Maps SDK for JavaScript 4.29

Returns GPS information for the provided ImageGPSInfoParameters. It returns information about cameras, GPS locations when the image was taken, and exterior orientation information of each image.

This operation is supported with ArcGIS Enterprise version 11.2 or higher image services.

Parameters
ParameterTypeDescriptionRequired
parameters

Specifies the parameters for query GPS info operation.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<ImageGPSInfoResult>

Resolves to an object containing information about images and cameras.

queryObjectIds

Method
Signature
queryObjectIds (query?: QueryProperties | null | undefined, requestOptions?: RequestOptions): Promise<number[]>
Since
ArcGIS Maps SDK for JavaScript 4.21

Executes a Query against the image service and returns an array of Object IDs for the rasters.

Parameters
ParameterTypeDescriptionRequired
query

Specifies the query parameters. If no parameters are specified, then all Object IDs satisfying the layer's configuration/filters are returned.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<number[]>

When resolved, returns an array of numbers representing the object IDs of the rasters satisfying the query.

queryRasterCount

Method
Signature
queryRasterCount (query?: QueryProperties | null | undefined, requestOptions?: RequestOptions): Promise<number>
Since
ArcGIS Maps SDK for JavaScript 4.21

Executes a Query against the image service and returns the number of rasters that satisfy the query.

Parameters
ParameterTypeDescriptionRequired
query

Specifies the query parameters. If no parameters are specified, then count of all rasters satisfying the layer's configuration/filters are returned.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<number>

When resolved, returns the number of rasters satisfying the query.

Example
const query = new Query({
where: "LowPS <= 30"
});
layer.queryRasterCount(query).then(function(result){
// use the count of rasters
console.log("queryRasterCount", result)
});

queryRasters

Method
Signature
queryRasters (query?: QueryProperties | null | undefined, requestOptions?: RequestOptions): Promise<FeatureSet>
Since
ArcGIS Maps SDK for JavaScript 4.18

Executes a Query against an image service and returns a FeatureSet once the promise resolves. A FeatureSet contains an array of Graphic features.

Parameters
ParameterTypeDescriptionRequired
query

Specifies the query parameters. If no parameters are specified, then all features satisfying the layer's configuration/filters are returned.

requestOptions

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns
Promise<FeatureSet>

When resolved, a FeatureSet containing an array of graphics is returned.

Example
let params = new Query({
// Define query parameters here
});
layer.queryRasters(params).then(function(response){
// The response is a FeatureSet if results are found
});

Type definitions

SourceType

Type definition
Type
"mosaic-dataset" | "raster-dataset"

ImageryMensurationCapabilities

Type definition

supportsDistanceAndAngle

Property
Type
boolean

Indicates if the layer supports distance and angle mensuration operation.

supportsAreaAndPerimeter

Property
Type
boolean

Indicates if the layer supports area and perimeter mensuration operation.

supportsPointOrCentroid

Property
Type
boolean

Indicates if the layer supports point or centroid mensuration operations.

supportsHeightFromBaseAndTop

Property
Type
boolean

Indicates if the layer supports a mensuration operation for calculating a height of a ground feature by measuring from the base of the object to the top of the object.

supportsHeightFromBaseAndTopShadow

Property
Type
boolean

Indicates if the layer supports a mensuration operation for calculating a height of a feature by measuring from the base of the object to the top of the object's shadow on the ground.

supportsHeightFromTopAndTopShadow

Property
Type
boolean

Indicates if the layer supports mensuration operation for calculating a height from the top of the object to the top of the objects's shadow on the ground.

supports3D

Property
Type
boolean

Indicates if the layer supports 3D mensuration operations.

ImageryLayerCapabilities

Type definition

operations

Property
Type
ImageryLayerOperations

Describes operations supported by the ImageryLayer.

query

Property
Type
QueryCapabilities

Describes Query operations supported by the layer. Use the query to query an imagery layer.

mensuration

Property
Type
ImageryMensurationCapabilities

Describes mensuration operations supported by the ImageryLayer. Added since ArcGIS Maps SDK for JavaScript 4.26.

ImageryLayerOperations

Type definition

supportsComputeHistograms

Property
Type
boolean

Indicates if the layer supports a compute histograms operation from an area of interest.

supportsExportImage

Property
Type
boolean

Indicates if the layer supports an export image operation based on a bounding box.

supportsIdentify

Property
Type
boolean

Indicates if the layer supports an identify() operation on pixel values.

supportsImageToMap

Property
Type
boolean

Indicates if the layer supports image to map operation.

supportsImageToMapMultiray

Property
Type
boolean

Indicates if the layer supports image to map multiray operation.

supportsMapToImage

Property
Type
boolean

Indicates if the layer supports map to image operation.

supportsMeasure

Property
Type
boolean

Indicates if the layer supports mensuration.

supportsDownload

Property
Type
boolean

Indicates if the layer allows the source image to be downloaded.

supportsQuery

Property
Type
boolean

Indicates if the layer supports an operation to query images.

supportsFindImages

Property
Type
boolean

Indicates if the layer supports find images operation.

supportsGetImageUrl

Property
Type
boolean

Indicates if the layer supports get image url operation.

supportsGetSamples

Property
Type
boolean

Indicates if the layer supports a sampling operation.

supportsProject

Property
Type
boolean

Indicates if the layer supports projection of geometries, including from/to image spatial reference.

supportsComputeStatisticsHistograms

Property
Type
boolean

Indicates if the layer supports an operation computing statistics and histograms from an area of interest.

supportsQueryBoundary

Property
Type
boolean

Indicates if the layer supports an operation to query the service's boundary.

supportsCalculateVolume

Property
Type
boolean

Indicates if the elevation layer supports an operation to compute volumes.

supportsComputePixelLocation

Property
Type
boolean

Indicates if the layer supports computing pixel location in pixel space.

supportsQueryGPSInfo

Property
Type
boolean

Indicates if the layer supports an operation to query the service's gps info.

PixelFilterFunction

Type definition

Function definition for the ImageryLayer.pixelFilter property. See the example snippet in the ImageryLayer.pixelFilter documentation for more details.

Parameters
ParameterTypeDescriptionRequired
pixelData

An object that provides the user access to PixelBlock.pixels in and their values in the layer.

Returns
void