Before tackling this tutorial, you will need to download and install a dataset following these instructions:
Create a folder called Selection somewhere under your personal directory (e.g. C:\Users\jdoe\Documents\Tutorials\ Selection\).
Download the data for this exercise then extract the contents of Selection.zip into your newly created Selection folder.
The youth center task force has been created to find a suitable location for a new youth center. You are asked to provide the city with a map that shows locations that meet the following criteria:
Lot must be vacant;
Lot must be within 50 meters of a high density youth population census block (youth density greater than 260 people / km² );
Lot must be between 0.5 and 2.0 acres in size (inclusive).
Open the Selection.aprx map document.
You should see two layers in the table of contents, but only one layer (Waterville parcels) is displayed.
You are asked to locate areas where the youth population is greater than 260 people / km² . The youth population density is an attribute of the Waterville census layer thus requiring an attribute query. You will therefore use the Select Layer by Attribute tool to satisfy this criterion.
Click on the red Tools button under the Analysis tab to enable the Geoprocessing pane.
In your Geoprocessing pane Find Tools field type Select by Attribute.
This will bring up a list of suggested functions.
Click on the Select Layer By Attribute tool. (This should be the first tool option from the list of options).
In the Select Layer By Attribute tool set the Input Rows to Waterville census (this is the layer we are selecting from).
Make sure that New selection is chosen as the Selection type.
Next, click on the New expression button.
This will bring up the expression builder.
There are two ways in which you can define queries in the expressions box. You can build the expressions using the pull-down option (the default) or you can type out the expression using SQL syntax. Both options are presented next. Feel free to implement one of the two options.
From the pull-down menus, build the query as shown in the figure. You will need to type in the value 260 in the last field.
Toggle the SQL switch to ON.
Type the expression youth_dens > 260. (Note that this may already be typed in if you already adopted Option 1)
You'll note that as you are typing the field name, the expression box will attempt to autocomplete the field name. This is a feature worth taking advantage of since it can help minimize typos in your syntax.
Click Run to run the geoprocess.
Turn on the Waterville census layer to see the selected features.
To list the number of selected features, toggle the Contents pane to List by Selection.
The query identifies 141 polygons that satisfy this first criterion.
When multiple queries (by attribute and/or spatial properties) are to be implemented in a workflow, you have the choice to proceed by working off of existing selections, or you can export each selection to an intermediate data file, then work off of that intermediate file. The latter can prove less error prone and easier to troubleshoot if a selection goes wrong in the pipeline, but it has the disadvantage of creating many intermediate files that can clutter your project folder. For smaller sets of queries, working off of existing selections is less problematic and usually faster. This exercise will adopt this latter approach (i.e. we will work off of existing selections).
This next step involves another attribute query whereby we are asked to identify all Waterville parcels deemed vacant.
Open the Select Layer By Attribute tool from the Geoprocessing pane. This tool may already be present in the pane, if not, you can click on the left arrow in the upper-left hand corner of the pane to jump back to the Geoprocessing pane search window or to its main window.
Set Waterville parcels as the Input Rows and New selection as the Selection type.
Create a new expression whereby Type is equal to "Vacant Land". If you choose the SQL approach, the expression should look like: Type = 'Vacant Land'.
Click Run to run this geoprocess.
You should now have 273 Waterville parcel polygons satisfying the query.
This next step requires a different geoprocessing tool: one that allows us to identify features from one layer that satisfy a specified spatial relationship with another layer. We will therefore need to switch to another geospatial processing tool: Select layer by location.
In the geoprocessing window pane, navigate back to the Search window by clicking on the back arrow in the upper left-hand corner of the pane.
In the search window, type Select by location.
One of the first suggested geoprocesses should be Select Layer by Location.
Click on the Select Layer by Location tool.
Set the Input Feature field to Waterville parcels (this is the layer we are selecting from).
Set the relationship to Within a distance.
Set the Selecting feature to Waterville census.
Set the search distance to 50 meters
Choose Select subset from the current selection from the Selection type pull-down menu.
Note that it is important that you specify that you want to work off of an existing selection. Had you chosen a New selection option in the Selection type field you would have lost the vacant lot query selection.
Also note that we do not need to specify that we are working off of the select census polygons. By default, geoprocesses will limit the features to those that are selected if a selection exists.
Click Run.
This should reduce the selected parcels to 138 polygons.
Finally, we need to limit the vacant lots to those whose acreage is greater than or equal to 0.5 acres and less than or equal to 2.0 acres. While this query makes use of one of the layer's spatial properties (area), we will not be using the Select Layer by Location tool which focuses on one layer's spatial relationship relative another layer. Here, the area field is part of the Waterville parcels layer's attribute, hence the reason why we'll want to use the Select Layer by Attribute tool.
At this point, it's important to remember that we have multiple selections in play so we need to be careful not to inadvertently clear the existing selections when tackling this final geoprocessing step.
In the geoprocessing window pane, navigate back to the Search window by clicking on the back arrow in the upper left-hand corner of the pane.
You can click on the back arrow one more time to get to the main geoprocessing pane.
A list of recently run geoprocessing tools are shown at the bottom of the pane (under the Recent rubric). This is yet another way to access some of the geoprocessing tools.
Select the Select Layer by Attribute tool.
Set the Waterville parcels as the Input Rows value.
Make sure to set the Selection type to Select subset from the current selection. Remember, you are working off of a previous selection.
Piece together two separate expressions: one satisfying the "greater than or equal to 0.5" criterion and the other satisfying the "less than or equal to 2.0" criterion.
You can add an expression by clicking on the Add Clause button.
Conversely, you could write out the SQL expression as AREA >= 0.5 And AREA <= 2. Note the Boolean operator AND in both the pull-down interface and the SQL statement. This is stating that both expressions must be satisfied.
Click Run.
You should now be left with 32 parcels that satisfy all of the listed criteria.
The last step involves exporting the selection to a dedicated GIS file. It's important that you do not clear the selection before exporting the layer. Doing so will export the entire layer.
In the Content's pane, right click the Waterville parcels layer and select Data >> Export Features. Make sure NOT to clear the selection.
Set the Output Location to the current project folder (should be the Selection folder). When navigating for the folder, look under the Folders tab for the Selection folder.
Set the output file name to vacant_lots.
Click OK.
You'll note that the export function provides the capability to add query expressions much like the Select Layer by Attribute tool. However, we do not need to make use of it here.
Feel free to symbolize your final feature layer as you see fit. Here, the background parcels layer is set to 50% transparent and the vacant lots layer is assigned a vivid red hue to help the small polygons stand out from the background layer.