Extends L.
L.esri.
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.
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.
accepts all L.
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. | |
portal | String | 'https | Specify the URL of the portal your layer is hosted in. |
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. See example below. | |
preserve | Boolean | false | Sets 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.
inherits all methods from L.
.
Examples
Add a vector tile layer
This example displays a vector tile layer hosted in a portal using its ArcGIS item ID.
L.esri.Vector.vectorTileLayer(
"https://vectortileservices3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Santa_Monica_Mountains_Parcels_VTL/VectorTileServer"
).addTo(map);
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.
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);