Turn on/ off specific layers in Experience Builder when switching views

08-18-2020 05:55 AM
Status: Open
Occasional Contributor

In StoryMaps (Specifically the tabbed storymap), there is a function that allows you to decide which layers turn on/off depending what tab you are in while maintaining the same map extent. It would be helpful to have this same functionality in Experience Builder when switching between views. An example of our work that we would like to port to Experience Builder can be found here (Be sure to go to the hazard exposure pages to see the tabbed story map): https://napsg.maps.arcgis.com/apps/MapJournal/index.html?appid=261d020c1ec941618e6f338dd127d566 . Notice how the extent stays the same but layers turn on/off depending on what tab you are in. This functionality would cut down on development time and maintenance time would be largely reduced because we won't have to maintain as many web maps.

by Anonymous User

I agree with this 100%. The functionality could be (possibly?) integrated into the "set custom map extent" interface within the map widget panel. Similar to the "bookmark" widget in a web app, I imagine being able to not only set a custom map extent, but to also be able to check on/off certain layers. I would use this functionality in conjunction with views. Currently, I have to create a separate web map for every view I want to use, whereas with this functionality I would only need to create one web map with all the data layers, and customize the layer visibility for each view.


I would like to see this as well. Being able to control layers with a button would make it possible to create interactive maps with different legends and topics.


Yes, this would be a very helpful and useful enhancement.  The ESRI customer support just summited an internal enhancement request for this very issue.


@AFackler_NAPSG @TommyDSM and all, you can add the same map multiple times to the Data Tab in Experience Builder as separate data sources. For example, the Air Quality Trend map is added twice to the Data tab as two web maps which is then renamed to Air Quality Trend 1 and Air Quality Trend 2 respectively as shown below. Click each web map, turn off /on the layers in the map data source as highlighted, then use Map widgets to connect to each map data source with the layer visibility defined in the above step. In this way, you only maintain one map with multiple map data sources.



This is cool and all, but back to the original poster's idea, it'd be nice for this experience (no pun intended) to be consistent with that of story maps. When I think about controlling map layer visibility, I think it'd be more logical to be able to do that at the Widget level than the Data Source level.

It might be a six of one half dozen of the other situation, but but I think it'd be more intuitive, even if the best I can explain it is, "It just makes sense that way." Maybe it's because adding the same map multiple times could get really confusing if you have more than one web map in your app. Then you're in a situation where you're not really sure how many truly unique web maps you're linking to, versus if you just add the map once and configure it differently within the app your data sources list truly reflects the unique maps you're connected to.

I'll stop now because I feel like I'm talking in circles, but if anyone feels the same and can express it better please do!


I agree with @JohnNergeBrooklynPark, it would be more intuitive to be on the map widget instead of the data source. Further improvements would be to add turn all layers on/off buttons and making the GUI block for each layer much smaller. It's going to take lots of scrolling for me to hunt down layers to turn them on/off, especially when they jump around based on their visibility status.

I'll miss the map series story map template...

Has anyone had success with the ESRI work around? I'm trying it out now, but even with setting layer visibility on two separate adds of the same webmap in data sources and seeing it correct in Experience Builder's built-in preview, when I look at the finished app, the map layers don't load at all in either of my map widgets. Per advice in other threads, I reduced the number of layers in my webmap, but still some of them don't show up in my final app.


@ChelseaRozek I  haven't tried the ESRI work around, however I have just been playing around with the bookmark widget in Experience Builder.

Using this I have had success by creating custom bookmarks within the bookmark widget settings, within the variety of bookmarks I have created there are different views for both layer visibility and extent - all of which is being respected within the published app and works as intended. Personally I also find this approach much easier to manage as it doesnt require multiple instances of the same map frame to be added. 



Thanks @Conor_McIntosh! That worked much better! I set a couple of bookmarks and they immediately worked in the app. I liked that there was a plain list template, so you don't have to have a thumbnail of the bookmark, and the setup was indeed much easier. No duplicating the map source and the layer list GUI was smaller and didn't have layers jumping around as you toggle their visibility on and off. I think I can actually use this to replace my map series template now!


Layer visibility appears to be available as an option for the Layer List widget: