The Map Layers widget displays a list of map layers.
Examples
Use this widget to support app design requirements such as the following:
- You want to list a map's layers and allow users to control their visibility.
- You want to leave some layers off of your map's layer list.
Usage notes
This widget requires connection to a data source. You can connect to a data source directly or connect to a Map widget in your app. You can use the Map Layers widget on a page with or without a displayed map.
When you connect this widget to a Map widget, the Map Layers widget can provide users with the following interaction options for each listed layer. Each option must be turned on in the widget's settings:
-
Zoom to—Zoom the connected map to the extent of the layer.
-
Show labels or Hide labels—For layers with labels, show or hide labels.
-
Transparency—Change the transparency of the layer in the connected map with a slider.
-
Details—Open the details page for the layer.
-
Enable pop-up or Disable pop-up—Turn pop-ups on or off. If you enable pop-ups, pop-ups appear when you select a feature from the layer.
-
Visibility range—Specify the zoom levels at which layers appear. Zoom levels can range from building rooms to the entire globe.
-
Set filter—Set filters with SQL expressions.
-
Add to table—View the layer's attributes in a Table widget.
-
Statistics—View statistics for fields from a layer.
-
Export—Export all records from the corresponding layer to CSV, JSON, or GeoJSON formats.
If a web map or web scene contains any tables, you can view them with the Map Layers widget.
Settings
The Map Layers widget includes the following settings:
-
Source—Connect the widget to a map in one of the following ways:
-
Show layers for map data only—Connect the Map Layers widget to a web map or web scene. The widget lists all the layers in the map or scene.
-
Interact with a Map widget—Connect the Map Layers widget to a Map widget.
-
If you connect a Map widget, any connected maps or scenes appear in a list in the widget settings. Click a map to open its configuration panel.
-
Customize layers—Customize which layers from the map appear in the Map Layers widget at run time. If you leave this setting turned off, all map layers appear in the widget.
-
Display layers generated at run time—When this setting is turned on, layers added at run time with widgets such as the Add Data widget appear in the Map Layers widget.
-
Layers—All supported layers and tables from the map or scene are listed here. Click a layer to include it in or hide it from the widget. You can search for layers by name, and you can use the Batch options drop-down menu to perform the following tasks:
- Select all available layers—Select all layers that the widget supports.
- Unselect all available layers—Unselect all layers that the widget supports.
- Toggle all—This option switches the selected status of every available layer. Unselected layers become selected, and selected layers become unselected.
- Expand all layers—Expand all group layers.
- Collapse all layers—Collapse all group layers.
-
-
-
-
-
Options—Select from a variety of options to appear in the widget for each listed layer.
The following options appear when you choose Show layers for map data only:
-
View layer details—Include the Details button.
-
Expand all layers by default—Expand all group layers when the widget first loads.
-
Enable layer batch options—Add a button at the top of the widget panel that opens a drop-down menu for applying the following two options to all layers in the widget:
- Expand all layers—Expand all group layers.
- Collapse all layers—Collapse all group layers.
-
Show tables—Include a Tables section in the widget that lists any tables from the connected web map or web scene.
In addition to the above options, the following options appear when you choose Interact with a Map widget:
-
Zoom to—Include the Zoom to button for each layer.
-
Show or hide labels—For layers with labels, allow users to show or hide labels.
-
Enable or disable pop-up—Allow users to turn pop-ups on and off for applicable layers in the connected map.
-
Transparency—Allow users to change the transparencies of layers in the connected map with a slider.
-
Visibility range—Allow users to specify the zoom levels at which layers appear. Zoom levels can range from building rooms to the entire globe.
-
Use tick boxes to control layer visibility—Include tick boxes that allow users to turn layer visibility on or off in the connected map.
-
Show legend—Display a legend for all visible layers.
- Show legend for all visible layers by default—Expand the legend for all visible layers by default.
-
Reorder layers—Allow users to drag layers to reorder them at run time. This setting is applicable when there are at least two layers.
-
Search layers—Include a search box at the top of the widget panel that allows users to search for layers by name.
-
Enable layer batch options—Add a drop-down button at the top of the widget panel that opens a drop-down menu for applying the following four options to all layers in the widget:
- Turn on all layers—Make all layers visible.
- Turn off all layers—Make all layers invisible.
- Expand all layers—Expand all group layers.
- Collapse all layers—Collapse all group layers.
-
Interaction options
The Map Layers widget supports data actions, which you can enable on the Action tab of the widget's settings.
Data actions add buttons to the widget's user interface for performing data processing tasks. The Map Layers widget currently supports the following data actions at the data source level. When the target is a widget, the data action appears as an option in the Map Layers widget's settings when you add one of those widgets to the app.
Target | Data action |
---|---|
Framework | Export |
Framework | Set filter |
Framework | Statistics |
Near Me widget | Set location |
Table widget | Add to table |