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 mapbox-gl-js v1.

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.

Constructor Description
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.

Option Type Default Description
apikey String If you pass an apikey in your options it will be included in all requests to the service.
token String If you pass a token in your options it will be included in all requests to the service.
portalUrl String 'https://www.arcgis.com' Specify the ArcGIS Enterprise base URL if your layer is not hosted on ArcGIS Online.
style Function Function that can be used to customize the style. It gets the default style from the service and returns the new style to be used.
function (style) {
  // make changes to the style object
  // return your style overrides
  return newStyleObj;
}

Methods

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

Example

Live sample at an ArcGIS Developers tutorial page.

<script src="./esri-leaflet-vector.js"></script>
var map = L.map('map').setView([34.02,-118.805], 13);

// using an item ID of an hosted ArcGIS Online content item
// https://esri.maps.arcgis.com/home/item.html?id=f40326b0dea54330ae39584012807126
L.esri.Vector.vectorTileLayer("f40326b0dea54330ae39584012807126").addTo(map);

// or, using a service URL instead
L.esri.Vector.vectorTileLayer(
    "https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Microsoft_Building_Footprints/VectorTileServer"
).addTo(map);

Edit this page on GitHub