Esri / esri-leaflet-vector

Display ArcGIS Online vector basemaps w/ Esri Leaflet
Apache License 2.0
56 stars 57 forks source link

Additional support for VTLs and styles hosted on ArcGIS Enterprise #88

Closed jwasilgeo closed 3 years ago

jwasilgeo commented 3 years ago

Add a portalUrl optional parameter to the L.esri.Vector.vectorTileLayer layer type, intended to be used with the "ITEM_ID" constructor flavor.

L.esri.Vector.vectorTileLayer("ITEM_ID", {

  // ADD NEW OPTIONAL PROPERTY
  portalUrl: "https://PATH/TO/ARCGIS/ENTERPRISE/",
  // IF NOT PROVIDED, WILL DEFAULT TO SOME PART OF "https://www.arcgis.com/sharing/rest/content/items/" 
  // SHOULD BE SIMILAR IN NATURE TO https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#portalUrl

  // provide either apiKey or token if not public
  apiKey: "...",
  token: "...",

  // optionally customize the style with a function that gets the default style from the service
  // and returns the new style to be used
  style: (style) => {
    return newStyle;
  }
}).addTo(map);

Review internal Util.js usage here:

NOTE: The other layer type, L.esri.Vector.vectorBasemapLayer, will not support this enhancement as it 100% uses the the Esri Basemap Styles API internally.

Related issues:

jwasilgeo commented 3 years ago

in progress in branch 88-enterprise-support

jwasilgeo commented 3 years ago

This is available now in the recent v3.1.0 release. 🎉