Anda di halaman 1dari 18

Page 1 of 18

SOUTHERN LEYTE STATE UNIVERSITY


Geographic Information Systems – Technology Center

Geographical Information System I

Activity 05: Creating New GIS Datasets and Joining Tables

Objective:

 To learn how to create a new GIS dataset and joining tables.

Open QGIS.
Automatically it displays your recent projects.
Click ‘New’ tool to start a new project.
Set parameters as shown below.
In Menu Bar, click Project > Project Properties.
Click CRS tab.
Enable ‘on the fly’
Coordinate Reference System: WGS 84 / UTM zone 51N
Page 2 of 18

Click OK.

Click Add Vector Layer tool.

Browse the folder


C:\.....\MYDATA\VECTORS\AdminBndries_Geoportal\PHL_adm3_PSA_pn_2016June\

Add PHL_adm3_PSA_pn_2016June.shp.

Open the attribute table of PHL_adm3_PSA_pn_2016June

Click ‘Select features using by expression’ tool.


Page 3 of 18

Click Select. Click Close.

Open its attribute table.

Click ‘Move selection to top’ tool.


Page 4 of 18

Close the table.

Right-click PHL_adm3_PSA_pn_2016June

Save as SL_Munis.shp. Save in C:\....\OUTPUT\VECTORS\.

REMEMBER: Save only selected features.


Page 5 of 18

Click OK.
Page 6 of 18

Click ‘Deselect Features from All Layers’ tool ..

At this point let’s save the project.

In Menu bar, click Project > Save As > Act05_R08_SL_Munis.qgs. Save in


C:\…..\OUTPUT\PROJECT\
Page 7 of 18

Joining Tables

Let’s join the municipalities with population values, number of voters, and other data.

Get the population data from http://www.nscb.gov.ph/activestats/psgc/default.asp

(If you can’t access the Internet, get the data from Resource Person.)

Keyword to search: Southern Leyte

Click Search.
Page 8 of 18

Highlight the table and copy.

Open WPS Spreadsheets program in your Desktop.


Page 9 of 18

Paste it in WPS Spreadsheets.

Save in C:\.....\Desktop\SLSU_GIS\MYDATA\TABLES as SL_MuniTable.csv

The table needs to be cleaned and reformatted before joining with the attribute table of
SL_Munis.shp.
Page 10 of 18

Use spreadsheet functions, such as REPLACE, PROPER, MID, and TRIM, as may be needed. Replace
the headings, as shown.

The cleaned table may look like the one below.

As a final step, format the last three column as ‘General’ under the ‘Number’ tab.

[IMPORTANT: The column values for Voters, Popn_2010, and Area_ha must be numeric (integer).]

Open the attribute table of SL_Munis.shp in QGIS. Sort the column NAME_2 alphabetically.
Page 11 of 18

In QGIS, click ‘Add Delimited Text Layer’ tool .

The ‘Create a Layer from a Delimited Text File’ window opens.

Click Browse button and add SL_MuniTable.csv.


Page 12 of 18

Go to the folder C:\.....\Desktop\SLSU_GIS\MYDATA\TABLES

File format -- CSV


Geometry definition -- No geometry (attribute only table)

Click OK.
Page 13 of 18

Check the Type name. ‘Code’, ‘Inc_Clas’, ‘District’, ‘Voter’, ‘Popn_2010’, and ‘Area_ha’ must be
‘integer’

Now let’s join the tables of SL_Munis.shp and SL_MuniTable.csv.

Open the Layer Properties of SL_Munis.shp.


Page 14 of 18

Highlight ‘Joins’ tab.

Click the Add tool to open the ‘Add vector join’ window.

Join layer: SL_MuniTable


Join field: Name
Target field: Mun_Name

Click OK.

Open the attribute table of SL_Munis.shp


Page 15 of 18

SL_MuniTable attributes are now joined with SL_Munis.shp but the headings need to be changed.

Save the joined table as SL_Munis_join.shp in C:\.....\Desktop\SLSU_GIS\ OUTPUT\VECTORS

CRS --- WGS 84 / UTM zone 51N.

Add saved file to map.


Page 16 of 18

Click OK.

Remove the joined attributes in SL_Munis.


Right-click SL_Munis> Properties > Joins. Click the negative icon to remove the joined columns.

Click OK.

Open the attribute table of SL_Munis_join.

Click ‘Toggle editing mode’ tool .

Replace the headings:

SL_MuniTable_Code with Code


SL_MuniTable _ Inc_Clas with Inc_Clas
SL_MuniTable _ Cit_Clas with Cit_Clas
SL_MuniTable _ District with District
SL_MuniTable _ Voters with Voters
SL_MuniTable _ Popn_2010 with Popn_2010
SL_MuniTable _ Area_ha with Area_ha

Use the Field Calculator .

Click OK.

Do the same for other columns.

Save the edits using the ‘Save Edits’ tool , after you’re done with changing the names of the six
columns.
Page 17 of 18

Delete the old heading names. On the attribute table, click the ‘Delete Attributes’ tool .

Save the edits using the ‘Save Edits’ tool.

Click ‘Toggle Editing Mode’ tool.

Close the attribute table.

Click OK.

The joined table looks like the one below:

Close the table.


Page 18 of 18

The attributes of SL_MuniTable.csv are now joined to SL_Munis.shp in the new file called
SL_Munis_join.shp.

In QGIS Table of Contents, remove SL_MuniTable and SL_Munis.

Save project as SoLeyte_Join.qgs in the folder C:\.....\Desktop\SLSU_GIS\OUTPUT\PROJECT

End of Activity.

Anda mungkin juga menyukai