qgis module 2

47
SessionTwo: Attribute Tables and JOIN: how to add data to QGIS

Upload: capsucsf

Post on 29-Nov-2014

341 views

Category:

Self Improvement


0 download

DESCRIPTION

Module 2: Attribute Tables and Adding Data to QGIS

TRANSCRIPT

Page 1: QGIS Module 2

SessionTwo:

•Attribute Tables and

•JOIN: how to add data to QGIS

Page 2: QGIS Module 2

Why are attribute tables

important?

Attribute tables define the elements of a

shapefile and allow you to see what is

“inside” the layer. They also allow you to

zoom, highlight and select for other

operations.

Page 3: QGIS Module 2

“Flat File” with columns and rows

Row = geographic feature record

Column = attribute field (item of

information about a feature)

Page 4: QGIS Module 2

Attribute field general types

• Numeric (integer or decimals)

• Text (string)

• Date

• Blob (binary large object)

Source: http://www.esi.utexas.edu/gk12/workshops/gis/ppts.php

Page 5: QGIS Module 2

Each different layer has its own attribute table so when we open a new one here…

Page 6: QGIS Module 2
Page 7: QGIS Module 2

ATTRIBUTE TABLE CAN BE USED TO ZOOM INTO A SELECTED FEATURE – IN THIS CASE A DISTRICT; HIGHLIGHT THE ENTIRE ROW TO SELECT IT

Page 8: QGIS Module 2

THE SELECTED FEATURE IS LARGE AND HIGHLIGHTED IN YELLOW

Page 9: QGIS Module 2

YOU CAN USE THE ZOOM FEATURES ON THE TOOLBAR TO ZOOMOUT TO SEE THE SELECTION IN CONTEXT OF THE COUNTRY

Page 10: QGIS Module 2

De-select on toolbar to end

the highlighted area

Page 11: QGIS Module 2

JOIN

• Basic to all GIS programs is “joining”

• This is how tables of data (excel, csv,

etc) are transformed into maps

• For example, HIV prevalence by

province

Page 12: QGIS Module 2

Change data form

Must change the data format from EXCEL

or other database into a form that QGIS

can use

• The easiest process is using .dbf

• .dbf is an “old” data file type (dbase)

BUT shapefiles contain .dbf file data

which is why we use them

• To convert we need LibreOffice

Page 13: QGIS Module 2

LIBRE OFFICE

• Open Libre office and open your excel

data (name of excel file or type of data)

Page 14: QGIS Module 2

In Libre Office choose spreadsheet

Page 15: QGIS Module 2

View the data you want to add.. Save as “name”.dbf inside data folder

Page 16: QGIS Module 2

Open or maximize QGIS

• You will now add your .dbf file that you

created in Libre Office to the map layers

you are already displaying

• Click on “add vector layer”

Page 17: QGIS Module 2
Page 18: QGIS Module 2

1.

2.

3.

Page 19: QGIS Module 2

Open “attribute layer” for

moz_adm1

• Find the column that has the name of

the provinces in it.

Page 20: QGIS Module 2
Page 21: QGIS Module 2
Page 22: QGIS Module 2

JOIN in QGIS

• Double click on moz_adm1

• When layer opens click on “join” tab

Page 23: QGIS Module 2
Page 24: QGIS Module 2

11.You will see this. Note

default target field ID_0

2. You MUST change target

field!

You need to match “like” with “like” so if you have province

data, in this case provincia, you must match with QGIS’s

province layer, in this case NAME_1.

Page 25: QGIS Module 2

Return to Map Layers and

double click on moz_adm1

Page 26: QGIS Module 2

Check to see that the

two layers have been

added by hitting the

tab called fields.can

you see them?

Page 27: QGIS Module 2

DOUBLE CLICK

ON MOZ-ADM1

CLICK ON

GENERAL, NOW

CHANGE THE

TITLE TO RESAVE

THE LAYER

UNDER A NAME

WHICH REFLECTS

YOUR DATA

Page 28: QGIS Module 2

RENAME

THE FILE

CLICK OK

Page 29: QGIS Module 2
Page 30: QGIS Module 2
Page 31: QGIS Module 2

“Joining”: putting table data

inside the map layer

Page 32: QGIS Module 2
Page 33: QGIS Module 2
Page 34: QGIS Module 2

Now make

sure to

change the

column so it

is set to the

file with

prevalence

that you

wish to

map. You

DO NOT

want

Column set

to ID_0

which is the

default. It

will crash

your

computer.

Page 35: QGIS Module 2
Page 36: QGIS Module 2

How to change the

classification

Double click on a row to begin. Be sure to select “label” afterward to ensure that your changes are reflected in your labels. This is also an opportunity to simplify the label presentation.

Page 37: QGIS Module 2
Page 38: QGIS Module 2
Page 39: QGIS Module 2
Page 40: QGIS Module 2

Prevalence map with province

names

Page 41: QGIS Module 2

OK! Now try this with your

own data….

If you don’t have data make

up data to practice

Page 42: QGIS Module 2

Adding two variables to one

map layer

Page 43: QGIS Module 2

How to map a second

presentation of prevalence

onto one map: using symbols

• This step shows you how to map a

second level of prevalence, HIV

prevalence in men (MHIVPREV) onto a

map where the colors of provinces

represent the HIV prevalence of women

Page 44: QGIS Module 2
Page 45: QGIS Module 2

Here is the final map

with the male and

female HIV prevalence

Male HIV

prevalence is

represented as

the pink dots and

female HIV

prevalence is

represented

within the blue

shaded province

layers.

Page 46: QGIS Module 2

Now go back to the diagram

layer, where you see pie chart

and choose text diagram.

What do you think?

Page 47: QGIS Module 2

End session 2

Thank you!