The spatial filter pattern reduces available features by selecting a specific geographic region or area of interest.
Location, location, location is not only the mantra in real estate but also true for most consumer apps in which location is what people care about the most. This location can be a place or any well-defined geographic area such as country, state, district, city, service area, or postal code. The spatial filter is sometimes also referred to as filter by geography and provides an explicit method of specifying the desired geography for further exploration or analysis. In natural language, a spatial filter would say: “Show me only all the blah-blah that are within geography x,y,z. Remove all the others.”
Reducing the results by geography is an option widely used in enterprise apps, analysis apps, and dashboards. Dashboards, for instance, use the spatial selection to update the map display and any other component that is connected to the data, such as charts, KPIs, or tables. Spatial filters are less common in consumer apps such as real estate or travel apps, where the location finder is more prevalent. Location finders search for houses or hotels within a city but aren’t filtering the dataset — they only modify the extent to zoom in on the destination without removing the other options around them.
Show all the features without any geographic restrictions. Let users define a geography through interface components such as a drop-down list. Order the list of options alphabetically and consider adding a search field to reduce the options if the list is long. When the user selects an option from the list, all the features that do not fall within the selected geography will be removed.
The spatial filter usually filters features by an attribute of the feature set. Alternatively, the filter may run a server-side or client-side query. Client-side queries have the advantage that the data is already available in the browser and the filter can be applied immediately. Server-side queries often require an explicit button click to apply the filter query. Regardless of the filter mechanism, always provide an easy way to clear the filter.
For lesser-known geographies, help users by letting them browse a hierarchical set of geographies, such as selecting a state from a drop-down list to reveal a second drop-down list for selecting a county within that state. The following patterns describe alternative approaches on how to filter data spatially:
- Browse geographies lists all the options for easy browsing instead of lengthy drop-down lists.
- Feature selection describes how the map can be used to draw an arbitrary filter area.
- Buffer defines a spatial filter by creating a buffer zone around a selected feature.
The USDA National Water and Climate Center (NWCC), in Portland, Oregon, supports the Snow Survey and Water Supply Forecasting Program and Soil Climate Analysis Network (SCAN) pilot program. As part of the USDA’s Natural Resources Conservation Service, the NWCC is responsible for producing and disseminating accurate and reliable water supply forecasts and other climatic data to its wide variety of users. The Water Supply Outlook app allows users to access water supply reports in an interactive way. There are two ways to apply spatial filters to focus on the area of interest. The first spatial filter is a drop-down list of available states in the top-right corner. Selecting a state, with Colorado selected in the figure, will remove the other states from the map, zoom the map to the state’s extent, and update the content panel on the left. As part of this update, the list of basins within the selected state changes also. This list becomes a secondary spatial filter. Once the user clicks a basin, the map will filter out all the other basins and zoom to the selected one on the map. The other content components, such as the gauge charts, will update accordingly. Spatial filters are the main mechanism to drill down to the desired area.