L.esri.Vector.vectorTileLayer

Extends L.Layer

L.esri.Vector.vectorTileLayer uses the esri-leaflet-vector plugin to display vector tile service layers and their styles published from user data.

Your vector tile service must be published using the Web Mercator Auxiliary Sphere tiling scheme (WKID 102100/3857) and the default scale options used by Google Maps, Bing Maps and ArcGIS Online. The esri-leaflet-vector plugin will not support any other spatial reference for vector tile layers because it relies directly upon maplibre-gl-js.

Constructor

Note: There are two ways to construct this layer with the required key parameter, either with an item ID or service URL of a hosted vector tile layer.

ConstructorDescription
L.esri.Vector.vectorTileLayer(<String> key, <Object> options)key refers to the specific item ID or service URL of a hosted vector tile layer you'd like to add.

Options

L.esri.Vector.vectorTileLayer accepts all L.Layer options.

OptionTypeDefaultDescription
apikeyStringIf you pass an apikey in your options it will be included in all requests to the service.
tokenStringIf you pass a token in your options it will be included in all requests to the service.
portalUrlString'https://www.arcgis.com'Specify the URL of the portal your layer is hosted in.
styleFunctionFunction that can be used to customize the style. It gets the default style from the service and returns the new style to be used. See example below.
preserveDrawingBufferBooleanfalseSets the associated property in the underlying Maplibre GL library. Set to true to resolve WebGL printing issues in Firefox. It is set to false by default for performance reasons.

Methods

L.esri.Vector.vectorTileLayer inherits all methods from L.Layer.

Examples

Add a vector tile layer

This example displays a vector tile layer hosted in a portal using its ArcGIS item ID.

Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
      L.esri.Vector.vectorTileLayer(
        "https://vectortileservices3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Santa_Monica_Mountains_Parcels_VTL/VectorTileServer"
      ).addTo(map);
Expand

Style a vector tile layer

This example performs client-side styling of a vector tile layer by accessing the underlying maplibre object used in Esri Leaflet Vector.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
const map = L.map('map').setView([34.02,-118.805], 13);

L.esri.Vector.vectorTileLayer(
"https://vectortileservices3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Santa_Monica_Mountains_Parcels_VTL/VectorTileServer", {
    style: function (style) {
        style.layers[0].paint['fill-color'] = '#ff0000';
        return style;
    }
}).addTo(map);

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.