Relationships are all around us, and as GIS professionals we try to capture, understand, and share these relationships. Knowing that, we’re excited to announce that Map Viewer now supports configuring and viewing related records through pop-ups! For those that aren’t familiar, related records, like their name suggests, are records from one dataset that relate to records of another dataset through a common field. In ArcGIS, relationships can occur between different forms of data.
- Layers can relate to other layers. For example, a streetlight can be associated with a road.
- Layers can relate to tables. For example, a well can be associated with inspections.
- Tables can relate to other tables. For example, a student can be associated with school course grades.
In this blog we’ll discuss how to display related data in your pop-ups through related record elements, Arcade attribute expressions, and Arcade elements.
Configuring related record elements
To give you a better idea of just how quick the configuration process is, let’s walk through it with an example. When you add an ArcGIS Online hosted feature service with a preestablished relationship into Map Viewer, you can configure related records through the Pop-ups pane. Say we have a service with a one-to-many relationship between a bird observation layer and a bird behavior table, so each bird observation has one or more associated observations noting the bird’s behavior. We can use related record elements to change a simple bird location map to a data-rich map that provides insight into why bird species frequent or reside in certain habitats. To author this map, open the Pop-ups pane, add a related record element, provide a title and description, and sort the records by observation date to show the two most recent behavior observations. In just a few clicks, we’re able to dive deeper into our data.
Viewing related records
Let’s look at how to navigate and view related records through the lens of our bird observation example. Here is a breakdown of the related record element within the pop-up. The related record element is comprised of a title and description, a preview list of related records, and a Show all button.
Clicking the Show all button shows a list of all the related records for that feature, as seen below.
To return to the original pop-up, simply use the navigation buttons within the related record header. Clicking on one of the related records shows the pop-up for the selected related record, as seen below.
Nesting related records
In our bird observation example, a single relationship was present in the dataset between bird observations and behavior observations. What if a single layer or table in your dataset has multiple relationships? You can model several relationships by adding related record elements to the pop-ups of all the related layers. This is called nesting related records, and it allows you to access all related records through a single pop-up navigation experience.
It’s always easier to understand concepts through an example, so let’s say our bird observation dataset has another table. This table contains the weather conditions collected with each behavior observation, so there’s a one-to-one relationship between the behavior and weather tables.
This relationship diagram shows the layers and tables and their relationships within the bird observation dataset.
To display this additional relationship in our map, we can simply add (or nest) a related record element within the bird behavior table pop-up. Now, the bird observation pop-up gives us access to not only the related bird behaviors, but also the related weather conditions, all within a single experience!
Other ways to work with related records
You might recall that in Map Viewer Classic you can access fields from a related layer, get basic statistics on that field, and show those statistics within a pop-up fields list. We can do the same thing in Map Viewer using Arcade through attribute expressions and Arcade content elements. This allows greater flexibility and doesn’t limit you to a single statistic per related field. To do this, you can create an attribute expression using FeatureSetByRelationshipName() combined with your desired statistic function. Below is a quick example of how to get the average ground water elevation from a related table in the following map when users click on a ground water station. This map also contains the other examples shown below.
If you want to show multiple statistics in a pop-up, you can author an attribute expression for each statistic, or alternatively, you can use an Arcade content element to show all the statistics in a formatted list. By using the content element approach you will also increase overall performance as it will only make use of one FeatureSet execution vs. multiples when using the attribute expression approach.
That’s not the only way to visualize related records. In some instances, it may make more sense to plot those records over time on a chart. This can be achieved using Arcade content elements.
As you create engaging pop-ups using related records be sure to keep in mind these available options when designing the right experience for your audience.
Best practices when working with related records
Here are some tips to keep in mind when authoring related records:
- Have both layers involved in the relationship in the map
- Configure pop-ups on both layers involved in the relationship
- Provide contextual titles and descriptions
- Use the sort options to prioritize which records are displayed first
Browsing related records in pop-ups is only the tip of the iceberg for the work we have planned for related records in Map Viewer. Here are a few of the areas we’ll be focusing on in future releases:
- Viewing related records in pop-ups for non-hosted feature services
- More visualization options for related record elements
- Viewing related records in the table
- Editing related records using forms and tables
- Perform actions like navigate to, and edit from the related feature in the pop-up
Commenting is not enabled for this article.