AnsweredAssumed Answered

How to use style-change event of VectorTileLayer

Question asked by yuki_ozawaesrij-esridist Employee on Nov 24, 2015
Latest reply on Dec 2, 2015 by KEkenes-esristaff

VectorTileLayer class has style-change event.

This event don't fire even if change a style of VectorTileLayer using setStyle methods.

I want to use style-change event.

 

var map = new Map();

//make map view and bind it to the map
var view = new MapView({
  container: "viewDiv",
  map: map,
  center: [-100.33, 25.69],
  zoom: 10
});

var tileLyr = new VectorTileLayer({
  url: "http://www.arcgis.com/sharing/rest/content/items/3b8814f6ddbd485cae67e8018992246e/resources/styles/root.json"
});
map.add(tileLyr);

on(changeStyle, "click", function() {
  tileLyr.setStyle("http://www.arcgis.com/sharing/rest/content/items/103d0c867a9640e3a6d44224196de1fd/resources/styles/root.json");
});

tileLyr.on("style-change", function(){
  console.log("style changed");
});

Outcomes