ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for 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

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

What is a query layer?

  • A quick tour of working with query layers

A query layer in ArcGIS is a spatial layer or stand-alone table from a database defined by an SQL query. You make a Database Connection and add layers or tables from the database to your map. Since query layers use SQL to directly query database tables and views, spatial information used by a query layer is not required to be in a geodatabase.

When you add a spatial table (feature class) from a geodatabase to the map, ArcGIS reads spatial information from geodatabase system tables to draw features. Conversely, when you add a spatial table from a database to the map, ArcGIS queries the database to determine the information it needs to draw the features, including the unique identifier field (ObjectID), whether the layer includes z- or m-coordinates, the geometry type (point, multipoint, line, or polygon), the spatial reference, and the spatial extent of the data. ArcGIS queries the table to get the information because most databases do not store this information for each layer.

You can create query layers in ArcMap by dragging a table onto the map, as mentioned above, and ArcGIS defines an SQL query that returns all data from the table. You can modify the query layer to filter the data or join the table to another table. Alternatively, you can define the query layer using the New Query Layer dialog box. This allows you to build your SQL query before drawing all the data. This is useful if you only want a subset of the data in the map.

The query is executed every time the layer is displayed or used in ArcMap. This allows the latest information to be visible without making a copy or snapshot of the data and is especially useful when working with dynamic information that is frequently changing. The query layer's functionality works with any DBMS supported by ArcGIS.

A quick tour of working with query layers

  • To use query layers in a map, either drag a table from a database or geodatabase onto the map, or define a query against the tables and views in the database using the New Query Layer dialog box.
  • Query layers behave in the same way as other feature layers or stand-alone tables, so they can be used to display data, used as input to a geoprocessing tool, or accessed programmatically using developer APIs.
  • After you create a query layer, you can save it as a layer file (.lyr) or use it to create a layer package (.lpk). This makes it easy to share query layers with other applications, map documents, and people.

Related topics

  • Creating a query layer

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

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