Definition Query

This short tutorial introduces the Definition Query, a query tool that allows you to specify which features of a layer to draw.

Suppose you are working on a project in ArcMap, and you’re using a large and detailed dataset, such as an entire state’s road network. Your task is to create a series of road maps at multiple scales- state wide, one for each county, and one for the 5 most populous cities in the state. The state-level map requires including interstate highways, US highways, and state highways. The county-level maps require the same as the state-level map, including county highways. The city-level maps require all roads.

To isolate each subset of the dataset you could run a ‘Select-by-Attributes’ operation, select each category of road and export to a new shapefile, and then add layer in to your map one by one.

OR you could use the definition query, which can save you time and hard drive space because you will not need to create new shapefiles to create your set of road maps.

The Definition Query is a tab in the Layer Properties window that allows you to specify which features of a layer you’d like to display. To access it, right-click on your data layer > Properties > Click the Definition Query tab.

You can click in the white box to write your own query, or you can click the Query Builder button to open the familiar Query Builder window.

To use the Query Builder with Definition Query, simply write a SQL statement to select all features that you want to show on your map in the same way that you would for any other select by attribute operation. For example, if you were working on the state-level road map you would write a SQL query to show all roads categorized as Interstate, US Highway, or State Highway. (SQL Example: “Roads” = ‘Interstate’ OR “Roads” = ‘US HIGHWAY’ OR “Roads” = ‘STATE HIGHWAY’ if my SQL is wrong, please send me a message, I’m not basing this off of any actual data!)

After you write the query, hit OK, and back in the Layer Properties window hit Apply or Ok and you will see that only a subset of your data is shown. This can make your map-making quicker and easier than having to juggle multiple layers of data.

When you’re done making your State-level map, go back to the Definition Query and modify it for your next map to keep the workflow moving along smoothly.

Here’s an example from ESRI on using the Definition Query. They are working with a US County data layer and are only showing counties in the state they are interested in:

Now go give it a try with some of your own data!