ICT role in 21st century education and it's challenges.
QGIS training class 1
1. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Geographic
Information System
QGIS Introduction(1)
microbase.LLC
http://microgeodata.com/
2. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Agenda
1st
2nd
3rd
What’s QGIS?
Basic usage
Basic data management
Spatial data handling
Spatial Analysis
Geocording
Create Vector data
About coordi nate system
Create KML data
Utilize OSM data
3. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Contents Today
1st session
1 What’s QGIS?
2 Basic usage
3 Basic data management
4 Map design
Homework
4. Copyright (C) 2013 microbase.LLC All Rights Reserved.
What’s Quantum GIS (QGIS)?
• One of open source GIS software named FOSS4G
(Free and Open Source Software for Geospatial)
• a user friendly GUI
• Multi-platform(Win, Mac OS X, Linux)
• Multi-language
• Rich functions for a function enhancement
5. Copyright (C) 2013 microbase.LLC All Rights Reserved.
What QGIS can do?
Create and edit
GIS data
Display GIS
data
(overlay, thematic
map...)
Select / Join data GIS data analysis
7. Copyright (C) 2013 microbase.LLC All Rights Reserved.
2.1 Launch QGIS
• Double click the QGIS shortcut
icon on desktop
• The window will open.
8. Copyright (C) 2013 microbase.LLC All Rights Reserved.
QGIS window will open like below.
9. Copyright (C) 2013 microbase.LLC All Rights Reserved.
toolbar
menu
map viewLayer
map info / settings
topmenu
10. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Install Plugin
• Choose “Fetch Python Plugins...” from “Plugins” on the top menu and
search “Table Manager” from Filter form in “Plugins” tab.
• “Table Manager” is a database management tool.
• Choose and install “Table Manager”.
• When installing plugin, internet environment is necessary.
11. Copyright (C) 2013 microbase.LLC All Rights Reserved.
• Choose “Manage Plugins...” from “Plugins” on the top menu and
click the “Add DelimitedText Layer”.
• “Add DelimitedText Layer” function is used for importing CSV format data.
• Checked function will be visible on the main menu and able to be used.
“Add Delimited Text
Layer” will be visible.
Plugin Management
12. Copyright (C) 2013 microbase.LLC All Rights Reserved.
2.2 Add data
GIS data can be devided into 2 types..
• Raster type ex) JPEG, PNG,TIFF
• Vector type ex) Shape file(.shp)
For instance, imagine a river and bridge,
Raster type
aggregate of colored
dots
Vector type
line data connecting
starting points and
end points
13. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Exercise data
lecture1_data
tokyo23
homework1
14. Copyright (C) 2013 microbase.LLC All Rights Reserved.
About Shape file
• Vector type data mostly used in the world.
• Available in most GIS softwares.
• “Shape file” format is composed of more than 3 files as follows.
*.shp (geometry type and geographical coordinates)
*.dbf (attributes of features such as name and figure)
*.shx (relationship between shp and dbf)
*.prj (the coordinate system and projection info)
Shape file
same file name
These files must be
put in same folder.
15. Copyright (C) 2013 microbase.LLC All Rights Reserved.
NAME AREA PERIMETER
0
1
2
3
4
5
AAA 18352 644
BBB 22496 756
CCC 22050 602
DDD 7548 352
EEE NA NA
FFF NA NA
*.shp *.dbf*.shx
CCC
AAA
DDD
BBB
Point Data ex) amedas data, shop data
Line Data ex) road data, railway data, river data
Polygon Data ex) city shape, building data
<Feature type>
16. Copyright (C) 2013 microbase.LLC All Rights Reserved.
1) Click “Add vector layer”
2) Browse file
3) Open
Add “ku.shp” in “tokyo23” folder.
17. Copyright (C) 2013 microbase.LLC All Rights Reserved.
※ Caution ※
• Japanese GIS data by Government such as National Land
Numerical Information and census data tend to be recorded in
Shift-JIS. If you use Mac OS or Unix, Check that the encoding is
Shift-JIS before adding the data.
• Shift-JIS can be converted to UTF-8 later.
18. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Tokyo special districts are displayed.
19. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Display a feature
1) Click “Identify Feature”
2) Click a feature
20. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Shibuya info can be shown in a new window.
21. Copyright (C) 2013 microbase.LLC All Rights Reserved.
1) Click “Save Project”
(Ctrl + S or Command + S)
2)You can save it any name in any folder.
3) save a project as “.qgs” type
2.3 Save a project
22. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Exercise1
Add following data in the folder “tokyo23”.
subway.shp (Line data: a subway in Tokyo Special district)
station.shp (Point data: a station in Tokyo Special district)
convenience.shp (Point data: a convenience store in Tokyo
Special district)
elevation.shp (Polygon data: an terrain data in Tokyo special
district)
23. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Hint
You can select plural files while pushing
Ctrl key ( or Command key).
25. Copyright (C) 2013 microbase.LLC All Rights Reserved.
The order of layer on TOC can be
altered by drag and drop.
Front
Back
2.4 Change an order of each layer
26. Copyright (C) 2013 microbase.LLC All Rights Reserved.
A layer can be hidden without checking a check
box of layer.
Only subway and station layer
can be seen on map view.
27. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Delete a layer
Delete other than “ku” layer.
#This function doesn’t delete a file
itself in the file directories.
28. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Basic data management
29. Copyright (C) 2013 microbase.LLC All Rights Reserved.
What’s an “attribute”?
NAME AREA PERIMETER
0
1
2
3
4
5
A棟 18352 644
B棟 22496 756
中庭 22050 602
生協購買 7548 352
ポスト NA NA
道路 NA NA
中庭
A棟
生協購買
B棟
・ポスト
attribute table
“Attribute” means an property of each feature such as a name and an
area. In case a shape file is used, the attribute is saved into a dbf file and
can be edited.
The feature “0” has a name of “A building” and an area of
18,352 square meters, perimeter of 644 meters.
30. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Open Attribute table
See an attribute table of “ku” layer.
• Add “ku.shp” on layer and open its attribute table.
field
Each line
links to
vecoter on
map.
Click “ku” layer on the right
mouse and choose “Open
Attribute Table”.
31. Copyright (C) 2013 microbase.LLC All Rights Reserved.
If you choose a line from attributes, the
linked map feature also be chosen.
If you choose a map feature on map view,
the linked line also be chosen in the similar
way.
click a line number which
you’d like to choose.
Choose “Select Single
Feature” and click a map
feature on map view.
32. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Select layer by attribute
Select a city which has more than 20 km2 in area from attribute table.
About fields
• KU : city id
• NAME : city name
• PERIMETER [ m]
• AREA [m2]
1) Click “Advanced Search”.
33. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Input a condition expression on “SQL where clause”.
If you click, item will be
added to “SQL where
clause”.
“Test” show you whether the condition expression is
correct or not, and the number of matched features
Input “AREA >= 20,000,000”
( m2 -> km2 )
34. Copyright (C) 2013 microbase.LLC All Rights Reserved.
12 cities are selected.
Deselect
35. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Select features under plural conditions
AND and OR enable to select features under plural conditions.
case1: ku which has more than 10 km2 and less than 20km2 in area
AREA >= 10000000 AND AREA < 20000000
AREA < 10000000 OR AREA >= 20000000
Also, NOT is useful when you’d like to select features under
opposite conditions.
case3: ku which doesn’t have not less than 20km2
NOT AREA < 20000000
case2: ku which has less than 10 km2 or more than 20 km2
36. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Exercise 2
1) Select city features which has more than 50km in “PERIMETER” and
doesn’t have less than 50km2 in “AREA”
2) Save the selected features as “large_wards.shp” in “tokyo23” folder.
3) Open “large_wards.shp” in QGIS
37. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Answer
PERIMETER >= 50000 AND NOT AREA < 50000000
38. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Join table
“Join table” is to combine different table based on a key field in
common.
This function is very useful when you combine GIS data with others or
external data such as csv and dbf data.
NAME AREA
0
1
2
Hokkaido 83456.38
Aomori 8918.45
Iwate 15278.85
PREF POP
0
1
2
Hokkaido 5506419
Aomori 1373339
Iwate 1330147
NAME AREA PREF POP
0
1
2
Hokkaido 83456.38 Hokkaido 5506419
Aomori 8918.45 Aomori 1373339
Iwate 15278.85 Iwate 1330147
name, area name,population
add pop field into the target
table based on the
prefecture name.
39. Copyright (C) 2013 microbase.LLC All Rights Reserved.
The column “pop” has population data inTokyo in 2010.
Load “ku_pop.csv” in “tokyo23” into QGIS.
“Layer” > “add vector” > import csv
40. Copyright (C) 2013 microbase.LLC All Rights Reserved.
CSV data has been added.
41. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Join population data inTokyo special districts into “ku” layer.
Choose a “join” tab above menu of the layer property “ku” layer
csv layer
Use city name as a key field
shp csv
42. Copyright (C) 2013 microbase.LLC All Rights Reserved.
You can join / unjoin other data more.
“ku_pop” layer is joined to “ku” layer.
43. Copyright (C) 2013 microbase.LLC All Rights Reserved.
“ku_pop” attributes has been joined.
Attributes of “ku” Attributes of “ku_pop”
44. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Decide where one
wants to save the files.
Save the joined layer as “ku_pop.shp” in “tokyo23”.
45. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Open “ku_pop.shp” and check that the attribute table is joined one or not.
46. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Calculate field
“Calculate field” enable to handle field values at once.
Calculate a population density in each area using “pop” and “AREA” fields
in the attribute of “ku”.
Population density = Population / Area [pop / km2]
47. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Toggle edit mode
Toggle edit mode before
calculate field.
48. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Click “calculate field”.
Calculate field
“pop” field is loaded
as string. the field in
CSV are all regarded
as string.
Caution:
“calculate field can’t
be conducted
when string and
figure data coexist
together.
49. Copyright (C) 2013 microbase.LLC All Rights Reserved.
to int ( ) = ( ) 内のフィールド値を整数に変換
Fill as above
52. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Exercise1
Add following data in the folder “tokyo23”.
subway.shp (Line data: a subway in Tokyo Special district)
station.shp (Point data: a station in Tokyo Special district)
convenience.shp (Point data: a convenience store in Tokyo
Special district)
elevation.shp (Polygon data: an terrain data in Tokyo special
district)
Again
53. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Change point styles
Click “Property” on the right mouse
button station(or double click the layer).
54. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Open the window “layer proper ty” and
choose “style” tab.
55. Copyright (C) 2013 microbase.LLC All Rights Reserved.
“Symbol proper ties” window will open.
1) Change symbol layer type to “SVG marker”
2) Choose a mark of “train” from the image list.
56. Copyright (C) 2013 microbase.LLC All Rights Reserved.
The station symbol has changed.
57. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Uncheck the check box other than
“elevation” layer and open its
properties(or double click the layer).
Change polygon styles
58. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Change a color of “elevation layer”
according to elevation value.
Low High
Generally, higher area colors
warm color(ex.red,yellow).
Lower area colors cold
color(ex. blue,green).
59. Copyright (C) 2013 microbase.LLC All Rights Reserved.
1) Choose “Graduated”. 2) Choose a column “ELEV” which has elevation value.
3) Choose any color ramp.An
original color ramp can be made.
4) Choose a number
of classed and a
classification mode.
5) Finally, click “Classify”.Then the classification
result will be displayed above.
If you’d like to arrange your way, just click
“Symbol color”,“Range” and “Label”.
61. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Change par tial symbol styles
show different markers depending on attributes.
62. Copyright (C) 2013 microbase.LLC All Rights Reserved.
1) Choose “Graduated”.
2) Choose and double click a rule row
which you’d like to change.Then the rule
property will open.
(Default setting has no rule)
63. Copyright (C) 2013 microbase.LLC All Rights Reserved.
4) Input “CNAME LIKE ‘Circle%’ on
“Expression” form.
(or “CNAME = “circleK”)
‘LIKE’ : partial matching
‘=‘ : perfect matching
3)Input any name in “Label” form.
Click “...” next to “Filter” form.
5) Marker type can be chosen
as mentioned before.
A filter rule can be input from
“Expression string builder”.
64. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Existing rule has been edited.
If you’d like to add an another rule or delete
65. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Only “CircleK” has been displayed.
66. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Display a label
1) Choose “Label” tab from tab menu in Properties “ku”
2) check the checkbox
of “Display labels”.
3) Choose “NAME” in “Field
containing label” form.
67. Copyright (C) 2013 microbase.LLC All Rights Reserved.
The name of “ku” has been displayed as a
label on the polygon data.
68. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Exercise 2
1) Delete the label “ku”.
2) Add pop.shp(population on street scale).
3) Classify poplation in 1995(“P1995”) into 4 categories as follows.
class 1 : 0 ∼ 1000 (blue)
class 2 : 1001 ∼ 2500 (green)
class 3 : 2501 ∼ 5000 (yellow)
class 4 : 5001 ∼ (red)
71. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Map Expor t
Export your map an imagery file for printing. QGIS has an additional
function such as adding a direction symbol and a scale bar for printing.
Click “New print composer” icon from toolbars.
Add a map, symbols and others to
Initial screen from the menu.
72. Copyright (C) 2013 microbase.LLC All Rights Reserved.
1) Click “Add new map” icon
Add a map into composer screen
2) Drag at any place on the composer
screen while choosing “Add new map” icon
map size and other settings
can be adjusted freely.
73. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Those elements can be
modified from “Item
Properties” at the right side
Add icon and
pictures.
Add Label
Add legend
Export as an
imagery, PDF, SVG.
74. Copyright (C) 2013 microbase.LLC All Rights Reserved.
Contents Today
1st session
1 What’s QGIS?
2 Basic usage
3 Basic data management
4 Map Design
76. Copyright (C) 2013 microbase.LLC All Rights Reserved.
DATA
homework1
pref_pop.csv
Japan_pref.shp
77. Copyright (C) 2013 microbase.LLC All Rights Reserved.
(1) Add Japan_pref.shp and pref_pop.csv on layer.
(2) Join Japan_pref layer with pref_pop and save it as
Japan_pref_new.shp .
(3) Calculate population density in all prefecture using both
pop2010 and pop2035 field.
(4) Classify the poplation density in 2010 and 2035 into 5
categories.