L.esri.Vector.vectorBasemapLayer

Extends L.Layer

L.esri.Vector.vectorBasemapLayer uses the esri-leaflet-vector plugin to display Esri hosted vector basemaps—using the Esri Basemap Layer Service API—and attribute data providers appropriately.

Constructor

Note: There are two ways to construct this layer with the required key parameter, either with a basemap style enum or an item ID of a custom basemap style.

ConstructorDescription
L.esri.Vector.vectorBasemapLayer(<String> key, <Object> options)key refers to either with a basemap style enum or an item ID of a custom basemap style that you'd like to add. Defaults to 'ArcGIS:Streets'.

Vector Basemaps

  1. Basemap style enums are formatted with two or three parts and can be used for the key constructor parameter:

    • {Provider}:{Style name}
    • {Provider}:{Style name}:{Component}

    Please refer to the complete list of default basemap styles.

    Some samples include:

    • ArcGIS:DarkGray
    • ArcGIS:Imagery:Standard
    • OSM:Standard
  2. Otherwise, if displaying a custom basemap style, the item ID of that custom basemap style is used for the key constructor parameter.

Options

L.esri.Vector.vectorBasemapLayer also accepts all L.Layer options.

OptionTypeDescription
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.

Methods

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

Example

Live sample here.

Use dark colors for code blocksCopy
 
1
<script src="./esri-leaflet-vector.js"></script>
Use dark colors for code blocksCopy
      
1
2
3
4
5
6
var map = L.map("map").setView([40.706, -73.926], 14);

L.esri.Vector.vectorBasemapLayer("ArcGIS:Streets", {
    // provide either apikey or token
    apikey: "YOUR-API-KEY"
}).addTo(map);

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