Is it possible for layers to automatically turn on/off based on activating other layers? (ArcGIS online map)

443
1
09-18-2020 01:34 PM
IcleiUsa
New Contributor

I have an online map with 6 layers. One layer represents cities (City layer A). Two other layers, County Layer A and State Layer A, correspond to the City Layer A. I would like County Layer A and State Layer A activated whenever a user activates City Layer A. I also have another city layer (City Layer B) that has two corresponding layers, County Layer B and State Layer B. I would also like it so when a user activates City Layer B, County Layer B and State Layer B activates. Even better, I'd like it so when a user activates one city layer, the other city layer (and in turn, the other county/state layers) turn off.

Is this possible?

Thank you!

0 Kudos
1 Reply
ManishPatel
Esri Contributor

Iclei Usa‌, you can achieve this however, this is something not possible with out of the box application but has to be a custom web application where you can control the layers visibility with conditions provided. You can refer to the layer visibility sample 

Toggle layer visibility | ArcGIS API for JavaScript 3.33 

or

MapImageLayer - Toggle sublayer visibility | ArcGIS API for JavaScript 4.16  

Hope this helps.

Cheers!

Manish

Cheers,
Manish
0 Kudos