GIS Cookbook: Getting Started - Performing a Spatial Query
|Keywords: query, spatial, topological, select by location|
Software: ArcGIS 8/9.x
Problem: You want to select map features based on their spatial relationship with other map features.
Description: One capability that distinguishes GIS software from simple drawing packages is the ability to explore the spatial relationships between map features in different layers. These relationships (often referred to as topological relationships after the branch of geometry called topology) include connectivity, adjacency, and containment. GIS software enables researchers to ask questions like:
- Which roads are connected to Interstate 80?
- Which census tracts are adjacent to this industrial park?
- How far is the nearest bus stop from each of my study subjects?
- Which schools are contained within this Metropolitan Statistical Area?
Many of these types of questions can be answered by building a spatial query using the Select By Location dialog. Assuming you have ArcMap open and have added all of the desired data layers, you can build a spatial query as follows:
1. Click on Selection > Select By Location.
Setting the options in the Select By Location dialog can be approached by constructing a sentence that describes the query, beginning at the top with the words, I want to:.
2. The first option is the selection method. In most instances, the default option of select features from is the most appropriate. See Note #1 for more information on selection methods.
3. The next step is to specify which layer(s) contain the features you’d like to select by choosing from the list under the words the following layer(s).
4. Next comes the choice of an appropriate spatial relationship from the drop-down list under the word that:. See Figure 1 for a list of available relationships.
|Spatial relationships available in the Select By Location dialog|
5. To complete the sentence, you must choose the other layer participating in the relationship by selecting from the list under the words the features in this layer:.
6. Click Apply to execute the query. Figure 2 shows an example of a point-in-polygon selection.
|Selecting CITIES features that intersect features in the Western States layer|
7. Optionally, you may want to specify that only the selected features in the query layer (Western States in this example) be used to find matching features in the target layer. This can be done by clicking the Use selected features checkbox as shown in Figure 3.
|Selecting CITIES features that intersect just the selected features in the Western States layer|
8. Buffering the features in the query layer is another optional setting. When the are within a distance of relationship is selected, this checkbox is automatically checked. Upon selecting this option, the next step is to enter the desired buffer distance. Figure 4 shows an example of selecting cities within 100 miles of the Nevada border.
|Selecting CITIES features within a distance of 100 miles from the selected Western States features|
1. The first drop-down list in the Select By Location dialog provides a list of selection methods. It defaults to Select features from, which means that if there are already some features selected, that selection set will be wiped out. Other choices include: Add to the currently selected features in, Remove from the currently selected features in, and Select from the currently selected features in. These other selection methods may be used to evaluate multiple spatial queries one at a time.
2. If you open the layer’s attribute table, note that the tabular records associated with the selected map features are also shown in the selection color.
3. Besides simply seeing which map features meet some criteria, creating a selection set is an important step in performing a number of other GIS functions. These include:
- Using the selection set for further analysis (such as buffering the selected features)
- Using the selection set to select features in another layer
- Editing the selection set (either the geometries of the features or their attributes)
- Creating a new layer from the subset
- Calculating summary statistics for the selected features
- and more...
|Authored by: Jim Detwiler Modified: 3/6/05|
Copyright © 2002-2014 by Regents of University of California,
Cookbook: Ben Sprague, Ethan Sundilson, Carlin Wong, Sam Ying