Many feature layers in the ArcGIS Living Atlas contain features for a larger region than many analysts need. A growing number of content items are added to the Living Atlas every day that have data for all tracts, counties, schools, hospitals, or parks in the whole United States. Most GIS analysts only need to work with features for their own immediate area. By applying filters to these national layers, you can subset only the features that you need.
For example, this feature layer of all 4,798 Medicare-certified hospitals covers the entire United States. A typical GIS analyst examining healthcare access for Medicare beneficiaries in their own state, say North Carolina, will only be interested in the hospitals in one state.
According to this layer’s Item Details Page, there is a filter applied such that only hospitals with a valid quality rating (1 through 5 stars) actually display: Hospital overall rating is not ‘Not Available.’ That works for now, but I need to add a second filter to work with only North Carolina hospitals: State is ‘NC.’ I’ll do that by opening the filter and clicking “Add Another Expression.”
Then make sure the top dropdown menu says, “Display features in the layer that match all of the following expressions,” rather than “any of the following expressions.”
Apply the filter, and you will see that only the hospitals within North Carolina with a valid quality ranking are the ones that appear on the map and in the attribute table. Because I selected “…all of the following expressions” I see features that satisfy both criteria.
Change and Add to Existing Filters for Your Purposes
Now, we are first interested in who is near a 5-star hospital. Let’s adjust the filter so that the first expression is no longer Hospital overall rating is not ‘Not Available’ but Hospital overall rating is 5. Because our overall quality rating is a string field (due to the fact that it contains “Not Available” values), I see string expressions in the dropdown: is, is not, starts with, ends with, contains, does not contain, is blank, is not blank. If this were a numeric field, I would see options applicable to numeric fields: is less than, is greater than, is at least, is at most, is between, is not between. Date fields give you different expressions yet: before, after, in the last…day, week, month, 5 days, etc.
There are radio buttons underneath the third dropdown menu that say Value, Field, or Unique. If you have a specific value you’d like to filter on, choose Value. If you’d like to compare the value in one field to the value in another field for each record, choose the Field option. Finally, if you’d like to see all the unique values in the field that you’re filtering on, choose the Unique option.
For my current project, I can manually type in a value when the radio button is set to Value:
Or, I can select from all the unique values available by setting the radio button to Unique:
Either way works. After I click “Apply Filter and Zoom To,” my new map only displays the 10 hospitals in North Carolina that have an overall quality rating of 5 stars:
I’m going to make a copy of this layer with my new filter applied, rename it “North Carolina 5-Star Hospitals” and save the layer in My Content. I can then use this new layer to Create Drive-Time Areas or Buffers to use for Geoenrichment, or to start other types of analysis workflows. I can even repeat this process to create layers for North Carolina 4-star hospitals, 3-star hospitals, etc. The filter allows me to work with only the features that I need.
Use Nested Filters for Even More Customization
Grouping multiple filter expressions into sets allows for a bit more complexity in defining your subset. Say instead of showing the 5-star hospitals in the state of North Carolina only, I want to show the 5-star hospitals in neighboring states as well. It’s possible that these out-of-state hospitals are serving people in North Carolina how live close to the state lines.
In the filter dialogue box, click Add a set:
Then add multiple expressions by clicking on the + sign in the new set of expressions:
Because these hospitals are in one and only one state, I’m selecting “any of the following expressions in this set are true” rather than “all” like we selected before. When you have added all your desired sets of expressions, click the View tab at the top to see your final filter:
Apply a Filter to Highlight an Area
With all the hospitals in surrounding states displaying, I want a way to focus my map on North Carolina very clearly. I can add the USA States (Generalized) layer from the Living Atlas – a basic layer containing state boundaries and some basic population fields. To focus my map on the state I’m interested in, I’ll add a filter displaying all other states:
Then I can symbolize this layer in a transparent gray, which will make everything that is not my state of interest fade into the background:
Filtering Improves Your Maps and Simplifies Your Workflows
Filtering is often a great first step in making maps more focused, and defining inputs to geoprocessing and spatial analysis. I think of using filters in ArcGIS Online as a simple way to create a new layer that is a selection based on attributes. By applying filters, you can subset a national dataset in a Living Atlas layer to just the state, city, county, or school district that you need. You can also filter by attribute fields that are not geography-based (in this example, hospital rating) to map only the types of features you need.
To learn even more about Filters in ArcGIS Online, refer to the official help page: https://doc.arcgis.com/en/arcgis-online/create-maps/apply-filters.htm