Extends L.esri.
L.esri.
uses the esri-leaflet-vector
plugin to display vector tile basemaps from the Basemap styles service. It also handles basemap attribution.
Constructor
Constructor | Description |
---|---|
L.esri.Vector.vectorBasemapLayer(<String> key, <Object> options) |
|
The required key
parameter can be used to display either a basemap style enumeration or a custom basemap style.
Basemap style enumerations
Basemap style enumerations represent predefined basemap styles provided by ArcGIS. Set the key
parameter to a valid style enumeration to load a basemap into your application.
V1 enumerations
Style enumerations from the Basemap styles service v1 contain two or three parts separated by a colon (:
). Each part is written in camel case without spaces between words:
{
Provider} :{ Style Name} {
Provider} :{ Style Name} :{ Component}
Some examples include:
ArcGIS
:Imagery ArcGIS
:Human Geography :Detail OSM
:Standard
V2 enumerations
Style enumerations from the Basemap styles service (v2) contain two or three parts separated by a forward slash (/
). Each part is written in lowercase with words separated by dashes:
{provider}/{style-name}
{provider}/{style-name}/{component}
Some examples include:
arcgis/imagery
arcgis/human-geography/detail
osm/standard
Custom basemap styles
L.esri.
also supports custom basemap styles created with the Vector Tile Style Editor. To load a custom basemap style, set the key
parameter to its item ID.
Options
L.esri.
accepts all L.esri.
options, though portal
has no effect. A valid API key or token is required to load a vector basemap layer.
Option | Type | Description |
---|---|---|
apikey | String | Inherited from |
token | String | Inherited from |
version | String | Specifies the version of the Basemap styles service to be used. Accepted values are |
language | String | Only supported by the Basemap styles service v2. Sets the language of the place labels on the map. Input must be a supported language code. Right-to-left languages like Arabic and Hebrew require additional configuration using the |
worldview | String | Only supported by the Basemap styles service v2 on certain styles. Changes the political worldview. Input must be a supported worldview code. |
places | String | Only supported by the Basemap styles service v2 on certain styles. Displays places of interest on the basemap. Input must be a supported value: |
style | Function | Inherited from
|
Default panes
By default, L.esri.
objects are added to Leaflet maps using the following panes:
Basemap type | Leaflet Pane | zIndex |
---|---|---|
Label enumeration ending in | esri-labels | 300 |
Detail enumeration ending in | esri-detail | 250 |
Default (all other basemaps) | tilePane | 200 |
Methods
L.esri.
inherits all methods from L.esri.
.
Examples
Display a basemap style
This example loads the ArcGIS Outdoor basemap.
const map = L.map("map").setView([40.706, -73.926], 14);
L.esri.Vector.vectorBasemapLayer("arcgis/outdoor", {
token: "YOUR_ACCESS_TOKEN",
version: 2 // this property is optional
}).addTo(map);
Display a custom basemap
This example loads a custom basemap by referencing its ArcGIS item ID. This method defaults to using the v1 service, but is also supported through the v2 service.
const map = L.map("map", {
minZoom: 2
})
map.setView([34.02, -118.805], 13);
const accessToken = "YOUR_ACCESS_TOKEN";
const basemapEnum = "6976148c11bd497d8624206f9ee03e30";
L.esri.Vector.vectorBasemapLayer(basemapEnum, {
token: accessToken
}).addTo(map);
Display places labels in a different language
This example changes the language of place labels on a basemap. The language
property is only supported for v2 style enumerations, and is not currently supported for custom basemaps.
const map = L.map("map").setView([40.706, -73.926], 14);
L.esri.Vector.vectorBasemapLayer("arcgis/streets", {
token: "YOUR_ACCESS_TOKEN",
language: "uk" // set language to Ukranian
}).addTo(map);