You are on page 1of 21

QGIS LAB SERIES

GST 102: Spatial Analysis


Lab 6: Vector Data Analysis !et"or# Analysis
$b%ecti&e ' Learn t(e Basics o) !et"or# Analysis
Doc*+ent Version: 201,0-1- ./inal0
1ontents
Introduction.............................................................................................................2
Objective: Learn the Basics of Network Analysis...................................................2
How Best to se !ideo "alk #hrou$h with this Lab..............................................2

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
Introduction
In this lab, you will learn how to conduct analyses related to linear networks. You will
learn how to determine the shortest path from origin to destination and how to allocate a
linear network into service areas.
This lab includes the following tasks:
Task 1 Basic etwork !nalysis
Task " !llocating #ervice !reas
Objective: Learn the Basics of Network Analysis
The ob$ective of this lab is for the student to learn how to conduct basic network analysis.
You will use the %oad &raph plugin to '&I# (esktop, and you will be introduced to the
&%!## plugin. You will use some of the networking tools in &%!## to allocate service
areas.
How Best to Use Video alk !hrou"h with this Lab
To aid in your completion of this lab, each lab task has an associated video that
demonstrates how to complete the task. The intent of these videos is to help you move
forward if you become stuck on a step in a task, or you wish to visually see every step
re)uired to complete the tasks.
*e recommend that you do not watch the videos before you attempt the tasks. The
reasoning for this is that while you are learning the software and searching for buttons,
menus, etc+, you will better remember where these items are and, perhaps, discover
other features along the way. *ith that being said, please use the videos in the way that
will best facilitate your learning and successful completion of this lab.
Tas# 1 Basic Network Analysis
In this task, you will use the #oad $ra%h plugin to determine the shortest distance
between two points via a #an ,rancisco streets layer. You will do this both by shortest
overall distance and by time traveled.
.. The data for this lab is located on the lab machine at: C:\GST102\Lab 6\Data.
2. O%en &$I' (eskto% )*+*,
/. Add the -!A.(/!.'%eedLi0its shapefile to &$I' (eskto%*
01201.2 Copyright 2013 NISGTC Page 2 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2. #i"ht click on the layer and choose 'et %roject 1#' fro0 layer from the
conte-t menu*
2i"ure 3: 'treet Layer in &$I' (eskto%
3. This is a street network for the .ity of #an ,rancisco. O%en the attribute table to
see what kind of data you have to work with. otice that in addition having the
street name and type, there is a column populated with speed limits for each road
segment. 1lose the attribute table.
+. /pen the Layer /ro%erties4 'tyle and symboli0e the data by speed limit.
a. .hoose a 1ate"ori5ed renderer
b. 1olu0n 1 speedlimit
c. .olor ramp 1 $reys
d. 1lick 1lassify
e. 1lick O6 72i"ure )8
01201.2 Copyright 2013 NISGTC Page / of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure ): 'tylin" the 'treet Layer by '%eed Li0it
4. Your map should resemble 2i"ure 9.You can now distinguish the ma$or arteries.
01201.2 Copyright 2013 NISGTC Page 2 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure 9: 'an 2rancisco 'treets 'tyled by '%eed Li0it
5. 'ave your map as Lab :*;"s.
0. You will use the '&I# #oad $ra%h plugin to find the shortest distance between
two points on the network. ,rom the menu bar choose /lu"ins 4 -ana"e and
Install /lu"ins* 'elect the All tab, and type #oad into the 'earch bar. .heck the
bo- ne-t the #oad "ra%h %lu"in to enable it 22i"ure +3. 1lick 1lose*
2i"ure +: <nablin" the #oad $ra%h /lu"in
01201.2 Copyright 2013 NISGTC Page 3 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
.6. ! new panel for this plugin will appear below the Table of .ontents.
... Before you begin you need to configure the plugin. ,rom the menu bar, choose
Vector 4 #oad $ra%h4 'ettin"s. The #oad $ra%h settin"s window opens.
.hoose the following settings 22i"ure =3:
a. Time unit: hour
b. (istance unit: kilo0eter
c. Topology tolerance: 3,
d. 4ayer: -!A.(/!.'%eedLi0its
e. (irection field: Always use default
f. #peed field: s%eedli0it
$. 1lick O6*
2i"ure =: <nablin" the #oad $ra%h /lu"in
01201.2 Copyright 2013 NISGTC Page + of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
.2. ow you will populate the #oad $ra%h plugin panel 2below the Table of
.ontents3. 1lick the 'tart location button and click on a spot on the map.
(o the same for the 'to% location via the 'to% location button. #mall dots will
appear where you have clicked.
./. 'et the 1riterion as Len"th. ow click 1alculate to find the shortest path
between the two points. !fter some processing, a red line will appear as the
solution 22i"ure :3.
2i"ure :: 'hortest /ath Between !wo /oints on Linear Network
.2. To save the shortest path click the <>%ort button. .hoose New te0%orary layer
as the 'elect destination layer. 1lick O6. The shortest path will now appear in
your Table of .ontents.
.3. To make this layer permanent ri"ht click on it and choose 'ave as+ #ave the
data to a shapefile in the 4ab 56(ata folder named 'hortest/ath*sh% 22i"ure ?3.
01201.2 Copyright 2013 NISGTC Page 4 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure ?: 'avin" the !e0%orary 'hortest /ath Layer to a 'ha%efile
.+. ow you will determine the shortest drive time between the two points. .hange
the 1riterion to !i0e. 1lick 1alculate. *ith this .riterion, you may get a very
different solution, depending on the points you chose.
.4. 1lick <>%ort to save this layer to a New te0%orary layer@ and again, save that
temporary out to a shapefile. Na0e this file 2astest#oute*sh%
.5. #e0ove the temporary layers from the map, leaving $ust the street network and
two solutions. 'tyle the 'hortest/ath layer as a red line with a thickness of ,*+:
and the 2astest#oute layer with a dark blue line of e)ual thickness. *ith the
points I chose, I had two very different solutions 22i"ure A3.
01201.2 Copyright 2013 NISGTC Page 5 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure A: 2inal 'olutions
.0. 'ave your map file and close &$I' (eskto%.
Tas# 2 Allocatin" 'ervice Areas
ow you will use some &%!## tools to allocate portions of the road network served by
each #an ,rancisco 7olice #tation. &%!## is a mature and powerful ,/## &I# software
package. It has a uni)ue data structure that can be initially intimidating. ,ortunately,
'&I# (esktop has a &%!## plugin that provides a much more intuitive interface to the
large suite of &%!## analysis tools.
.. O%en &$I' (eskto% )*+*, and open 4ab 56(ata6Lab:.!ask)*;"s
2. This pro$ect has three layers loaded: '2./olice, '2.2ire'tations and
'2.'treets.
&%!## uses its own file format. These layers are stored in a &%!## (atabase, which is
essentially a folder with containing &%!## data. The &rass (atabase is Lab
:B(ataB$#A''db. These data sets have been imported into &%!## from shapefiles. In
'&I# (esktop they will behave $ust like any other layer. 8owever, since they are stored
as &%!## 9ectors, you can also use the suite of &%!## tools with them. These tools
include a set for network analysis.
/. ,irst, you will enable the &%!## plugin. ,rom the menu bar choose /lu"ins 4
-ana"e and Install %lu"ins. The &%!## plugin is a core '&I# plugin. This
means it is already installed and all you need to do is enable it. 1lick on the
01201.2 Copyright 2013 NISGTC Page 0 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
Installed tab. ,ind $#A'' and check the bo- to turn it on. 1lick 1lose when
done.
2. :nabling &%!## turns on a new toolbar 2below3.
The data is already set up for you in this '&I# (esktop pro$ect. The following is simply
an e-planation to get you oriented to the &%!## data structure. %emember &%!## data
is stored in a $#A'' database, which again is simply a folder. Inside the database will
be folder2s3 called Locations and inside a Location will be folder2s3 called -a%sets.
$#A''db 4 Locations4 -a%sets
Locations represent a certain spatial e-tent and coordinate reference system that you
identify when you create one. -a%sets are a way to organi0e data and are the data tier
that actually contains data layers. :very 4ocation contains a default -a%set named
/<#-AN<N!. !dditional -a%sets can be set up for individual users 2Tom, ;ary,
!lice etc,3 or for categories of data such as hydrology, transportation, boundaries etc.
To begin working with the &%!## tools you need to have a &%!## -a%set open.
This '&I# pro$ect has three data layers from a $#A'' (atabase however, you need to
open a -a%set to begin working with &%!## tools. !dditionally, the -a%set you have
open determines where your outputs will be saved. ,or this lab there is an empty -a%set
called -y(ata that you will open to complete Task ".
3. ,rom the &%!## toolbar, click on the O%en -a%set button. ,ill out the
'elect $#A'' -a%set window as in 2i"ure C.
a. The &isdbase should be: Lab :D(ataD$#A''db
b. 4ocation: Lab:.'an2rancisco
c. ;apset: -y(ata
2i"ure C: 'elect $#A'' -a%set
+. There will be two changes that occur. 13 You will see a red bo- appear around
your data on the map. This represents the #e"ion of study 22i"ure 3,3, which in
this case is e)ual to the Location settings. It is the spatial e-tent of your study
area. "3 The remainder of the buttons on the &%!## toolbar are now active.
01201.2 Copyright 2013 NISGTC Page .6 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure 3,: $#A'' -a%set O%en
4. 1lick the O%en $#A'' !ools button.
5. The $#A'' !ools window opens. This is the interface to all the &%!##
geoprocessing tools. otice that in the title bar of the window it displays your
4ocation6;apset 2Lab:.'an2ranciscoB-y(ata3 22i"ure 333
The &%!## Tools window has three tabs: ;odules Tree, ;odules 4ist and Browser.
The -odules !ree allows you to access &%!## tools organi0ed by theme. The ;odules
List has all the same tools, but they are listed alphabetically with a search bar. The
Browser allows you to see what layers you have in your open -a%set. You do not yet
have data in your -y(ata -a%set so there will be nothing yet to see.
01201.2 Copyright 2013 NISGTC Page .. of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure 33: $#A'' !ools
0. The first step in doing a network analysis in &%!## is the build a network
dataset. <>%and Vector4 '%atial Analysis 4 Network analysis4 v*net
22i"ure 3)3. This tool will create a linear network of #an ,rancisco streets and
attach nodes representing the 7olice stations.
01201.2 Copyright 2013 NISGTC Page .2 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure 3): $#A'' Network Analysis !ools
.6. (ouble click on the v*net E Network -aintenance tool. The tool opens as an
addition tab on the window to the right of Browser. !dditionally, the tool itself
has three tabs. /ptions, /utput and ;anual. The O%tions tab is where you fill out
your parameters before running the tool. *hen you run the tool, it will switch to
the Out%ut tab and you will see details about the running process. The -anual
tab is help for the tool. ,ill it out as described below and in 2i"ure 39.
/T:: The inputs are listed as 4ayerame<;apset.
01201.2 Copyright 2013 NISGTC Page ./ of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
a. ame of input vector map: '2.'treets 7'2.'treetsF/<#-AN<N! 3
line8
b. ame of input point vector map: '2./olice 7 '2./oliceF/<#-AN<N!
3 %oint8
c. /peration to be performed: 1onnect still unconnected %oints to vector
network by insertin" new line7s8
d. !rc layer: 3
e. ode layer: )
f. Threshold: 9,,
$. ame for output vector map: '2.Network
h. 1lick #un
2i"ure 39: v*net !ool
01201.2 Copyright 2013 NISGTC Page .2 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
... *hile running the Out%ut tab will be visible 22i"ure 3+3. 1lick the View out%ut
button to add the network dataset to '&I#.
2i"ure 3+: v*net !ool 'uccessfully 2inished
01201.2 Copyright 2013 NISGTC Page .3 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
.2. ,or now, leave the $#A'' tools window o%en* You may want to move it to the
side so you can see the map.
./. !urn off the '2.2ire'tations and '2./olice layers.
.2. In addition to the linear network, this operation produced nodes for each police
station point. The View out%ut only added the linear network to '&I#, so you
will now add the network nodes to '&I#. /n the $#A'' toolbar click the Add
$#A'' Vector Layer button.
.3. The 'elect $#A'' Vector Layer window opens. =nder ;apset: ;y(ata, ;ap
name #,>etwork choose ).%oint 22i"ure 3=3. Remember when you ran the
v.net tool you spe!"!e# that the $D "or the %r layer was 1 an# the no#e layer 2.
2i"ure 3=: 'elect $#A'' Vector Layer
.+. O%en the attribute table for the '2.Network.) node layer* It has one column
named cat with values for each of the 1? police stations 73G3+8* 1lose the table*
.4. ow that the network dataset is constructed, you will identify the road territory
that each police station should serve. In the $#A'' !ools window switch back
the -odules !ree tab. 1lick on v*net*alloc E Allocate Network tool. The tool
will open in yet another tab.
.5. ,ill out the tool form as described below and as seen in 2i"ure 3:.
a. Input arcs: '2.Network 7 '2.NetworkF-y(ata 3 line8
b. Input nodes: '2.Network ) 7 '2.NetworkF-y(ata ) %oint8
c. .ats: 3@)@9@+@=@:@?@A@C@3,@33@3)@39@3+ &'T(: these are the values "or
eah pol!e stat!on "rom the S)*&etwor+*2 no#e attr!bute table.
d. ame for output vector map: /olice't.Allocation
01201.2 Copyright 2013 NISGTC Page .+ of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure 3:: v*net*alloc !ool
.0. *hen the tool is set up correctly, click #un. *hen complete click View out%ut.
01201.2 Copyright 2013 NISGTC Page .4 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
26. O%en the attribute table for the /olice't.Allocation layer* otice that it simply
has the cat I( of each of the 1? police stations.
2.. Before you close the &%!## Tools window switch to the Browser tab* 1lick the
#efresh button* <>%and -y(ata4 Vector and /<#-AN<N!4 Vector*
You will see the data layers listed in each -a%set 22i"ure 3?3.
2i"ure 3?: $#A'' !ools Browser
22. Now click on the '2.Network layer and you will see some metadata in the right
hand window 22i"ure 3A3. This is the command line e)uivalent of the tool
parameters you used. This can be helpful when trying to remember how you
created a given layer.
01201.2 Copyright 2013 NISGTC Page .5 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
2i"ure 3A: $#A'' !ools Browser (is%layin" -etadata
2/. 1lose the $#A'' !ools window.
01201.2 Copyright 2013 NISGTC Page .0 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
22. To see the results of your analysis you will 'tyle the /olice't.Allocation layer.
O%en the Layer /ro%erties 4 'tyle tab. .hoose the following parameters:
a. %enderer: 1ate"ori5ed
b. .olumn: cat
c. .olor ramp: #ando0 colors
d. 1lick 1lassify
e. 1lick O6
23. ow turn O22 the '2.Network ) layer and turn ON the '2./olice layer.
2+. e-t you will label the 7olice stations with their name. O%en the Layer
/ro%erties4 Labels tab for the '2./olice layer.
a. .heck the Label with layer with bo-
b. .hoose 2A1ILI!H.N as the attribute column
c. 1lick the !e>t tab below and make the font si0e C and Bold
d. 1lick the Buffer tab and click (raw te>t buffer and make the si0e )
e. 1lick O6*
24. Your map should resemble 2i"ure 3C.
2i"ure 3C: #oad Allocation by /olice 'tation
= 1onclusion
In this lab, you were e-posed to basic network routing and allocation analysis. You
calculated the shortest distance between two points via both time and distance. You then
01201.2 Copyright 2013 NISGTC Page 26 of 2.

%&I' LAB '()I(' * Lab + , !ector -ata Analysis * Network Analysis
determined which portions of the network that should be allocated to each police station.
There are many applications for this type of analysis including emergency management,
parcel delivery, and general navigation.
: (iscussion &uestions
.. *hat is a real world application of network analysis@ :-plain.
2. 8ow can a network analysis benefit the logistics industry@
/. *hat other linear networks could this apply to other than roads@
? 1hallen"e Assi"n0ent
The #an ,rancisco 7olice (epartment has shown your analysis to their colleagues at the
,ire (epartment and they were impressed. ow the ,ire (epartment would like the same
analysis done for their stations. In the 7:%;!:T mapset there is a #,>,ire#tations
&%!## vector layer. %epeat the steps in Task " to create the same allocation analysis for
the ,ire (epartment. .ompose a map of the results of the ,ire (epartment analysis.
01201.2 Copyright 2013 NISGTC Page 2. of 2.

You might also like