Overview
Web offers a command called Add layers from an Esri portal that allows users to freely add layers to the map from their portal or ArcGIS Online organization. But in some cases, users might prefer to have a more curated experience where they're offered specific types of layers that are relevant to the app, rather than browsing through all of their organization's content. They might be accustomed to layer catalog tools from other applications, or they might not be comfortable or efficient using the options in the "Choose Layers" dialog to filter and find relevant layers, especially if your organization has a lot of shared content or has content that is not well labeled. This article will walk through some settings that can be used to simplify and customize the experience for the user.
Filter the Choose Layers dialog
- Open the app in Web Designer
- Switch from the Components tab in the right side panel to the Services tab
- Select the "Portal" service
- In the Restrict "Add Layer" to these tags textbox, enter the name you'll use to tag your collection of addable layers
- Click the Add button
This will restrict the Choose Layer dialog to only show services and layers with the specific tag you provided. Other content from your organization will be filtered out.
This setting is also documented here.
Clean up the Choose Layer dialog
- While still in the "Portal" service configuration in Web Designer, turn off the toggle options for Show Filter Panel Toggle, Show Filter Chips, and Show Filter Menus
This will remove several options and pieces of information related to filtering from the Choose Layer dialog. Since we will be curating the available layers for the user, we'll assume that they won't need the filtering options, and that removing them will make the UI simpler and easier to read.
Before:
After:
Create your catalog of services and layers
Note: if you're using an older version of Portal, the exact steps might vary
- In Portal or ArcGIS Online (whichever your Web Designer is connected to), navigate to the Content page
- Click Add Item
- Select the URL option
- Paste the REST url for a map service or layer that you want users to have the option of adding in the app. Eg. https://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer
- Click Next
- Configure the title and folder that you want to use
- Add a tag that matches the name you configured for the Restrict "Add Layer" to these tags setting in Web Designer
- Finish creating the item
- Click the "Share" button, and configure the sharing settings so that your users will be able to access the item (note: the underlying service must also be shared in a way that the users can access)
- Repeat the process for each service or layer that you want users to be allowed to add from the tool in the Web app.
Alternatively, if you already have existing items in your Portal or ArcGIS Online organization for the services or layers that you want users to add, you can just add the tag on those existing items. Adding new items is mostly useful for scenarios where:
- You need to add public services from sources outside of your organization or from standalone ArcGIS Servers that aren't connected to your portal.
- Your map services have names that end-users wouldn't understand, but those names can't be changed. Creating a new item lets you set a different title.
- You want your users to see specific layers from a map service rather than seeing the whole service. You can create items for individual layers.
Optional: enable adding multiple items
- Open the app in Web Designer
- Navigate to the button or menu item where your "Add layers from an Esri portal" command is configured, and edit that button or menu item
- Click the "Customize" button that's to the right of the command name and the Edit (pencil) button
- Replace the existing custom command text with this:
[
{
"name": "portal.choose-layers",
"arguments": {
"allowMultiple": true
}
},
"map.add-layers"
]This will allow users to select more than one item at a time from the Choose Layer dialog, which makes the tool quicker and easier to use if they're likely to add multiple layers. This option for the portal.choose-layers operation's arguments is documented here.
While you're here, also consider replacing the title of the "Add layers from an Esri portal" tool with a friendly name that describes the theme of your curated layers.
Optional: provide more than one catalog of themed services and layers
The suggestions above assume that you only want to provide users with one Add layers from an Esri portal tool in your app. But if you wanted to provide multiple tools that each offer a different collection of services and layers from a different theme or department, that is also possible.
- Open the app in Web Designer
- Navigate to the toolbar or menu where you want to add second instance of the Add layers from an Esri portal command
- Add the Add layers from an Esri portal command
- Click the "Customize" button that's to the right of the command name and the Edit (pencil) button
- Customize the command text like this, replacing "WaterLayerCatalog" with the name of the tag you'd like to use for your second thematic collection of layers:
[ { "name": "portal.choose-layers", "arguments": { "allowMultiple": true, "layerFilterTags": ["WaterLayerCatalog"] } }, "map.add-layers" ]- Change the title of the tool to a friendly name that describes the theme of your curated layers. Eg. "Add Water Layers"
- In your ArcGIS Online organization or Portal, add map services and layers with this new tag, or add the tag to existing items.
You can repeat the process for as many separate themes as you want to provide.
Comments
0 comments
Article is closed for comments.