Applying filters

A filter presents a focused view of a feature layer in a web map. By limiting the visibility of features in a layer, you can reveal what's important to your audience. For example, you might create a filter on a crime layer so only arsons appear on the map. This filtered view can show patterns of where arsons are set and can help your police department prevent future arson attempts.

You can also set up interactive filters that help your audience explore data themselves. By providing prompts and hints about the available values in the layer, you can guide your audience toward other filters they might want to apply on the features. For example, you might set up an interactive filter on a schools layer so your audience can choose to see elementary, middle, or secondary schools. By default, the layer shows elementary schools. By reading the prompt and hint you've supplied, your audience knows they can change the value to middle or secondary to see different types of schools on the map.

Create filter

Creating filters

You can create filters on hosted feature service layers, ArcGIS Server feature service layers, and ArcGIS Server map service layers that have associated attribute data.

The following steps explain how to create expressions based on the attributes in your feature layer. Only the features that meet the expression criteria will be visible in the map.

Steps:
  1. Open the web map with the feature layer you want to filter in the map viewer.
  2. Click the Contents button in the Details panel.
  3. Click the arrow to the right of the layer name and click Filter. The Filter window appears with a Create tab.
  4. Create your definition expression.
    • Expressions use the general form of <Field_name> <Operator> <Value, Field or Unique>.
    • You can create one expression, multiple expressions, or one or more sets of expressions. A set is a grouping of expressions, for example, Type is elementary and Enrollment is at least 400.
    • If you have more than one expression, choose to display features in the layer that match All or Any of your expressions. All requires that each of the criteria you have specified must be true. Any means that only one of your expressions must be true for the features to display.
    • For the field part of the expression, click the Field drop-down arrow and choose the field you want to query against from the list.
    • For the operator part of the expression, click the Operators drop-down arrow and choose an operator from the list.
    • If you want to filter based on a specific value, choose Value and enter a value in the field. The input box varies depending on the field type.
    • If you want to compare the value in one field versus the value in another field, choose Field, click the drop-down arrow, and choose the field for your expression.
    • If you want to filter based on a specific value in the field you've selected for your expression, choose Unique and select a unique value from your field.
    • If you created an expression based on values or a unique value, you can set up an interactive expression. You cannot ask for values on expressions based on a field. Click the box to the left of Ask for values. Enter information about the value in the Prompt field and a hint in the Hint field.
    • To delete an expression in the filter, click the Delete button Delete to the right of your expression.
  5. Click Apply Filter to enable the filtered view on the map.
  6. To undo the filter and show all the features in the layer, click Remove Filter.

Working with existing filters

If a web map feature layer contains a filter, you see a filtered view of the features. Only the features that meet the filter criteria appear on the map. For example, a map author may have set up a filter on a schools layer that contains elementary, middle, and secondary schools to only show the elementary schools (for example, Type is Elementary). In this case, middle schools and secondary schools are filtered out of the map display. If the map author set up an interactive filter on the schools layer, you can change the value to Middle and now see just the middle schools in the area.

You can access the filter to view the expressions, change any interactive expressions in the filter, and edit the filter. Any changes you make only apply to your view of the web map (unless you own the web map in which case you can save your changes).

The following steps explain how you can view, change, and edit existing filters.

Steps:
  1. Open the web map with the filtered layer in the map viewer.
  2. Click the Contents button in the Details panel.
  3. Click the arrow to the right of the layer name and click Filter. The Filter window appears.
    Filter window
  4. Change, edit, or view the filter.
    • On the Change tab, you can apply a new value for an existing interactive filter. Enter a new value for the expression and click the Apply Filter button. The map display updates with the new filtered view of the feature layer. The tab also displays friendly versions of the expressions in the filter. This tab appears if there are interactive expressions in the filter. If the filter does not contain interactive expressions, you see a View tab instead with friendly versions of the expressions in the filter.
    • On the Edit tab, you can update the expressions. See the Creating filters section for details on how to update the expressions.

Considerations for creating and working with filters

3/24/2014