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
| Property | Type | Class |
|---|---|---|
| | ||
capabilities readonly | | |
| | ||
| | ||
| | ||
defaultMosaicRule readonly | MosaicRule | null | undefined | |
| | ||
fields readonly | Field[] | |
fieldsIndex readonly | FieldsIndex<Field> | null | undefined | |
| | ||
hasMultidimensions readonly | | |
| | ||
| | ||
| | ||
| | ||
multidimensionalInfo readonly | | |
| | ||
| | ||
| | ||
objectIdField readonly | | |
| | ||
| | ||
rasterFields readonly | Field[] | |
| | ||
rasterFunctionInfos readonly | | |
| | ||
serviceRasterInfo readonly | | |
| | ||
sourceType readonly | | |
spatialReference readonly | | |
| | ||
version readonly | |
bandIds
- 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.
compressionQuality
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
- 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
defaultMosaicRule
- Type
- MosaicRule | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 4.28
Default mosaic rule of the image service.
definitionExpression
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
- 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
- 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-insensitiveconst fieldsIndex = layer.fieldsIndex.get("OBjecTID");
// if there's a field by that name, print it to the consoleif (fieldsIndex) { console.log("fieldsIndex: ", fieldsIndex);} hasMultidimensions
- Type
- boolean
Indicates if the layer has multidimensionalInfo.
- Default value
- false
imageMaxHeight
- 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
- 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
- Type
- RasterInterpolation
- Since
- ArcGIS Maps SDK for JavaScript 4.12
Defines how to interpolate pixel values.
multidimensionalInfo
- 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.
multidimensionalSubset
- 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.
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; noDataInterpretation
- Type
- RasterNoDataInterpretation | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 4.12
Interpretation of the noData setting.
| Value | Description |
|---|---|
| any | Pixel is transparent if any band matches noData value. |
| all | Pixel is transparent only if all bands match noData value. |
pixelFilter
- 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
- Type
- RasterPixelType | null | undefined
Raster source pixel type.
| Value | Range of values that each cell can contain |
|---|---|
| unknown | Pixel type is unknown |
| s8 | -128 to 127 |
| s16 | -32768 to 32767 |
| s32 | -2147483648 to 2147483647 |
| u8 | 0 to 255 |
| u16 | 0 to 65535 |
| u32 | 0 to 4294967295 |
| f32 | -3.402823466e+38 to 3.402823466e+38 |
| f64 | 0 to 18446744073709551616 |
rasterFields
- 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
- 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.
Examples
// apply NDVI and colormap raster function to an imagery layer// use rasterFunctionUtils convenience methods to create raster functionsconst 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
- 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
- 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.
serviceRasterInfo
- 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
- 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
- Type
- SourceType
- Since
- ArcGIS Maps SDK for JavaScript 4.28
Image service data source type.
spatialReference
- Type
- SpatialReference
The spatial reference of the image service.
url
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 Servicelet layer = new ImageryLayer({ url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/CharlotteLAS/ImageServer"}); version
- 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.3console.log(layer.version);Methods
| Method | Signature | Class |
|---|---|---|
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
- 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.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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.
Property Type Description histograms[] RasterHistogram Result containing raster histograms.
Example
// set the pixel size parameter to match the current// resolution of the view and spatial referencelet 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 resolutionlet params = new ImageHistogramParameters({ geometry: view.extent, pixelSize: pixelSize});
// request for histograms for the specified parameterslayer.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
- 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.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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.
Property Type Description histograms[] RasterHistogram Result containing raster histograms. bandStatistics[] RasterBandStatistics Raster band statistics.
Example
// set the pixel size parameter to match the current// resolution of the view and spatial referencelet 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 resolutionlet params = new ImageHistogramParameters({ geometry: view.extent, pixelSize: pixelSize});
// request for histograms and statistics for the specified parameterslayer.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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
pixelBlockcontains the value of each pixel in the image.
findImages
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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 = 1600layer.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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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 sizeconst 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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 viewconst 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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.
Property Type Description count Number The number of rasters that satisfy the input query. extent Extent | null The extent of the rasters that satisfy the query.
Example
// Queries for the extent of all images matching the layer's configurations// e.g. definitionExpressionlayer.queryExtent().then(function(results){ // go to the extent of the results satisfying the query view.goTo(results.extent);}); queryGPSInfo
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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). | |
queryRasterCount
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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). | |
Example
const query = new Query({ where: "LowPS <= 30"});
layer.queryRasterCount(query).then(function(result){ // use the count of rasters console.log("queryRasterCount", result)}); queryRasters
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
ImageryMensurationCapabilities
supportsDistanceAndAngle
- Type
- boolean
Indicates if the layer supports distance and angle mensuration operation.
supportsAreaAndPerimeter
- Type
- boolean
Indicates if the layer supports area and perimeter mensuration operation.
supportsPointOrCentroid
- Type
- boolean
Indicates if the layer supports point or centroid mensuration operations.
supportsHeightFromBaseAndTop
- 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
- 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
- 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.
ImageryLayerCapabilities
query
- Type
- QueryCapabilities
mensuration
Describes mensuration operations supported by the ImageryLayer. Added since ArcGIS Maps SDK for JavaScript 4.26.
ImageryLayerOperations
- Supertypes
- OperationCapabilities
supportsComputeHistograms
- Type
- boolean
Indicates if the layer supports a compute histograms operation from an area of interest.
supportsExportImage
- Type
- boolean
Indicates if the layer supports an export image operation based on a bounding box.
supportsIdentify
- Type
- boolean
Indicates if the layer supports an identify() operation on pixel values.
supportsImageToMapMultiray
- Type
- boolean
Indicates if the layer supports image to map multiray operation.
supportsDownload
- Type
- boolean
Indicates if the layer allows the source image to be downloaded.
supportsProject
- Type
- boolean
Indicates if the layer supports projection of geometries, including from/to image spatial reference.
supportsComputeStatisticsHistograms
- Type
- boolean
Indicates if the layer supports an operation computing statistics and histograms from an area of interest.
supportsQueryBoundary
- Type
- boolean
Indicates if the layer supports an operation to query the service's boundary.
supportsCalculateVolume
- Type
- boolean
Indicates if the elevation layer supports an operation to compute volumes.
supportsComputePixelLocation
- Type
- boolean
Indicates if the layer supports computing pixel location in pixel space.
supportsQueryGPSInfo
- Type
- boolean
Indicates if the layer supports an operation to query the service's gps info.
PixelFilterFunction
Function definition for the ImageryLayer.pixelFilter property. See the example snippet in the ImageryLayer.pixelFilter documentation for more details.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| pixelData | An object that provides the user access to PixelBlock.pixels in and their values in the layer. | |
- Returns
- void