Interacting with a Selected Subset

One of the major advantages of GIS technology is that the linking of tabular data to geographic features not only leads to easy symbolization but also allows powerful attribute queries that zero in events of interest.

Structured Query Language (SQL) is the standard query language for attribute queries in ArcGIS. The ArcGIS implementation of SQL requires than an attribute name, such as Crime, be placed in double quotation marks in the query syntax. Text values need to be put in single quotation marks. For example, if we want to find all types of crime that are robberies, our syntax is:

“crime” = ‘robbery’

After executing a query with the above criterion, ArcGIS highlights all the records in the table and all the crime point features in the map where the type of crime was a robbery.

Logical Operators

There are several logical operators available: =, >, <, >=, <=. You can include these operators when your query includes numerical features.

For example, if we want to find all the counties with population less than 250,000, our query is: “population” < 250000

Compound Criteria

Compound criteria are made up of two or more simple criteria connected with either an AND or and OR connector.

AND means that both criteria must be true for corresponding features (and records) to be selected.

For example, if we want to find all the counties that belong to the State of California with a total population below 250,000:

“state” = ‘CA’ AND “population” < 250000

OR means that either criteria is true for corresponding features to be selected. For example, we want to select all the crimes that are robbery and assault:

“crime” = ‘robbery’ OR “crime = ‘assault’

Goals

In this tutorial, you will learn about:

    • The elements of common selection queries in ArcGIS

    • Query expressions in ArcGIS use the SQL syntax

    • Select records in a table interactively

    • View all or only the selected records

    • Highlight records within a selection set

ArcGIS Pro automatically opens the start page. Here you find options to either open an existing project or create a project using one of the available templates. These templates provide a starting point for the project. Additional maps, scenes, and catalog views can be added to your project at any time, regardless of the initial template.

On the start page, under Blank Templates, click Map.

On the Create a New Project dialog box, in the Name box, type Querying_tables.

Go to the Start menu and open ArcGIS Pro and sign in using your Clemson ID.

To do this, click the Sign In menu at the top corner.

Click on Enterprise login. In the Your ArcGIS organization’s URL box, enter clemson so that your URL reads: clemson.maps.arcgis.com. Select Continue.

A new window appears. Click on Clemson University.

The Clemson University regular login screen appears. Enter your Clemson username and password.

In order to get started, you must first create a project. As you learned so far, a project contains maps, layouts, tasks, and connections to servers, databases, tools, and folders.

1. Start a new project

To save a project to a different location click the Browse button and browse to the folder Working_with_Tabular_Data on the C Drive.

2. Connect to folder and add data to your map

Under the Catalog pane right-click Folders and click Add Folder Connection . Navigate to :\\Working_with_Tabular_Data and click Ok.

The folder connection appears in the Catalog pane in the Folders category

.

Under the Catalog pane click on Project, expand Folders and then expand Working_with_Tabular_Data and expand TabularData.gdb. Right-click on Counties_demographics and add it to your map.

3. Select data by attributes

Let’s begin by identifying counties in the state of South Carolina.

A selection by attributes identifies the subset of features in a map layer that meet the query criteria. Once you execute this tool, the selected features will appear colored both on the map and in the corresponding attribute table. Once the features are selected, you can export them to a new map layer. On the Map tab in the Selection group, click Select By Attributes to open the Select Layer By Attribute geoprocessing tool. Choose the Counties_demographics as the layer from which you want to select. You can specify the Selection type to control how the selection is applied and what to do if a selection already exists in the view. Here, make sure you choose New selection. Enter a query expression using one of the following methods: Click New Expressionand choose RG_Name field in the first drop-down. In the next drop down choose is equal to and in the last one pick South Carolina. Click Run to execute the selection query and see selection results.

How many counties were selected?

Now, let's say we want to select all the counties in South Carolina which have a total population greater than 80,000.

Click Add Clause to begin adding to your query. For the first drop-down, choose And, for the second one 2019 Total Population, the third one is equal to, and the last one 80,000. Click the

button to validate the expression.

Click Run

to execute the selection query and work with the selection results.

If you click on SQL you can type an expression directly. Click the button to validate the expression.

4. Exercise on your own

Pick a state other than South Carolina and select counties with the population above 100,000.