Skip To Content

Modify a query layer

Once added to the map, the query and other properties that define the query layer can be modified. This is done on the Edit Query Layer dialog box, which can be opened from the Layer Properties dialog box.

When a spatial table stored in a database is added to the map, it creates a query layer with default properties as determined by the first row in the table. These properties may not be ideal however. For example, a spatial table may have multiple geometry types for a single spatial attribute. A spatial table containing a collection of cities can be modeled in the database as both a point and a polygon geometry type. Feature layers in ArcGIS can only have a single geometry type, so the first row in the table provides the default geometry type property. In this example, if the first row in the spatial table containing cities data returns a point geometry, the feature layer for cities will be a point geometry type. If you would prefer to view the cities as polygons, you can modify the query layer properties on the Edit Query Layer dialog box and change the geometry type to polygon.

Other properties, such as a query layer's dimensionality, spatial reference, SRID, and unique identifier field, are also determined by the first row returned from the spatial table. Similar to the geometry type, you can access these properties by clicking Next on the Edit Query Layer dialog box and modify them.

When you change the dimensionality of the query layer, the geometry field value of the displayed features are modified to match that change.

For example, for a layer defined with x, y, z, and m dimensionality in the database, if you edit the query layer by unchecking the Coordinates include M values and Coordinates include Z values options in the advanced options, all the features in the layer will display only the x and y values. Alternatively, if the layer is defined with only x and y dimensionality (Coordinates include M values and Coordinates include Z values options are unchecked), you can modify the query layer to include m and z values by checking these options, and all the features will display x, y, z, and m values. If a feature does not contain a z or m value in the database, those values will appear as null in the query layer.

When you change the spatial reference or SRID of the query layer in the advanced options of the Edit Query Layer dialog box, the features displayed in ArcGIS Pro are filtered based on that spatial reference or SRID value.

Modify query layer properties

Once added to the map, you may decide that you want to change the SQL query or the query layer properties. This is done on the Source tab of the layer Properties dialog box.

  1. Select the query layer in the Contents Pane.
  2. Right-click the layer and choose Properties Properties from the context menu.
  3. Click the Source tab on the Layer Properties dialog box.
  4. The data source table has a property named Query, which displays the current SQL query for the layer. Click the Edit button . The Edit Query Layer dialog box appears, where you can make the desired modifications to the query layer.
  5. Click Finish to save your modifications to the query layer.

Related topics