MOOC Facelift 2: Filter By Map Extent With A Data View

577
0
10-23-2024 11:59 AM
JeffreyThompson2
MVP Frequent Contributor
2 0 577

Last week, we took the Experience Builder project from the Make an Impact with Modern GeoApps MOOC from drab to fab. But @AndreaB_ wasn't satisfied with the way the fact that the observations in the Feature Info Widget don't filter by the map extent. And she's right, adding in some Actions could make this app an even nicer user experience. So let's do that.

I am going to set up Actions so that the data in the Table and Feature Info Widgets only show what is currently in the Map Widget. I will be using two different methods, an easy way and a more complex way involving a Data View. We will start with the easy way on the Table Widget.

The Easy Way To Filter By Map Extent

  1. Go to the Map Settings Panel Action Tab.
  2. Add an Extent Changes > Filter Data Records > Native Vegetation Action. (Native Vegetation is the name of the layer used in the Table Widget.)

JeffreyThompson2_0-1729706677045.png

That's it. The Table now filters itself every time the Map changes. Let's make it harder on ourselves...

Filtering By Map Extent With A Data View

  1. Go to the Feature Info Widget Settings Panel Content Tab.
  2. Click Observation. (That is the name of the layer used in this Widget.)
  3. Open the dropdown menu under Observation and select Create A View.JeffreyThompson2_1-1729707075044.png
  4. In the window that pops up, Add A Clause and set it to something that will not filter anything. OBJECTID is not blank should do the job of not doing anything.
  5. Change the name of this Data View to Map Extent to clarify why it exists.JeffreyThompson2_2-1729707458581.png
  6. Apply Changes. Then, open up that dropdown menu under Observation again and select Map Extent.
  7. Go back to the Map Settings Panel Action Tab.
  8. Click on the Filter Data Records Action I made earlier. Then, click Select Data.
  9. Select Observation to add an additional layer to filter. Then, hit the X button at the top of the Select Data Panel.
  10. This should bring you to the Action Settings Panel. Under Observation, open the dropdown menu and select Map Extent and de-select Default.

JeffreyThompson2_4-1729708498347.png

Now, the Feature Info Widget should filter as we zoom around the Map.

Sequel Bait for a Part Three of This Series to be Written Ten Years From Now When ESRI Offers Me More Money Than I Can Refuse and Ruins the Artistic Integrity of My Work

Was there any point to building that Data View? Doesn't it just do the same thing? Why bother with a ten step method when I could have done it in two?

In this application, as it currently is, creating that Data View was a total waste of time. Making my application more complicated than it needed to be and increasing the chances that I messed up somewhere along the way. But now that I've done it, I could add more stuff to my application that doesn't get filtered by the map extent. For example, I could add a List Widget set to the Default Data View of the Observations layer that would show every animal observed with an Action set up to Zoom To that part of the Map.

Until ESRI destroys it, you can see what this version of the app looks like here.

Contributors
About the Author
A frequently confused rock-hound that writes ugly, but usually functional code.