Switch on individual layers of a map with a button

13956
31
10-26-2021 05:14 AM
Labels (1)
ksm-hh
by
New Contributor

Hello all,

I have loaded a web map with different layers into Experience Builder to create a WebApp. In this web app, individual layers of the web map should be able to be switched on and off with a button or a switch.

Is this possible and do you have any tips on how I can implement this?

Many greetings

31 Replies
KristapsKaugurs
New Contributor

Nice idea!
It took me a while to figure out what you are talking about, but I got there 🙂
This looks a lot like my reverse filter method where layer is loaded and then filtered out. Does this also load all the layer data to the map straight away?
See, if I am working with large datasets, then layers that are switched off, dont take up any resources. Once you load everything in, the app starts to slow down.
My reverse filter method loads all data and hides it by filtering it away. However, it LOADS IT ALL to the memory and thus is very unusable with large datasets. Do selectors behave better?

0 Kudos
KatieDawson23
New Contributor

The closest I think I have come to this is having multiple map widgets in a section and each view containing the specific combination of layers I need. This acts like bookmark, but to keep the map extents the same you use action triggers. So when the extent changes in one map, the zoom changes in the other maps. Name the view as desired (e.g. "View Property Data" etc.) then use the Views Navigator to change the layers. So when you click on each view the map layers change without it affecting the map extent.