Skip to main content

ImageService

Dynamic raster imagery from ArcGIS Image Services with server-side rendering rules, temporal filtering, and pixel-level analysis.

Live Demo

Interactive demo showing dynamic raster imagery with rendering rule controls for different visualization styles.

Quick Start

npm install esri-gl maplibre-gl
import { ImageService } from 'esri-gl';

const service = new ImageService('landsat-source', map, {
url: 'https://landsat2.arcgis.com/arcgis/rest/services/Landsat/MS/ImageServer',
format: 'jpg'
});

map.addLayer({
id: 'landsat-layer',
type: 'raster',
source: 'landsat-source'
});

Constructor

new ImageService(id, map, esriServiceOptions, rasterSourceOptions?)
ParameterTypeDescription
idstringUnique source ID for MapLibre
mapMapMapLibre map instance
esriServiceOptionsobjectService configuration (see below)
rasterSourceOptionsobjectOptional MapLibre raster source overrides

Options (esriServiceOptions)

OptionTypeDefaultDescription
urlstringrequiredArcGIS ImageServer URL
renderingRuleobjectServer-side rendering rule
mosaicRuleobjectMosaic rule for image selection
formatstring'jpgpng'Output format ('jpg', 'png', 'jpgpng', etc.)
interpolationstringResampling interpolation method
compressionQualitynumberJPEG compression quality (0-100)
bandIdsArray<number>Band combination (e.g., [3, 2, 1])
pixelTypestringOutput pixel type
noDatanumberNoData value for transparency
tokenstringArcGIS authentication token
fetchOptionsobjectCustom fetch options (headers, etc.)

Methods

MethodReturnsDescription
identify(lngLat, options?)Promise<IdentifyResponse>Returns pixel values and catalog info at a location
setRenderingRule(rule)voidApplies a new rendering rule and refreshes tiles
setMosaicRule(rule)voidApplies a new mosaic rule and refreshes tiles
setToken(token)voidUpdates the authentication token

Examples

Rendering Rules

service.setRenderingRule({ rasterFunction: 'Natural Color' });
service.setRenderingRule({ rasterFunction: 'Color Infrared' });
service.setRenderingRule({}); // Reset to default

Temporal Filtering

const service = new ImageService('temporal-source', map, {
url: 'https://your-server.com/ImageServer',
time: [new Date('2023-01-01'), new Date('2023-12-31')]
});

Identify Pixels

const results = await service.identify({ lng: -95, lat: 37 }, map);
console.log(results.pixel); // Pixel values
console.log(results.catalog); // Raster catalog info

Layer Opacity

map.setPaintProperty('landsat-layer', 'raster-opacity', 0.6);