Skip to content
import { computeAngles, computePixelSpaceLocations, computeStatisticsHistograms, computeHistograms, getSamples } from "@arcgis/core/rest/imageService.js";
Since
ArcGIS Maps SDK for JavaScript 4.19

Performs various operations on an image service resource:

Identify the content of an image service for the input location and mosaic rule. Compute histograms based on the provided ImageHistogramParameters. Compute statistics and histograms for the provided ImageHistogramParameters.

Type definitions

ImageServiceHistogramsResult

Type definition

Result from computeHistograms() containing raster histograms.

See also

histograms

Property
Type
RasterHistogram[]

Result containing raster histograms.

ImageServiceStatisticsHistogramsResult

Type definition

Result from computeStatisticsHistograms() containing raster histograms.

See also

statistics

Property
Type
RasterBandStatistics[]

Result containing raster histograms.

histograms

Property
Type
RasterHistogram[]

Raster band statistics.

Functions

computeAngles

Function
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
Signature
computeAngles (url: string, parameters: ImageAngleParameters | ImageAngleParametersProperties, requestOptions?: RequestOptions): Promise<ImageAngleResult>
Parameters
ParameterTypeDescriptionRequired
url

URL to the ArcGIS Server REST resource that represents an image service.

parameters

Specifies parameters for computing angles.

requestOptions

Additional options to be used for the data request.

Returns
Promise<ImageAngleResult>

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

computePixelSpaceLocations

Function
Since
ArcGIS Maps SDK for JavaScript 4.22

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

See also
Signature
computePixelSpaceLocations (url: string, parameters: ImagePixelLocationParameters | ImagePixelLocationParametersProperties, requestOptions?: RequestOptions): Promise<ImagePixelLocationResult>
Parameters
ParameterTypeDescriptionRequired
url

URL to the ArcGIS Server REST resource that represents an image service.

parameters

Specifies parameters for computing image space pixel location.

requestOptions

Additional options to be used for the data request.

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

Function

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.

Signature
computeStatisticsHistograms (url: string, parameters: ImageHistogramParameters | ImageHistogramParametersProperties, requestOptions?: RequestOptions): Promise<ImageServiceStatisticsHistogramsResult>
Parameters
ParameterTypeDescriptionRequired
url

URL to the ArcGIS Server REST resource that represents an image service.

parameters

Specifies parameters for computing statistics and histograms.

requestOptions

Additional options to be used for the data request.

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.

computeHistograms

Function

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.

Signature
computeHistograms (url: string, parameters: ImageHistogramParameters | ImageHistogramParametersProperties, requestOptions?: RequestOptions): Promise<ImageServiceHistogramsResult>
Parameters
ParameterTypeDescriptionRequired
url

URL to the ArcGIS Server REST resource that represents an image service.

parameters

Specifies parameters for computing histograms.

requestOptions

Additional options to be used for the data request.

Returns
Promise<ImageServiceHistogramsResult>

getSamples

Function
Since
ArcGIS Maps SDK for JavaScript 4.23

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.

Signature
getSamples (url: string, parameters: ImageSampleParameters | ImageSampleParametersProperties, requestOptions?: RequestOptions): Promise<ImageSampleResult>
Parameters
ParameterTypeDescriptionRequired
url

URL to the ArcGIS Server REST resource that represents an image service.

parameters

The parameters used in the getSamples operation.

requestOptions

Additional options to be used for the data request.

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: ["*"]
};
imageService.getSamples(url, param).then((results) => {
// use the getSamples results as needed.
console.log(results);
})
.catch(function(error){
console.log(error)
})

identify

Function

Sends a request to the ArcGIS REST image service resource to identify content based on the ImageIdentifyParameters specified in the parameters argument.

Signature
identify (url: string, parameters: ImageIdentifyParameters | ImageIdentifyParametersProperties, requestOptions?: RequestOptions): Promise<ImageIdentifyResult>
Parameters
ParameterTypeDescriptionRequired
url

URL to the ArcGIS Server REST resource that represents an image service.

parameters

Specifies the criteria used to identify the features.

requestOptions

Additional options to be used for the data request.

Returns
Promise<ImageIdentifyResult>

When resolved, returns an instance of ImageIdentifyResult.

measureHeight

Function
Since
ArcGIS Maps SDK for JavaScript 4.26

Calculates the height of an object 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. See the ImageHeightParameters.operationType documentation for types of height measurements.

Signature
measureHeight (url: string, parameters: ImageHeightParameters | ImageHeightParametersProperties, requestOptions?: RequestOptions): Promise<ImageHeightResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the height measurement on.

parameters

Specifies the 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.

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.

measureAreaAndPerimeter

Function
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.

Signature
measureAreaAndPerimeter (url: string, parameters: ImageAreaParameters | ImageAreaParametersProperties, requestOptions?: RequestOptions): Promise<ImageAreaResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the area and perimeter measurement on.

parameters

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

requestOptions

Additional options to be used for the data request.

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.

measurePointOrCentroid

Function
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.

Signature
measurePointOrCentroid (url: string, parameters: ImagePointParameters | ImagePointParametersProperties, requestOptions?: RequestOptions): Promise<ImagePointResult>
Parameters
ParameterTypeDescriptionRequired
url

The service url.

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.

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.

measureDistanceAndAngle

Function
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.

Signature
measureDistanceAndAngle (url: string, parameters: ImageDistanceParameters | ImageDistanceParametersProperties, requestOptions?: RequestOptions): Promise<ImageDistanceResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the distance and angle measurement on.

parameters

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

requestOptions

Additional options to be used for the data request.

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.

measureLengthFromImage

Function
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).
Signature
measureLengthFromImage (url: string, parameters: MeasureFromImageParameters | MeasureFromImageParametersProperties, requestOptions?: RequestOptions): Promise<MeasureLengthFromImageResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the measurement on.

parameters

Specifies parameters for measuring the length.

requestOptions

Additional options to be used for the data request.

Returns
Promise<MeasureLengthFromImageResult>

When resolved, returns an instance of MeasureLengthFromImageResult containing the name of the polyline's shape in map space and its length.

measureAreaFromImage

Function
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).
Signature
measureAreaFromImage (url: string, parameters: MeasureFromImageParameters | MeasureFromImageParametersProperties, requestOptions?: RequestOptions): Promise<MeasureAreaFromImageResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the height measurement on.

parameters

Specifies the parameters for measuring the area.

requestOptions

Additional options to be used for the data request.

Returns
Promise<MeasureAreaFromImageResult>

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

queryBoundary

Function
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.

Signature
queryBoundary (url: string, parameters: ImageBoundaryParameters | ImageBoundaryParametersProperties, requestOptions?: RequestOptions): Promise<ImageBoundaryResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to query the boundary for.

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 the image service.

queryGPSInfo

Function
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.

Signature
queryGPSInfo (url: string, parameters: ImageGPSInfoParameters | ImageGPSInfoParametersProperties, requestOptions?: RequestOptions): Promise<ImageGPSInfoResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to query GPS information from.

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.

imageToMap

Function
Since
ArcGIS Maps SDK for JavaScript 4.29

Convert 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.

Signature
imageToMap (url: string, parameters: ImageToMapParameters | ImageToMapParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the image to map operation on.

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

Function
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 operation 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.

Signature
imageToMapMultiray (url: string, parameters: ImageToMapMultirayParameters | ImageToMapMultirayParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the image to map multiray operation on.

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 in map coordinates.

mapToImage

Function
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.

Signature
mapToImage (url: string, parameters: MapToImageParameters | MapToImageParametersProperties, requestOptions?: RequestOptions): Promise<GeometryUnion>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the map to image operation on.

parameters

Specifies the map to image parameters.

requestOptions

Additional options to be used for the data request.

Returns
Promise<GeometryUnion>

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

getImageUrl

Function
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.

Signature
getImageUrl (url: string, parameters: ImageUrlParameters | ImageUrlParametersProperties, requestOptions?: RequestOptions): Promise<ImageUrlResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the get image url operation on.

parameters

Specifies the image url parameters.

requestOptions

Additional options to be used for the data request.

Returns
Promise<ImageUrlResult>

Resolves to a ImageUrlResult containing the image's url.

findImages

Function
Since
ArcGIS Maps SDK for JavaScript 4.29

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

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

Signature
findImages (url: string, parameters: FindImagesParameters | FindImagesParametersProperties, requestOptions?: RequestOptions): Promise<FindImagesResult>
Parameters
ParameterTypeDescriptionRequired
url

The url of the image service to perform the find images operation on.

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 met the search requirements.