ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • ArcGIS Pro
  • ArcMap
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • ArcGIS Pro
  • ArcMap
Esri
English
  • English
  • Deutsch
  • Español
  • Français
  • 日本語
  • Русский
  • 简体中文
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions
  • Map
  • Work with layers
  • Managing layers
  • Back to Top
  • What is a layer?
  • A quick tour of map layers
  • Essential layer vocabulary
  • Managing layers

    • Adding layers to a map
    • Working with group layers
    • Adding x,y coordinate data as a layer
    • Changing a layer's drawing order
    • Working with basemap layers
    • Setting layer properties
    • Displaying layers at certain scales
    • Displaying a subset of features in a layer
    • Repairing broken data links
    • Renaming a layer
    • Viewing metadata from the Table of Contents
    • Saving layers and layer packages
    • Adding and working with query layers

    Interacting with layer contents

    • Identifying features
    • Setting HTML pop-up properties for feature layers
    • Using HTML pop-up windows for feature layers
    • Selecting features interactively
    • Using Select By Location
    • Using Select By Attributes
    • Using Select By Graphics
    • Working with selected features
    • Setting the Selection tolerance
    • Feature editing using layers
    • Measuring distances and areas
    • Using the Find tool
    • Displaying MapTips
    • Using Hyperlinks
    • Using the Time Slider tool
    • Exporting features
    • Query expressions in ArcGIS

    Displaying layers

    • About displaying layers
    • A quick tour of displaying layers
    • Essential layer display vocabulary
    • Drawing a layer using a single symbol
    • Drawing a layer using categories
    • Advanced layer display using representations
    • Drawing features to show quantities
    • Cartographic representations
    • Common layer display tasks
    • Designing maps for optimal performance

    Displaying a subset of features in a layer

    ArcMap 10.8
    |
    Help archive
    ArcGIS Desktop is in mature support and will be retired March 1, 2026. There are no plans for future releases of ArcGIS Desktop, and it is recommended that you migrate to ArcGIS Pro. See Migrate from ArcMap to ArcGIS Pro for more information.
    • Creating a definition query

    When you specify a dataset that you want to draw as a map layer, you often only want to draw some of the features in the dataset. In these situations, you can define a query expression to select a subset of features for the layer display. This is referred to as a definition query.

    For example:

    • You might want to display only cities with a population above a certain threshold.
    • Many datasets, such as roads and street datasets, have subsets of features (classes), and you might want to define map layers for each class of roads independent of the other features.
    • In another case, you might have large enterprise databases with datasets that contain millions of features across wide extents—say for a whole nation or state. Yet, in your maps, you might want to work with only a subset of that data.

    If you only want to display and work with a subset of features in a layer, you can apply a definition query to a layer. You can type your own expression, or you can use the Query Builder dialog box to help you set up your query expression.

    When performing a query on an enterprise geodatabase feature class with both spatial and attribute components, the dialog launched by the Search order button lets you choose whether to perform the spatial search first (the default) or the attribute search first. This enables you to fine-tune how the query will be executed. This button is only present if the data source for the layer is an enterprise geodatabase feature class.

    Note:

    If the Perform the spatial search first option is selected the definition query will limit the features to those available in the extent. If the Perform the attribute search first option is selected, all attributes that match your query from the entire dataset will be selected and then the spatial search will find all those values that are visible in your extent.

    If your map has Data Driven Pages enabled, you can use Page Definition Queries to specify which features of a layer are drawn based on an SQL query. Though similar to other definition queries, page definition queries differ in that they only work with Data Driven Pages and are dynamic. Features are filtered based on the current page. As you iterate through the pages, the query changes and a new set of features appropriate to the new page are drawn. If you have features that overlap page extents and want these features to be displayed in multiple pages, you should consider using Clip to customize your map. This button is only present if Data Driven Pages has been defined for your map document. When Data Driven Pages is defined, it is not present in the layer properties for the layer currently being used as the index layer for Data Driven Pages.

    Caution:

    Definition queries are unavailable if you are working with a table or event layer (x,y or route) data source that does not have an ObjectID (OID) field. This will be the case with text files (.txt files); Excel data (.xls files); and OLE DB data, such as unregistered Oracle files accessed through OLE DB.

    With event data, the workaround is to create a feature class from the tabular data source instead of an event layer. If you are adding a table with no ObjectID field containing x,y data, don't use the File > Add Data > Add XY Data command in ArcMap to create an event layer based on the table. Instead start ArcCatalog, right-click the table, choose Create Feature Class from XY to create a new feature class from it, then add that new feature class into your map. Alternatively, after using File > Add Data > Add XY Data or File > Add Data > Add Route Events functions to create an event layer from a table without an ObjectID, you can export the data to make a new layer. This saves the data to a feature class and therefore writes an ObjectID field. Another option is to use the Make Query Table geoprocessing tool, which allows you to make the table using an OLE DB connection and to specify a column to use for the ObjectID or dynamically add the ObjectID.

    Creating a definition query

    1. Right-click the layer in the table of contents and click Properties.
    2. Click the Definition Query tab on the Layer Properties dialog box.
    3. Enter a query expression.
      Entering a definition query to display a subset of features
      Query Builder lets you create an expression to identify the particular features in the layer you want to display.
      See Building a query expression for more information on how to build valid queries.
    4. Click OK.

    Once you set the definition query, the map is redrawn and displays the subset of features that are selected using your query. The layer continues to be drawn with this feature subset each time the map is refreshed.

    To add all the features back to the layer, simply delete the definition query.

    Related topics

    • Displaying layers at certain scales

    ArcGIS Desktop

    • Home
    • ArcGIS Pro
    • ArcMap
    • Documentation
    • Support

    ArcGIS

    • ArcGIS Online
    • ArcGIS Desktop
    • ArcGIS Enterprise
    • ArcGIS
    • ArcGIS Developer
    • ArcGIS Solutions
    • ArcGIS Marketplace

    About Esri

    • About Us
    • Careers
    • Esri Blog
    • User Conference
    • Developer Summit
    Esri
    Tell us what you think.
    Copyright © 2021 Esri. | Privacy | Legal