Five Ways To Handle Groups of Layers

1846
1
11-02-2023 07:18 AM
JeffreyThompson2
MVP Regular Contributor
10 1 1,846

A common request is options in Experience Builder to turn on and off groups of layers at the same time and managing large numbers of layers in the layer list. There is not a perfect, all-encompassing way to do this in Experience Builder, but there are at least five partial solutions to these problem. We will be discussing the upsides and downsides of all these methods and how to pull them off. I was inspired to make this post now as three of these methods are recently added options and another one is a hack that was recently pointed out to me. We'll start with the newest options first.

Use Multiple Map Layers Widgets

In the October 2023 ArcGIS Online update, the Map Layers Widget received an update that allows for multiple Map Layers Widgets on the same map to be customizable. This update was made to better organize groups of related layers.

How To
  1. Add a Map Layers Widget.
  2. Select Interact with Map Widget and pick your map in the dropdown.
  3. Click your map under customize layers.
  4. Enable Customize Layers and deselect all the layers not in the group you are building.
  5. Repeat for each group you want to make.
  6. Organize your Map Layers Widgets into a Widget Controller with a unique icon and title for each group or collect them all into a Card or some other layout widget.

JeffreyThompson2_0-1698855977027.png

Benefits
  • Logically organizes your layers into thematic groups that may not represent drawing order.
  • Can make a very large set of layers more easily navigable.
  • It is core functionality of Experience Builder, so it shouldn't interfere with any build mode options.
  • Easy for end user to understand.
  • Allows access to all layers in your map, so the end user can mix items from multiple groups.
Drawbacks
  • Does not allow for quickly changing between themes.
  • The user will have to individually select every layer to turn on or off.
  • At time of writing, this is only an option in ArcGIS Online. Developer Edition will get this optionality in a few weeks. Enterprise users will likely have to wait for 11.3.

Exclusive Visibility

The June 2023 ArcGIS Online update added an option to the Map Viewer that allows for layers within a group to be made mutually exclusive, so that when one layer in that group is turned on others will automatically turn off.

How To

Here is the ESRI article explaining the basic steps for using Exclusive Visibility, but I want to highlight this line.

With exclusive visibility, you can intuitively control and focus on individual layers in a group, including nested groups.

You can make groups within groups! 

  1. Organize all of your related layers into groups.
  2. Group all of your layers into one big group.
  3. Turn on Exclusive Visibility for the big group.
  4. Use a standard Map Layers Widget in your Experience based on this webmap.
Benefits
  • Allows end-users to turn groups of layers on and off with a single click.
  • Should offer the end-user a good user experience, although it is not perfect.
  • Can make a large set of layers more easily navigable.
  • It is core functionality of Experience Builder, so it shouldn't interfere with any build mode options.
Downsides
  • Depending on the drawing order you need, this may not be functional for you.
  • Does not allow for the end user to mix and match layers.
  • At time of writing, it requires the use of an ArcGIS Online webmap. Enterprise users should expect this functionality in 11.2.

Add/Remove Layers By Group Custom Widget

In June 2023, a developer (who's probably very smart and handsome) made a custom widget specifically designed to add or remove groups of layers from a map all at once.

How To

The developer (who's probably kind to kids and animals) left instructions on how to use the widget here on the custom widgets page. Basically, replace the dummy data with links to your data and it's good to go.

Benefits
  • Built to offer a simple, aesthetically pleasing and easy-to-use experience for the end-user.
  • End-users can rapidly turn groups of layers on and off with a single click.
  • End-users still have access to all map layers, so they can mix and match as needed.
  • Layers are completely removed from the map (not set to invisible as in the other options on this list) making for a cleaner Map Layers list and less strain on the end-users computer.
  • By strategically turning layers on and off, the end-user can re-order layers in their map. (Useful, if combined with the Add Data Widget.)
  • It is a good platform for further modification. I have heard that the original developer (who's probably super humble) has modified this widget to restrict access to certain layers and vary layer properties (like altering symbology from the defaults).
  • Layers are given specific, known ids making them easier to find in other custom widgets.
  • The experience developer is able to control the drawing order for the layers within the groups.
Downsides
  • By loading layers at runtime, you are essentially opting out of many of the features in the build mode of Experience Builder and many OOTB widgets become unusable.
  • Only available in Developer Edition. (Or Enterprise 11.X, if you are able to host the custom widget on a web server.)

Use Multiple Maps with the Section Widget

These last two options have been around for some time, if not the beginning of Experience Builder, so should be available to all users. The concept behind this method is to switch out the entire map instead of changing the map layers.

How To
  1. Create a webmap for each of you layer groups.
  2. In Experience Builder, add a Section widget and in each section add a Map widget containing a different version of your map.
  3. Add a Views Navigation widget to control the sections.
  4. Give each section an appropriate title and icon. (This option is not currently available in all versions of Experience Builder.)
  5. Use the Message Action > Extent Changes > Map > Zoom To option on each map for each other map to keep your extents in sync (or your end-users will be very confused).

JeffreyThompson2_0-1698870640145.png

It is possible to do similar workflows with multiple pages or a Widget Controller, but the Section widget is going to be the best choice in most cases.

Benefits
  • Available in all versions of Experience Builder.
  • Done well, this could offer the best user experience of all the options on this list.
  • Other widgets could be added to the sections, so they fly in and out with the map layers. (Maybe one group of layers would go well with a Near Me widget and other would be good with a Swipe?)
  • Could be an excellent choice for an StoryMap-esque Experience.
  • The experience developer has excellent control over the drawing order.
  • Logically organizes your layers into thematic groups that may not represent drawing order.
  • It is core functionality of Experience Builder, so it shouldn't interfere with any build mode options...
Downsides
  • ...But if your Experience has a large number of widget interactions, making them work with all your maps will be somewhere between tedious and impossible.
  • Done poorly, this could offer the worst user experience of all the options on this list.
  • The end-user cannot mix and match map layers from different groups. (You could also give them a Map Layers widget with each map, but it would likely defeat the upside of this method.)

Hack the Bookmarks Widget

This last method could be the best option in many cases and it never occured to me until it was pointed out by a new user, @JasonBOCQUET, a few weeks ago. The Bookmarks widget contains an option to set what layers are active at a given view, so let's make use of that.

How To
  1. Add a Bookmark widget and pick one of the Advanced Templates. Selecting the Advanced Template will allow you to fully customize how you want your Bookmarks to appear (just text, text and an icon, just an icon, a picture of the map with the layers on, or anything else you may want) and it also turns off the option for a user to create their own bookmark, which we want turned off for this hack.
  2. Add a bookmark.
  3. Hit the little map icon to Change the Bookmark View.
  4. Select the Layers icon and turn on/off the layers to match the thematic group you are building.
  5. Hit save.
  6. Repeat steps 2 to 5 for each group.
  7. Style your bookmarks as necessary.
  8. If you are using this widget in a Widget Controller, you will need to give it a more appropriate name.

JeffreyThompson2_1-1698934666632.png

Benefits

  • Available in all versions of Experience Builder.
  • End-users can rapidly turn groups of layers on and off with a single click.
  • Logically organizes your layers into thematic groups that may not represent drawing order.
  • Could be combined with a Map Layers Widget to give the end-user the option to mix and match layers from different groups.
  • The experience developer has control over the drawing order.
  • Can make a large set of layers more easily navigable.
  • It is core functionality of Experience Builder, so it shouldn't interfere with any build mode options.
  • Should offer the end-user a good user experience...
Downsides
  • ...But if the end-user does any panning or zooming before clicking your bookmark, they will be very frustrated and confused when the map suddenly zooms off somewhere else.
  • Does not help with organizing a large set of layers in a Map Layers Widget.
1 Comment
About the Author
A frequently confused rock-hound that writes ugly, but usually functional code.