HOW TO
One of the advantages of using vector basemaps is that the style of the basemaps, such as the color, is customizable using ArcGIS API for JavaScript.
The style of vector basemaps can be changed by obtaining the style URL and applying it in the code.
require(["esri/map", "esri/layers/FeatureLayer", "esri/layers/VectorTileLayer", "dojo/domReady!" ], function (Map, FeatureLayer, VectorTileLayer) { //Initializing the map constructor var map = new Map("map", { center: [-118, 34.5], zoom: 8, //basemap: "topo" }); //When customizing a vector basemap, change the URL to the customized URL. var darkGrayStyleURL = "https://www.arcgis.com/sharing/rest/content/items/57436c01bc754dbb87dfb636b6484022/resources/styles/root.json"; var lightGrayStyleURL = "https://www.arcgis.com/sharing/rest/content/items/1e47168d181248e491541ffd5a91c0de/resources/styles/root.json" let vectormap = new VectorTileLayer("https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer"); vectormap.setStyle(lightGrayStyleURL); vectormap.on("load", () => { map.addLayer(vectormap); }); });
Get help from ArcGIS experts
Download the Esri Support App