Professional Documents
Culture Documents
Vector Analysis
GISA01
Vector Analysis
6 Vector Analysis
6.1. Purpose
The aim of this exercise is to provide you with an introduction to vector analysis and
attribute handling. More specifically you will learn:
- About different kinds of selection methods to select polygon, line or point features.
- How to structure and combine spatial queries.
- How to perform a simple overlay.
- How to select features by graphics.
You will assist a fictional a French family named Renoir to plan their summer holiday in
Scania, in southern Sweden. The Renoir family consists of a mother and father with two
kids and a dog. With them, they have bicycles and canoes, which they would prefer to
use during their stay.
6.2. Data
In Moodle, you can find a zip-file with the name DATA6_Vector_Analysis. Download
and save the file to your computer and use WinZip to unzip the files. The unzipped files
contain the following data:
Borders Shapefile: .shp, .dbf, .shx, .avl.
Castle Excel file: .xls.
Nature_reserves Shapefile: .shp, .dbf, .shx, .avl.
Hotels Shapefile: .shp, .dbf, .shx, .avl.
Lakes Shapefile: .shp, .dbf, .shx, .avl.
Roads Shapefile: .shp, .dbf, .shx, .avl.
Watercourse Shapefile: .shp, .dbf, .shx, .avl.
Create a folder in your local working directory with the name 6_Vector_Analysis (e.g.
C:\GISA01\Practical\6_Vector_Analysis). It is recommended that you keep an organized
file structure on your computer.
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 1
Vector Analysis
6.3. Background
You have previously learnt how to select features interactively (point and click) and by
using SQL-queries. In this exercise you will also learn how to select features based on
their location relative to other features, known as a spatial query.
There are a variety of selection methods available and some of the more common
selection methods will be briefly described in this section. However, you can learn more
about the different spatial selection methods in ArcGIS Desktop Help. In the images that
follow, features colored black represent the input layer, grey features represent the source
layer and light blue features represent the output of the selection method.
Intersect
This method selects features that share common parts with features in the source layer. If
we use the same example as above, road segments within nature reserves will also be
selected.
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 2
Vector Analysis
Contain
This method selects features in the input layer that contain the features of the source
layer. For instance, you can select nature reserves that have lakes within them. Thus,
nature reserves that do not enclose a lake will not be selected.
Completely contain
This method is used to select polygons in the input layer that completely enclose polygon
features in the source layer. This method differs from Contain in that the boundaries of
the input features cannot touch the source features.
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 3
Vector Analysis
have at least two contiguous vertices in common. Features will not be selected if they
simply just cross.
Are identical to
This method selects any feature having the same geometry as a feature of another layer.
The feature types must be the same. For example, you use polygons to select polygons,
lines to select lines, and points to select points.
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 4
Vector Analysis
6.5. Method
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 5
Vector Analysis
Question 6.1: Which hotels accept pets and are within a distance of 1000m from a
beach?
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 6
Vector Analysis
Line segment
Wide Narrow
A (Largest) A1 A2 A3 A4 A6 A6 A7 A8
B B3 B4 B6 B6 B7 B8
C C4 C6 C6 C7 C8
D D6 D6 D7 D8
E E6 E6 E7 E8
F F6 F7 F8
Drainage basin
G G7 G8
H (Smallest) H7 H8
Now, you want to select features that are based on the letters A to F in combination with
numbers from 1 to 6. This can be done by implementing a text search. However, since it
for the most part is easier base selections in ArcGIS on numeric fields you will to use the
field RODK instead. The field RODK is basically a numerical representation of the codes
in the field KOD and features that are based on the letters A to F in combination with
numbers from 1 to 6 in KOD all have numbers that are less than or equal to 206 in
RODK.
- Use Select By Attributes to select features in Watercourse where the numbers in
RODK are less than or equal to 206. Check the amount of features selected in
the attribute table. The selection should result in 380 selected features.
Close Select By Attributes and the attribute table and save your selection as a separate
shapefile (right click on Watercourse in the TOC and choose Data > Export Data).
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 7
Vector Analysis
- In the Export Data dialog window, choose to export selected features. Give
your new shapefile the name suitable_watercourses, save it with the rest of
your data and choose to add it to the map.
- Uncheck Watercourse in the TOC in order to only see the suitable watercourses
in Suitable_watercourses.
Now you are finished with the first criterion, locating watercourses that are wide enough
for canoeing. The other criteria were that the watercourse should end up in a lake and be
within 30 km of the hotel in Nasum. This means that you will have to search for features
based on their spatial relationship with other features.
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 8
Vector Analysis
Note: Alternatively you can also specify a spatial query that reads: I want to
select features from the following layer lakes that are within distance of the
features in the layer Suitable_watercourses. Apply a buffer to the features in
Suitable_watercourses of 0 m.
The last step is to select the lakes from the current selection that are within a maximum
distance of 30 km from the hotel in Nasum where the family will stay on their first night,
so do not clear the previous selection! Once again make sure to have the attribute table of
Lakes open to keep track on how many features that are, and are to be, selected.
- Open the attribute table of Hotels and select the hotel with the name Nasum.
Close the attribute table of Hotels.
- Use Select By Location to find all of the currently selected lakes that are within
a distance of 30 km from the hotel Nasum.
- In the first drop down menu in Select By Location choose Select from the
currently selected features in and in the box The following layer(s) make sure
Lakes is checked.
- Select features that are within a distance of 30 km from Nasum in the layer
Hotels. This time, you will have to check the box Use selected features to only
calculate distances from Nasum.
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 9
Vector Analysis
Note: When you select features based on another selection, the results might
sometimes not show as expected in the map display window. For instance,
lakes can appear selected although they are not. If this happens, clicking Full
Extent in the tools toolbar might update the selection in the map display
window. However, you can always trust the attribute table, as the amount of
records shown as selected there will always appear correct.
Question 6.2: How many lakes are suitable for the Renoir family?
- Export the selection as a new shapefile through using Export Data and save it
as suitable_lakes.
- Click Selection > Clear Selection.
- In the Tools toolbar click Measure and make sure that the features in the
layer Suitable_lakes really are within a distance of 30 km from Nasum.
What you just did was to combine queries. By combining queries you can perform more
complex searches and refine selections by using either Select by Location or Select by
Attributes.
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 1
Vector Analysis
- Find out the total length for of all of the suitable roads. Right click the header of
the relevant field in the attribute table of Suitable_roads and choose Statistics
(unit is meters).
Question 6.3: What is the total length (in km) of all the roads that pass through the
nature reserve near Havang?
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 2
Vector Analysis
Check your results. The roads have now basically been cut and the output layer should
only contain segments of roads that are actually within the nature reserve.
- Open the attribute table to the layer Suitable_roads_intersect.
- If you compare the values of length with the ones in the layer Suitable_roads
you might notice that the values have not changed.
- In the attribute table for Suitable_roads_intersect right click the heading for the
field LENGTH, choose to Calculate Geometry (if you get a warning message,
ignore it) and then click OK to calculate new lengths for the line segments.
- Find the total length of the roads within the nature reserve in the same way as
before by using Statistics.
Question 6.4: What is the total length (in km) of all the roads within the nature
reserves near Havang?
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 3
Vector Analysis
You currently have no map layer with castles. However, all the relevant information to
create such a layer is located in the Excel file Castle.
- Add the Excel file Castle in ArcMap and open and explore its contents.
- Right click Castle$ in the TOC and choose Display XY Data.
- In the Display XY Data dialog window make sure that x and y are selected in
their respective X and Y Field drop down menu and click OK.
Observe that a new temporary layer is added to the TOC with the name Castle$ Events.
We need to export the event layer as a shapefile in order to make selections on it.
- Right click Castle$ Events and choose Data > Export Data. Give it the name
castles, save it with the rest of your data and choose to add it to your map.
- Use Select By Attributes to select castles with a restaurant (not caf) and save
your selection as a new shapefile with the name suitable_castles.
Now, you could choose to select castles in the southwest part of Scania manually. But
just to demonstrate you will select castles with the use of graphics.
- First off, if it is not yet activated activate the Draw toolbar by clicking View >
Toolbars > Draw.
- Choose to draw a rectangle anywhere in the map display window by using the
New Rectangle tool available in the Draw toolbar.
- Right click your newly drawn rectangle and choose Properties and select the
tab Size and Position.
- Click the top left Anchor Point and enter 1308000 in the box X and 6181000 in
Y. Then in Size enter a Width of 75000 and a Height of 50000. Click Apply and
then select the tab Symbol.
- At Fill color select No Color and set the Outline width to 2. Click OK.
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 4
Vector Analysis
You will now make a selection by graphics based on the graphic filter that you have just
created.
- Click Selection > Set Selectable Layers and uncheck all layers except
Suitable_castles. Then, with your filter activated or selected, choose Select by
Graphics, under Selection in the main menu.
Castles that have a restaurant and are within the graphic filter should now have been
selected.
Question 6.5: What are the names of the castles that have a restaurant (not caf)
and are situated within the graphic filter?
28-01-2010 Copyright 2010. Lund University GIS Centre. All rights reserved. 5