Skip to main content

VectorTileService

High-performance vector tiles from ArcGIS Vector Tile Services. Crisp rendering at all zoom levels, client-side styling, and queryable features.

Live Demo

Interactive demo showing scalable vector tiles with dynamic layer addition and removal controls.

Quick Start

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

const service = new VectorTileService('parcels-source', map, {
url: 'https://vectortileservices3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Santa_Monica_Mountains_Parcels_VTL/VectorTileServer'
});

const style = await service.getStyle();
map.addLayer({
id: 'parcels-layer',
type: style.type,
source: 'parcels-source',
'source-layer': style['source-layer'],
paint: style.paint
});

Constructor

new VectorTileService(id, map, esriServiceOptions, vectorSourceOptions?)
ParameterTypeDescription
idstringUnique source ID for MapLibre
mapMapMapLibre map instance
esriServiceOptionsobjectService configuration (see below)
vectorSourceOptionsobjectOptional MapLibre vector source overrides (see below)

Service Options (esriServiceOptions)

OptionTypeDefaultDescription
urlstringrequiredArcGIS VectorTileServer URL
tokenstringArcGIS authentication token
fetchOptionsobjectCustom fetch options (headers, etc.)

Vector Source Options (vectorSourceOptions)

OptionTypeDefaultDescription
minzoomnumber0Minimum zoom level
maxzoomnumber22Maximum zoom level
attributionstringCustom attribution text

Examples

Custom Styling

map.addLayer({
id: 'custom-parcels',
type: 'fill',
source: 'parcels-source',
'source-layer': 'Santa_Monica_Mountains_Parcels',
paint: {
'fill-color': '#ff6b6b',
'fill-opacity': 0.7,
'fill-outline-color': '#fff'
}
});

Feature Queries

map.on('click', 'parcels-layer', (e) => {
const features = map.queryRenderedFeatures(e.point, {
layers: ['parcels-layer']
});

if (features.length > 0) {
console.log('Feature properties:', features[0].properties);
}
});

Style Updates

map.setPaintProperty('parcels-layer', 'fill-color', '#4CAF50');
map.setPaintProperty('parcels-layer', 'fill-opacity', 0.8);