Sunteți pe pagina 1din 77

Geographic

Information
S y s t e m QGIS
Introduction(1)
microbase.LLC
http://microgeodata.com/

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Agenda
W h a t ’s Q G I S ?
1st Basic usage
Basic data management

Spatial data handling


2nd Spatial Anal ysis

Geocor ding
Cr e a t e Ve c t o r d a t a
3rd About coordinate system
Cr e a t e KML d a t a
U t i l i z e OSM d a t a
Copyright (C) 2013 microbase.LLC All Rights Reserved.
Contents Today

1st session

1What’s QGIS?
2 Basic usage
3Basic data management
4 Map design
Homework

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

Copyright (C) 2013 microbase.LLC All Rights Reserved.


What QGIS can do?
Display GIS
data Create and edit
(overlay,thematic GIS data
map...)

Select / Join data GIS data analysis

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Basic usage

Copyright (C) 2013 microbase.LLC All Rights Reserved.


2.1 Launch QGIS

• Double click the QGIS shortcut


icon on desktop

• The window will open.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


QGIS window will open like below.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


toolbar
menu
topmenu

Layer map view

map info / settings


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.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Plugin Management

• Choose “Manage Plugins...” from“Plugins” on the top menu and


click the “Add Delimited Text Layer”.
• “Add Delimited Text 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.
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 Vector type


aggregate of colored line data connecting
dots starting points and
end points

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Exercise data

tokyo23

lecture1_data
homework1

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)
Shape file
*.shx (relationship between shp and dbf)
These files must be
*.prj (the coordinate system and projection info) put in same folder.

same file name


Copyright (C) 2013 microbase.LLC All Rights Reserved.
*.shp *.shx *.dbf

DDD
NAME AREA PERIMETER
AAA 0 AAA 18352 644
1 BBB 22496 756
CCC 2 CCC 22050 602
3 DDD 7548 352
4 EEE NA NA
BBB 5 FFF NA NA

<Feature type>
Point Data ex) amedas data, shop data

Line Data ex) road data, railway data, river data

Polygon Data ex) city shape, building data


Copyright (C) 2013 microbase.LLC All Rights Reserved.
Add “ku.shp” in “tokyo23” folder.

1) Click “Add vector layer”

2) Browse file

3) Open

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.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Tokyo special districts are displayed.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Display a feature

1) Click “Identify Feature”

2) Click a feature

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Shibuya info can be shown in a new window.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


2.3 Save a project

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


Copyright (C) 2013 microbase.LLC All Rights Reserved.
Exercise 1

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 inTokyo special


district)

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Hint

You can select plural files while pushing


Ctrl key ( or Command key).

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Answer

Copyright (C) 2013 microbase.LLC All Rights Reserved.


2.4 Change an order of each layer

Front

Back

The order of layer on TOC can be


altered by drag and drop.

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.

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.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Basic data management

Copyright (C) 2013 microbase.LLC All Rights Reserved.


What’s an “attr ibute”?
“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.

attribute table
生協購買 NAME AREA PERIMETER
A棟 0 A棟 18352 644
1 B棟 22496 756
中庭 2 中庭 22050 602

ポスト 3 生協購買 7548 352
4 ポスト NA NA
B棟 5 道路 NA NA

The feature“0” has a name of “A building” and an area of


18,352 square meters, perimeter of 644 meters.
Copyright (C) 2013 microbase.LLC All Rights Reserved.
Op en A ttribute table
See an attribute table of “ku”layer.
• Add “ku.shp” on layer and open its attribute table.

field

Each line
links to
Click “ku” layer on the right vecoter on
map.
mouse and choose “Open
AttributeTable”.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


If you choose a line from attributes, the Choose “Select Single
Feature” and click a map
linked map feature also be chosen. feature on map view.

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.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Select layer by attr ibute
Select a city which has more than 20 km2 in area from attribute table.

About fields
• KU : cityid
• NAME : city name
• PERIMETER [ m]
• AREA [m2]

1) Click “Advanced Search”.

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”.

Input “AREA >= 20,000,000”


( m2 -> km2 )

“Test” show you whether the condition expression is


correct or not, and the number of matched features
Copyright (C) 2013 microbase.LLC All Rights Reserved.
12 cities are selected.

Deselect

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Select features under plur al conditions

AND and OR enable to select features under plur al conditions.

c a s e 1 : ku which has more than 10 km 2 and less than 20km 2 in area

AREA > = 10000000 AND AREA < 20000000


c a s e 2 : ku which has less than 10 km 2 or more than 20 km 2

AREA < 10000000 OR AREA > = 20000000

Also, NOT is useful when you’d like to select features under


opposite conditions.

c a s e 3 : ku which doesn’ t have not less than 20 km 2

NOT AREA < 20000000


Copyright (C) 2013 microbase.LLC All Rights Reserved.
E xercis e 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

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Answer
PERIMETER >= 50000 AND NOT AREA <50000000

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 name,population
NAME AREA PREF POP
0 Hokkaido 83456.38 0 Hokkaido 5506419
1 Aomori 8918.45 1 Aomori 1373339
2 Iwate 15278.85 2 Iwate 1330147

NAME AREA PREF POP


0 Hokkaido 83456.38 Hokkaido 5506419 add pop field into the target
table based on the
1 Aomori 8918.45 Aomori 1373339
prefecture name.
2 Iwate 15278.85 Iwate 1330147

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Load“ku_pop.csv” in“tokyo23” into QGIS.
“Layer” > “add vector” > import csv

The column “pop” has population data in Tokyo in2010.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


CSV data has been added.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Join population data in Tokyo special districts into “ku” layer.
Choose a “join” tab above menu of the layer property“ku” layer

shp csv

csv layer

Use city name as a key field

Copyright (C) 2013 microbase.LLC All Rights Reserved.


“ku_pop” layer is joined to “ku” layer.

You can join / unjoin other data more.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


“ku_pop” attr ibutes has been joined.

Attributes of“ku” Attributes of “ku_pop”


Copyright (C) 2013 microbase.LLC All Rights Reserved.
Save the joined layer as “ku_pop.shp” in“tokyo23”.

Decide where one


wants to save the files.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Open “ku_pop.shp” and check that the attribute table is joined one or not.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Calculate fie ld

“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]

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Tog g le e dit mode

Toggle edit mode before


calculate field.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


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.

Click “calculate field”.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Fill as above

to int ( ) = ( ) 内のフィールド値を整数に変換

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Joined!!

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Map Design

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Exercise 1

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 inTokyo special


district)

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Change point styles

Click “Property” on the right mouse


button station(or double click the layer).

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Open the window “layer proper ty” and
choose “style” tab.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


“Symbol proper ties” window will open.

1) Change symbol layer type to “SVG mar ker”

2) Choose a mar k of “tr ain” from the image list.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


The station symbol has changed.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Change polygon styles

Uncheck the check box other than


“elevation” layer and open its
properties(or double click the layer).

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Change a color of “elevation layer”
according to elevation value .

Gener ally, higher area color s


war m color(ex.red,yellow).
Lower area color s cold
color(ex. blue ,green).

Low High

Copyright (C) 2013 microbase.LLC All Rights Reserved.


1) Choose“Graduated”. 2) Choose a column “ELEV” which has elevation value.

4) Choose a number
of classed and a
classification mode.

3) Choose any color ramp. An


original color ramp can be made.
If you’d like to arrange your way, just click
“Symbol color”,“Range” and“Label”.

5) Finally, click “Classify”.Then the classification


result will be displayed above.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Result

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Change p ar tia l symb ol styles
show different markers depending on attributes.

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)

Copyright (C) 2013 microbase.LLC All Rights Reserved.


A filter rule can be input from
“Expression string builder”.

3)Input any name in “Label” form.


Click“...” next to“Filter” form.

5) Marker type can be chosen


as mentioned before.

4) Input “CNAME LIKE ‘Circle%’on


“Expression” form.
(or “CNAME =“circleK”)

‘LIKE’ : partial matching


‘=‘ : perfect matching
Copyright (C) 2013 microbase.LLC All Rights Reserved.
Existing rule has been edited.

If you’d like to add an another rule or delete

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Only “CircleK” has been displayed.

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.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


The name of “ku” has bee n displayed as a
label on the polygon data.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


E xercis e 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)

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Hint

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Answer

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.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Add a map into composer screen

1) Click “Add new map” icon

2) Drag at any place on the composer


screen while choosing “Add new map” icon

map size and other settings


can be adjusted freely.

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Add Label

Add icon and


Export as an pictures.
imagery, PDF, SVG.

Add legend

Those elements can be


modified from “Item
Properties” at the right side

Copyright (C) 2013 microbase.LLC All Rights Reserved.


Contents Today

1st session

1What’s QGIS?
2 Basic usage
3Basic data management
4 Map Design

Copyright (C) 2013 microbase.LLC All Rights Reserved.


HOMEWORK

Copyright (C) 2013 microbase.LLC All Rights Reserved.


DATA

pref_pop.csv

homework1

Japan_pref.shp
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.

Copyright (C) 2013 microbase.LLC All Rights Reserved.

S-ar putea să vă placă și