Skip to main content

IdentifyImage

Query pixel values from ArcGIS Image Services at specific geographic locations. Useful for extracting elevation, temperature, precipitation, and other raster data.

Interactive Demo​

Click anywhere on the map to query image pixel values. Use the service dropdown to switch between datasets.

Constructor​

new IdentifyImage(urlOrOptions: string | IdentifyImageOptions)
identifyImage(urlOrOptions: string | IdentifyImageOptions) // convenience factory

Options​

OptionTypeDefaultDescription
urlstringRequired. Image Service URL
geometryobjectLocation to identify (usually set with .at())
geometryTypestring'esriGeometryPoint'Type of the input geometry
srstring | number4326Spatial reference of the input/output geometry
mosaicbooleanIdentify against the mosaicked image rather than each raster
renderingRulesobject[]Rendering rules applied to the identify
pixelSize[number, number]Pixel size / resolution of the identify
returnGeometrybooleanfalseInclude geometry in results
returnCatalogItemsbooleanfalseInclude catalog items in results
fstring'json'Response format
tokenstringAuthentication token
apiKeystringArcGIS Location Platform API key
authenticationIAuthenticationManager | stringArcGIS REST JS auth manager (guide)

Chainable Methods​

MethodParameterDescription
.at(lngLat){lng, lat} or [lng, lat]Set the geographic location to query
.geometry(geometry, type?)object, stringSet a custom geometry (default type 'esriGeometryPoint')
.pixelSize(size)[number, number] or {x, y}Set pixel size / resolution
.renderingRule(rule)objectApply a rendering rule for processing
.mosaicRule(rule)objectApply a mosaic rule for multi-temporal data
.returnGeometry(include)booleanInclude geometry in results
.returnCatalogItems(include)booleanInclude catalog items in results
.token(authToken)stringSet authentication token

Every method above returns the task for chaining — the request is only sent by an execution method.

Execution Methods​

.run() → Promise<IdentifyImageResponse>​

Execute the identify request. Returns a promise with the response:

interface IdentifyImageResponse {
results: Array<{
objectId?: number;
name?: string;
value?: string;
attributes?: Record<string, unknown>;
catalogItems?: unknown[];
}>;
location?: {
x: number;
y: number;
spatialReference?: { wkid: number; latestWkid?: number };
};
}

Services that answer with a bare value / values payload are normalised into the same results shape.

.getPixelValues() → Promise<Array<string | number | null>>​

Run the identify and return just the pixel values, coerced to numbers where possible.

.getPixelData() → Promise<IdentifyImageResult[]>​

Run the identify and return only the results array.

Examples​

Basic Elevation Query​

import { identifyImage } from 'esri-gl';

const result = await identifyImage({
url: 'https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer'
})
.at({ lng: -118.2437, lat: 34.0522 })
.run();

console.log(`Elevation: ${result.results[0].value} meters`);

Multi-band Image Analysis​

const satelliteTask = new IdentifyImage({
url: 'https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer'
});

const spectralData = await satelliteTask
.at([-122.4194, 37.7749])
.renderingRule({ rasterFunction: 'None' })
.run();

console.log('Spectral bands:', spectralData.results[0]?.value);