1. Chapter Four
4. Querying data and Analyzing spatial
Relationship
BY:-Samuel Zewdu
GIS and Remote sensing Expert
May 2019
2. Contents
4 Querying data and Analyzing spatial Relationship
4.1 Create a query in ArcMap
Step1: Start ArcMap and open a map document
Step 2: Explore the towns data
Step 3: Create a query
Step 4: Apply the query and examine the results
Step 5: Create another query and refine the selection
4.2 Perform location query in ArcMap
Step 1: Open a map document
Step 2: Create a location query
Step 3: Apply the location query and examine the results
Step4: Create another location query
3. 4.3 Query data based on attributes and locations
Step 1: Open a map document
Step 2: Find towns with greater than a 20000 people
Step 3: Find towns that fall inside Oromiya region
Step 4: Find towns within a distance 50 km from the
main cities
4.4 Spatial Relationship
Step 1: Open a map document
Step 2: Use the Buffer tool to buffer the mete stations
Step 3: Use the Buffer tool to buffer roads
Step 4: Examine the road buffer layer
4. 4.5 Analyze data using Buffer and Overlay
Step 1: Open a map document
Step 2: Use the Buffer tool to buffer the lake and
river
Step 3: Union the lake_Buf1 and river_buf1
5. 4.1 Create a query in ArcMap
By creating a query, you can select all the
features that match your request at one time.
After completing this instructor-led
exercise, you will be able to:
▪ Use Select By Attributes to construct a
basic query
▪ Use Select By Attributes to refine your
selection
6. Step1: Start ArcMap and open a map
document.
Start ArcMap.
From your chapter_4DESK1Exercise01
folder, open Ethiopia.mxd. You see a map
of Ethiopia and towns
7. Step 2: Explore the towns data
In the table of contents, open the attribute table
for the Ethio-town layer.
Scroll through the table from left to right to
scan the attribute fields.
You'll use the POP field.
Close the attribute table
8. Step 3: Create a query
From the Selection menu, choose Select By
Attributes.
The Select By Attributes dialog box opens. It
contains the following components
9. Step 3: Create a query
For Layer, make sure Ethio-town has been
selected.
For Method, make sure Create a new selection
has been selected.
Click the "POP" attribute and click Get
Unique Values. The unique values for the
POPPOP field are listed.
Scroll down in the unique values list to see the
range of population values.
The values range from 34 to 2084588. Now
you will build a query to select cities with a
population of more than 50,000.
10. Step 3: Create a query
Double-click "POP."
It displays in the expression box.
Click the Greater Than operator .
Type 50000 without any commas.
Your dialog box should look like the one
below.
11. Step 4: Apply the query and examine the
results
Click Apply at the bottom of the dialog box.
Move the dialog box aside so you can see the
map. You see that a number of towns are
highlighted.
Open the attribute table for the Ethio_town
layer.
Fourteen out of 935 towns are selected.
13. Step 4: Apply the query and examine the
results
Click Selected.
Only the selected cities are displayed and
highlighted.
Locate the POP field.
Right-click the POP field heading and
choose Sort Ascending.
Scroll down to verify that the range of
population values matches your request.
Close the attribute table.
14. Step 5: Create another query and refine the
selection
Now that you have selected towns with more
than 50,000 people, you want to narrow your
selection to the ones that are belong to Oromia
region.
At the bottom of the Select By Attributes
dialog box, click Clear.
Near the top of the dialog box, change the
Method to Select from current selection.
15. Step 5: Create another query and refine the
selection
Double-click "REGION" to add it to the
expression box.
Click Get Unique Values.
You see that OROMIA' is one of the attribute
values.
Click the Equal operator .
Double-click ' OROMIA' '.
Click OK to apply the expression and close the
dialog box. You see that fewer cities are now
selected on the map.
Open the attribute table for the Ethio_town layer.
16. Step 5: Create another query and refine the
selection
Question 1: How many towns are selected?
Click Selected to see only the selected records.
All the selected towns are belong to Oromia
region. You see their names in the TOWN_NAME
field.
Scroll over to the POP field and sort the values in
ascending order. The population values still
exceed 50,000.
Close the attribute table.
From the Selection menu, choose Clear Selected
Features.
Do not close ArcMap
17. 4.2 Perform location query in ArcMap
After completing this instructor-led exercise, you will
be able to:
▪ Use Select By Location to construct a location
query
▪ Use Select By Location to select features based on
different types of spatial
relationships
18. Step 1: Open a map document
If necessary, start ArcMap.
Open Ethiopia.mxd from your Chapter_4
Exercise2 folder.
If prompted to save changes to an open map
document, click No.
You see a map of Ethiopia with Ethio_town and
Ethio_river
19. Step 2: Create a location query
Suppose you want to select towns which are
within the distance of 1km form nearby river.
From the Selection menu, choose Select By
Location.
The Select By Location dialog box opens. It
contains the following components
21. Step 2: Create a location query
For the selection method, choose this option: select
features from.
From the source layer, select Ethio_river
For the spatial relationship type, from the drop-
down list, choose are within a distance of the
source layer feature Note:
A buffer is a zone or area around a map feature that is a
specified distance from the feature. In this case, the
software creates a 1km buffer around the Ethio_river. If
any towns falls at least partly within that buffer, it will be
selected.
22. Step 3: Apply the location query and
examine the results
Click Apply at the bottom of the dialog box.
Move the dialog box aside so you can see
the map display.
You see that a number of towns near the
rivers highlighted.
From the Selection menu, choose Zoom To
Selected Features to zoom in for a closer
look.
Open the attribute table for the Ethio_town
layer.
23. Step4: Create another location query.
Now that you have selected towns within 1 km of
the rivers, you want to determine which woreda
they are in.
In the Select By Location dialog box, uncheck
Ethio_town and check Eth_wereda_94.
For the spatial relationship type, choose this option:
intersect.
In the second list of layers, choose Ethio_town.
Make sure the check box next to Use selected
features is checked.
Make sure the check box next to Apply a buffer is not
checked.
24. Step4: Create another location query.
Your location query should look like the
following graphic. It reads like this: "I want to
select features from Eth_wereda_1994 that
intersect the (selected) features in
Ethio_town .
25. Step4: Create another location query
Click OK to apply the location query and close the
dialog box.
The selected Wereda are highlighted in the map.
Open the attribute table for the Eth_wereda_94
layer.
You see that 120 Weredas are selected.
Click Selected.
If you would like, sort the DESCRIPT field
alphabetically
26. 4.3 Query data based on attributes and
locations
Abebe wants to open a small shop in a town with
people living in the town greater than 20,000
people . The town he wants to open the shop should
be in Oromiya region and close to the main cities
for supply of items
In this exercise, you will work with town data and
administrative data. You will create attribute and
location queries to find places place that meet
Abebe's criteria
27. 4.3 Query data based on attributes and
locations
After completing this exercise, you will be able to:
Use Select By Attributes to create query
expressions and refine the selection
Use Select By Location to select features
based on different types of spatial relationships
28. Step 1: Open a map document
If necessary, start ArcMap.
From your Chapter_4Excercise4 folder,
open Ethiopia_2.mxd.
If prompted to save changes to an open
map document, click No
29. Step 2: Find towns with greater than a 20000
people
Your first task is to select town based on their
population. You'll open the attribute table for the town
layer and examine the fields before building a query
Open the attribute table for the Ethio_town layer.
Scroll through the fields.
Close the attribute table.
From the Selection menu, choose Select By Attributes.
For Layer, Ethio_town.
Set the Method to Create a new selection.
Click "POP," then click Get Unique Values.
Build this query: "POP" >20000. Hint: Type the value
directly in the expression
30. Step 2: Find towns with greater than a 20000
people
box. Make sure you have four zeros.
Apply the query.
Move the dialog box aside to see the map.
Open the attribute table for the
Ethio_town layer.
Close the attribute table
31. Step 3: Find towns that fall inside Oromiya
region
In the Select By Attributes dialog box, click Clear
to clear the expression box.
Change the Method to Select from current
selection.
Scroll down in the list of attribute fields until
you find "REGION", then select it.
Click Get Unique Values and scroll down to see
the range of values.
Build this query: "REGION" ="Oromia".
Click OK.
32. Step 3: Find towns that fall inside Oromiya
region
Open the attribute table for the Ethio_town.
Click Selected.
Question 4: Which towns are selected?
Close the attribute table
33. Step 4: Find towns within a distance 50 km
from the main cities
Open the Select By Location dialog box.
Create this query: "I want to select features from
Ethio_town that are within a distance of 50 km
from the main cities.
Click Apply and move the dialog box aside.
towns inside the selected towns are now selected.
Open the attribute table for the Ethio_town layer
and click Selected.
Sort the Town name field and view the list of cities.
Question 5: Which towns are selected?
Close the attribute table
34. 4.4 Spatial Relationship
The Buffer tool creates zones of a specified
distance around features or selected features.
The result is a new feature class with new
features. In this instructor-led exercise, you
will use
the Buffer tool to zones around point and line
data. Before buffering the layers, you will
examine their attribute tables
35. 4.4 Spatial Relationship
After completing this instructor-led
exercise, you will be able to:
Use the Buffer tool to buffer point
features
Use the Buffer tool to buffer line
features
36. Step 1: Open a map document
If necessary, start ArcMap.
From your Chapter4 Exercise3 folder,
open Buffer_excercise.mxd.
Open the attribute table for the
Ethio_metestation layer.
Close the attribute table.
37. Step 2: Use the Buffer tool to buffer the
mete stations
If necessary, open ArcToolbox by clicking the
Show/Hide ArcToolbox Window button . Dock or
float the ArcToolbox window as desired.
If necessary, expand the Analysis Tools toolbox.
Expand the Proximity toolset.
You will use the Buffer tool to create zones around
Mete station.
Double-click the Buffer tool to open it.
38. Step 2: Use the Buffer tool to buffer the mete
stations
You see a dialog box on the left and a Help panel on
the right. You may need to click
Show Help to see the Help panel. The graphics
show an example of buffering polygons. Next, you
will fill out the dialog box and run the tool.
Click the down arrow for Input Features and
select Ethio_metestation from the list.
For Output Feature Class, change the name of
the feature class to Ethio_mete25000
39. Step 2: Use the Buffer tool to buffer the
mete stations
Under Distance, if necessary, set the Linear unit
to meter (using the drop-down list), and enter
the value 25000.
Click OK to run the tool and create the buffer
layer
The progress window displays, showing the
buffer process.
If it does not close automatically, close the
progress window when the process is
completed.
40. Step 3: Use the Buffer tool to buffer roads
Double-click the Buffer tool to open it.
Click the down arrow for Input Features and
select Ethio_road from the list.
For Output Feature Class, change the name of
the feature class to road_buf100.
Under Linear Unit, set the distance to 100
meter.
41. Step 3: Use the Buffer tool to buffer roads
Instead of creating individual buffers around each
river feature, you will dissolve the buffers into a
single feature, removing any overlap between
them.
For Dissolve Type, choose ALL from the drop-
down list.
Click OK to run the tool and create the new
feature class.
The new layer, road_buf100, is added to the map.
You see a single 100-meter buffer around the
entire road line
42. Step 4: Examine the road buffer layer
Open the attribute table for the river_buf100 layer.
You see a single record representing the buffer
polygon. Close the attribute table.
Now you will save your changes.
Save the map document in your
chapter4Exercise3 folder as My_buffer.mxd.
Leave ArcMap open
43. 4.5 Analyze data using Buffer and Overlay
Many protected areas, such as lakes and rivers, face many
type of problems . Here are a few of the solutions:
Create buffer zones around protected areas to help
provide species with additional breathing room
In this exercise, you will work with lakes and rivers. You
will create buffers around lakes and rivers
After completing this exercise, you will be able to:
Use the Buffer tool to buffer lakes
Use the Buffer tool to buffer rivers
Use the Union tool to combine the buffer layers
44. Step 1: Open a map document
If necessary, start ArcMap.
From your Chapter4Excercise4 folder,
open Protected_zones.mxd.
You'll buffer these features to create protected
areas around them
45. Step 2: Use the Buffer tool to buffer the lake
and river
If necessary, open ArcToolbox by clicking
the Show/Hide ArcToolbox Window
button . Dock or float the ArcToolbox
window as desired.
If necessary, expand the Analysis Tools
toolbox.
If necessary, expand the Proximity toolset.
Double-click the Buffer tool to open it.
46. Step 2: Use the Buffer tool to buffer the lake
and river
Click the down arrow for Input Features and
select lake from the list.
For Output Feature Class, change the name
of the feature class to lake_Buf1.
Under Distance, set the Linear unit to meter
and enter the value 500.
Click OK to run the tool and create the
buffer layer.
47. Step 2: Use the Buffer tool to buffer the lake
and river
The progress window displays, showing the buffer process.
If it does not close automatically, close the progress window
when the process is completed.
lake_Buf1 is automatically added to the map.
In the table of contents, drag lake above Parks_Buf1.
You see 500-meter buffers around lakes that can serve as
protected areas. Next, you'll buffer the rivers to create
protected areas around them too.
Do the same for to create buffer around river with 400m
48. Step 3: Union the lake_Buf1 and river_buf1
Use union tool from the Analysis
Tools toolbox from overlay section
Give the river buffer and the lake
buffer as the union layers
Giver Protected_area for the new
created feature
49. Step 4: Save your results
Save the map document in your
Chapter4Exercise4 folder as
Protected_buffer.mxd.
Close ArcMap.