diff --git a/examples/gallery-dev.html b/examples/gallery-dev.html
index 0600126..af62713 100644
--- a/examples/gallery-dev.html
+++ b/examples/gallery-dev.html
@@ -49,71 +49,38 @@
var map = L.map("map", {}).setView([34.0522, -118.2437], 15);
var vectorTiles = {};
- var allEnums = [
- "ArcGIS:Imagery",
- "ArcGIS:Imagery:Standard",
- "ArcGIS:Imagery:Labels",
- "ArcGIS:LightGray",
- "ArcGIS:LightGray:Base",
- "ArcGIS:LightGray:Labels",
- "ArcGIS:DarkGray",
- "ArcGIS:DarkGray:Base",
- "ArcGIS:DarkGray:Labels",
- "ArcGIS:Navigation",
- "ArcGIS:NavigationNight",
- "ArcGIS:Streets",
- "ArcGIS:StreetsNight",
- "ArcGIS:StreetsRelief",
- "ArcGIS:Topographic",
- "ArcGIS:Oceans",
- "ArcGIS:Oceans:Base",
- "ArcGIS:Oceans:Labels",
- "OSM:Standard",
- "OSM:StandardRelief",
- "OSM:StandardRelief:Base",
- "OSM:Streets",
- "OSM:StreetsRelief",
- "OSM:LightGray",
- "OSM:LightGray:Base",
- "OSM:LightGray:Labels",
- "OSM:DarkGray",
- "OSM:DarkGray:Base",
- "OSM:DarkGray:Labels",
- "ArcGIS:Terrain",
- "ArcGIS:Terrain:Base",
- "ArcGIS:Terrain:Detail",
- "ArcGIS:Community",
- "ArcGIS:ChartedTerritory",
- "ArcGIS:ColoredPencil",
- "ArcGIS:Nova",
- "ArcGIS:ModernAntique",
- "ArcGIS:Midcentury",
- "ArcGIS:Newspaper",
- "ArcGIS:Hillshade:Light",
- "ArcGIS:Hillshade:Dark",
- ];
var apiKey = "< YOUR VALID API KEY HERE >";
vectorTiles[
"Default"
- ] = L.esri.Vector.vectorBasemapLayer(null, {
+ ] = L.esri.Vector.vectorBasemapLayer("", {
apiKey
});
- allEnums.forEach((enumString) => {
- vectorTiles[
- enumString
- ] = L.esri.Vector.vectorBasemapLayer(enumString, {
- apiKey
- })
- })
-
- var layerControl = L.control
- .layers(vectorTiles, null, {
- collapsed: false
- })
- .addTo(map);
+ L.esri.get('https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/styles/self', {}, function (error, response) {
+ if (error) {
+ console.error('Error getting the available styles. See the error details:', error);
+ return;
+ }
+
+ response.styles.forEach((style) => {
+ vectorTiles[style.name] = L.esri.Vector.vectorBasemapLayer(
+ style.path,
+ {
+ apiKey
+ }
+ );
+ });
+
+ L.control
+ .layers(vectorTiles, null, {
+ collapsed: false,
+ })
+ .addTo(map);
+
+ });
+
vectorTiles["Default"].addTo(map);