VectorTileLayer - update style

This sample shows how to update style layers in the current style of a VectorTileLayer.

At version 4.18, we introduced the following methods on VectorTileLayer that will get and set the various properties of style layers in the VectorTileLayer's currentStyleInfo.style. These methods can be used in 2D MapView without having to reload the entire VectorTileLayer.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// delete a style layer
layer.deleteStyleLayer("City small scale/medium other capital");

// add a new style layer at the specified index
layer.setStyleLayer(styleLayer, 15);

// make a layer visible
layer.setStyleLayerVisibility("Admin0 point/medium", "visible");

// change style layer paint and layout properties at once
const styleLayer = layer.getStyleLayer("City small scale/x large admin0 capital");
styleLayer.paint["text-color"] = "#E400E0";
styleLayer.paint["text-halo-color"] = "#E400E0";
styleLayer.layout["icon-size"] = 1.5;
layer.setStyleLayer(styleLayer);

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

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close