How do you display a layer in your legend, yet enable pop-ups for a completely different set of information? Here’s an easy technique for enabling users to retrieve information from sources other than what they see in your map.
This example involves a real case where we wanted to create a map showing counties impacted by Hurricane Sandy, but displaying a pop-up for a different layer, in this case demographic information about population over age 64. Our goal was to show only the impacted counties in the legend , and when a county is clicked we wanted to display the demographic data in the pop-up instead of the impacted counties data.
Our map started with a layer from FEMA showing impacted counties, show below:
Next we found and added the demographic layer from ArcGIS Online for population over the age of 64:
Here’s our map with the demographic layer, showing its pop-up:
We also added a storm surge layer.
Our next step was to hide the legend for the for the demographic layer. Why? We did not want to display it in the legend since it would be invisible on the map, and the way the user would retrieve the demographic information would be by clicking the map to reveal the demographic layer pop-up. So our next steps were to:
- Disable the pop-ups for the storm surge and impacted area layers, since we only wanted these to display in the legend and not act as a pop-up source.
- Make the demographic layer invisible, so it would not be displayed on the map. Even though it would be invisible, when clicked the demographic layer pop-up would be displayed.
- Since the demographic layer would not be visible on the map, we also wanted to remove its legend from the map.
Step 1 was to disable the pop-ups for the impacted area analysis and storm surge. You’ll find Remove Pop-up among the layer options when you hover over a layer name to reveal the arrow next to it. Note that if you have sublayers you’ll need to click the layer to reveal them, then hover over the sublayer to reveal the arrow:
Step 2 was to make the demographic layer invisible on our map. To do this we adjusted the transparency to %100 using the layer options:
In Step 3 we hid the legend for the demographic layer. Like other options we’ve adjusted, you’ll find Hide in Legend when you click the arrow next to the layer name:
The final map enabled the impacted areas and storm surge layers to display in the legend, with the pop-ups coming from the invisible demographic layer as shown below: