In this week’s blog, we would like to compare two handy, yet different, tools that help identify map features through two different selection processes. This post is focused on the HTML5 map, but there will be many similarities if you are using the Silverlight map.
The two tools, Filter and Query, are located in the “Maps & Data Sources” tab in the upper left hand corner, just above the layers list. The icons of each tool are displayed below:
While the tools may seem similar, one may be better suited for your task than the other. We will start by walking through how to use each tool and their different capabilities. Then we will discuss the appropriate situations to use each tool.
Query is a tool that allows us to select features of interest on a map based on specific attributes. Typically query tools are used to select specific genres of a map feature. Map features consist of points, polylines, and/or shapefiles.
The first step to writing a Query is to make sure the layer you are targeting is turned on, then select the Query icon.
Once the icon is selected, a query table will appear on the left side of the map pane over the layers list.
The next step is to select the map feature you wish to target from the “Layers” drop down list. For this exercise we will select the “Trees” layer.
As you can see above, there is an option to set a “Spatial Filter”. The two options for this feature are “None” or “Current Extent.” “Current Extent” limits your query to items that fall only in the extent of the window view. Setting the spatial filter to “None” allows you to access all of the data within the maps extent.
Once the target layer and spatial filter are set you can select the “Add Another Condition” option. This part of the tool allows you to select, or “query,” specific attributes you wish to highlight within your target layer.
Now click “Add Another Condition” the “Find results in Trees where:” option appears (see Figure 4 above). You will see three drop down lists containing fields from the attributes table within the “Trees” layers (see Figure 5 below). This is where you select your targeted field. The next drop down is the field that determines the operation of your intended query. Operations consist of “contains, does not contain, =, or ><, etc.” Operations can be specific to attribute fields. The last blank on the right is where you will input the unique value that you are intending to search for within the targeted field.
Additionally, you are able to set multiple conditions to make a query more specific. (See Figure 5 below).
For this exercise, I selected Species > Contains > Norway Maple. I left the Spatial Filter as “None” because I want to select every Norway Maple that exists in the map extent. The last step is to hit the ‘Search’ button located below “Spatial Filters.” The map will display pins indicating the locations of Norway Maple trees. (See Below Figure 6).
The “Query Results” column on the left hand side will show how many Norway Maples are within the map as a result of our query. The results column also lets you select each tree individually, so you may view or edit a specific tree’s attributes. The map allows you to view the spatial reference to where each tree is located.
Query is a nice tool for segregating a specific attribute or attribute range amongst a data set within a layer. It is easy and convenient for finding how much of a feature is present, identifying their location, or singling out a feature to conduct edits.
Now we will to look at the “Filter” tool. This tool is similar to Query but displays different functionality.
The Filter tool is set up in the same manner as Query.
At the top, you can select your target layer from the drop down menu. Then select “Add Another Condition” so you can target a specific attribute field as well as a unique value from the attribute field. Also, you have the operator field, which is located between the attribute selection drop down list (SPECIES) and the unique values drop down list (Norway Maple). (See Figure 7 above)
For this exercise I added an additional filter function to make my search more specific. Using the same steps as before, I indicated the filter to find Norway Maples that have a diameter that is >= 18cm. (See Figure 7 above).
Once parameters are set for the search, press “Filter” and your results will show on the left as follows: (See Figure 8 below)
Notice all features that fall outside of our filter function have been removed from the map. Every tree that is displayed is a Norway Maple that has a diameter >= 18 cm.
This is where the Filter and Query tools differ. The Query tool selects the target features amongst the rest of the data set. The Filter tool eliminates or “filters” all other features that fall outside of the filter’s parameters. This makes the Filter tool valuable for creating maps that only show the feature of interest. Filter eliminates clutter within a data set and allows your audience to focus on the specifics of your map search.