Select to view content in your preferred language

Experience Builder - How to Turn On/Off multiple layers

5229
8
Jump to solution
10-13-2020 02:46 PM
MarcoPoetsch
Frequent Contributor

Hi all,

does someone of you know a good way to turn on/off multiple layers with one click using a button (or something)?

So basically I have a map with multiple layers (e.g. layers A, B, C, D).

On default only layer A should show.

When clicking button B, none but layer B should show.

If I click button C, only layer C should be activated, and so on...

Bookmarks won't work, because I don't want to change the map extent...

Tags (2)
1 Solution

Accepted Solutions
DavidMartinez
Esri Regular Contributor

Hi Mario,

There is nothing out of the box that allows you to achieve this besides using the layers widget. What you're describing is something that can be created with a custom widget. We do have an issue in our repo on how to tie into the layers widgets from other widgets. You could use the section widget to achieve the workflow you're describing above.  Each section would have different maps with the correct layers already turned on. Then you could use the views navigation widget or button widget to switch between views. Then have an action for each map that basically zooms to the area. 

Cheers,

David

View solution in original post

8 Replies
MarcoPoetsch
Frequent Contributor

anyone any thoughts?

0 Kudos
DavidMartinez
Esri Regular Contributor

Hi Mario,

There is nothing out of the box that allows you to achieve this besides using the layers widget. What you're describing is something that can be created with a custom widget. We do have an issue in our repo on how to tie into the layers widgets from other widgets. You could use the section widget to achieve the workflow you're describing above.  Each section would have different maps with the correct layers already turned on. Then you could use the views navigation widget or button widget to switch between views. Then have an action for each map that basically zooms to the area. 

Cheers,

David

MarcoPoetsch
Frequent Contributor

Thank you David,

I tried that, but I'm experiencing some issues with the sync of the map extent. It works fine the first time, but when you switch back or go to the next section, it won't keep the map extent. Although I had setup the map actions for that.

0 Kudos
MarcoPoetsch
Frequent Contributor

these are my settings:

This is what happens:

0 Kudos
DavidMartinez
Esri Regular Contributor

Can you remove the Pan to and only use the zoom to and see if that works?  We have an open issue on those two actions canceling one another out. 

MarcoPoetsch
Frequent Contributor

Thanks David, that's working now

0 Kudos
TommyDSM
Emerging Contributor

a solution for this is badly needed.

 

0 Kudos
JoanneO_Keefe
Occasional Contributor

I agree. There should be a reset button incorporated into the layers widget. Feels like it should be a standard option.