Web Map layers to make groups to turn on and off multiple layers

415
1
05-02-2017 04:18 PM
PitDev
by
New Contributor

I have a web map with multiple layers.

Each layers have certain types such as -- trees, flowers, veggies / railway, road, sidewalk, highways

I want to find out if this is possible; add a button that enable all three tree, flowers and veggies layers and disable all, and the other button enable and disable railway, road, sidewalk and highways.

Thank you in advance!

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Sure it would as simple as adding a button with logic for getting your maps layer and determining if the layer name matches your desired layers and then using layer.visible = true or false:

https://developers.arcgis.com/javascript/3/jsapi/layer-amd.html#visible 

0 Kudos