Skip to main content

Services Overview

esri-gl provides service classes that integrate Esri ArcGIS REST services with MapLibre GL JS and Mapbox GL JS.

Architecture

Service-Source Pattern

Services create MapLibre/Mapbox GL sources and manage their lifecycle:

const service = new DynamicMapService('source-id', map, { url: '...' })
map.addLayer({ id: 'layer-id', type: 'raster', source: 'source-id' })

Universal Constructor

All services follow this signature:

new ServiceClass(sourceId: string, map: Map, esriOptions: Options, sourceOptions?: SourceOptions)

Service Comparison

ServiceData TypePerformanceCustomizationBest For
DynamicMapServiceServer rasterModerateFullInteractive layers, real-time data
TiledMapServiceCached rasterExcellentLimitedBasemaps, reference layers
ImageServiceAnalytical rasterVariableFullSatellite imagery, elevation
FeatureServiceGeoJSON / Vector tilesGoodFullEditable features, client-side styling
VectorTileServiceVector tilesExcellentFullLarge vector datasets
VectorBasemapStyleStyle definitionExcellentThemedProfessional basemaps

Common Patterns

Service Lifecycle

// Create
const service = new DynamicMapService('my-source', map, { url: '...' });
map.addLayer({ id: 'my-layer', type: 'raster', source: 'my-source' });

// Update
service.setLayerDefs({ 0: 'NEW_FILTER = 1' });

// Remove
service.remove();

Task-Based Operations

Services support identify and query operations:

// Identify at a click location
const results = await dynamicService.identify(e.lngLat, true);

// Standalone task with chaining
const results = await new IdentifyFeatures({ url: '...' })
.at({ lng: -95, lat: 37 })
.on(map)
.layers('visible:0,1,2')
.tolerance(5)
.run();

See individual service pages for detailed documentation, live demos, and examples.