0% found this document useful (0 votes)
10 views58 pages

Topic 4 - Creating Features From Tabular Data

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views58 pages

Topic 4 - Creating Features From Tabular Data

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Republic of the Philippines

Philippine Statistics Authority

Creating Features from


Tabular Data

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Outline of the Presentation


A. Conversion of CSDBE to GIS-ready Tables
(AVP)
B. Loading of GIS-ready tables
C. Exploring Tabular Data (Extracting Features
from Tabular Data
D. Combining table features using Join function
E. Creation of Bivariate Map

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Outline of the Presentation


A. Conversion of CSDBE to GIS-ready Tables
(AVP)
B. Loading of GIS-ready tables
C. Exploring Tabular Data (Extracting Features
from Tabular Data
D. Combining table features using Join function
E. Creation of Bivariate Map

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


In CBMS, geotagging of facilities and households is done to determine its presence in
specific areas. These collected data on coordinates, along with other essential information,
are compiled using tables. To easily visualize these, we need to learn how to load the
collected data in QGIS to aid us in further analyzing them.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


1 Open Limasawa_bldg_materials.xlsx
from the Day 2 - 2_Datasets - Dataset
2 folder.

The file contains codes regarding the


location, data on housing
characteristics, and the coordinates of
each geotagged household.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


2 Save the file as Limasawa_bldg_materials_table. Ensure that the Save as
Type is set to CSV (Comma Delimited).

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


3 Open a new QGIS project, load the Limasawa_Southern Leyte_bgyboundary.shp
located in the Day 2 - 2_Datasets - Dataset 2 folder.
4 To add the .csv file in QGIS, select Layer in the menu bar, then Add Layer, and click
Add Delimited Text Layer…

Note: The .CSV (Comma Delimited) file


format is used to easily import high volume
of data in QGIS since they are plain-text
files. The user may also load the data in
.xlsx (Excel) file format, however, a plugin is
needed for loading such.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


Mini Exercise # 2: Loading GIS-ready Tables to QGIS
5 In the Delimited Text tab, set the following
parameters:
• File name:
Limasawa_bldg_materials_table.csv
• Layer name:
Limasawa_bldg_materials_table
• Geometry Definition: Point coordinates
• X field: Longitude
• Y field: Latitude
• Geometry CRS: EPSG: 4326 – WGS 84.
Click Add, then Close.
CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


The Limasawa_bldg_materials_table
layer shall be added in the Layers panel,
and the points representing each
household shall be loaded in the map
canvas.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


6 Export the delimited text layer as a shapefile by using either of the two (2) methods:
The csv file shall be exported as a shapefile so that the user can perform edits in the
attribute table when necessary.
1. Refactor fields* function. Type refactor in the processing toolbox.

*This method is done when the column header


is too long. If the user directly exports the layer
as shapefile, the column headers may not
appear as it was initially loaded in QGIS.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


Set the following parameters:
• Input layer: Limasawa_bldg._materials_table [EPSG: 4326]

Limasawa_bldg_materials_table
• Name for construction material of
floor: Flooring
• Name for construction material of
walls: Walls
Limasawa_bldg._materials_table

• Name for construction material of


Roof: Roofing
• Load fields from template layer:
Limasawa_bldg_materials_table
In the Refactored field, click browse button and save the file as
Limasawa_bldg_materials.shp. Click Run, then Close.
CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables

2. Directly exporting the layer to a shapefile (.shp)

An alternative way of exporting the layer as


shapefile (.shp) is by selecting the
Limasawa_bldg_materials_table, right-click,
select Export, then Save Feature As…

Save the file as Limasawa_bldg_materials.

Ensure that the Save As Type is set to ESRI


Shapefile (.shp).

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


After exporting, the newly-exported shapefile, Limasawa_bldg_materials, shall appear in
the Layers panel. The user may now delete the previously loaded delimited text layer.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


7 To visualize the categories of the housing
characteristics, right-click the
Limasawa_bldg_materials layer and select
Properties.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


8 Click the Symbology tab, select
Categorized, choose flooring for the
Value. Click Classify.

Remove the all other categories value


by clicking the (delete) button.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


9 To visualize the light and strong materials, set
the following parameters in the Symbol
Selector window:
• Size: 2.0 Millimeters
• Fill Color: Light – HEX #b2df8a
Strong – HEX #fb9a99
• Stroke Color: HEX #808080
• Stroke Width: 0.1 Millimeters
• Join Style: Bevel
• Cap Style: Square

Click OK, then Apply.


CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Loading of GIS-ready Tables


The categorized values shall appear in
the Layers panel and shall also be
loaded in the map canvas as shown.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Outline of the Presentation


A. Conversion of CSDBE to GIS-ready Tables
(AVP)
B. Loading of GIS-ready tables
C. Exploring Tabular Data (Extracting Features
from Tabular Data
D. Combining table features using Join function
E. Creation of Bivariate Map

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
Following the previous topic wherein location of all geotagged households was loaded in
QGIS, the user needs to extract the specific characteristics of the housing units to further
assess the data according to the target.

For instance, the characteristics of housing materials of each household—walls, roofs, and
floors—are collected and geotagged. These data on housing characteristics, categorized
into light or strong materials, may be used in determining potential areas prone to damage
caused by calamities, or as poverty indicator, among others. To easily visualize the
location and distribution of households with either light or strong housing materials, these
tabular data can be loaded in and assessed using QGIS.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
1 Open Limasawa_bldg_materials.xlsx located in Day 2 → 2_Datasets → Dataset 2 folder.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
2 Create a new column named bgy beside Barangay column.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
3 In the bgy column, encode =TEXT(D2,”000”), and drag the cell to fill the remaining empty
cells below.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
4 Create a new column bgy_id beside bgy.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
5 In the bgy_id column, encode =CONCATENATE(A2,B2,C2,E2), and drag the cell to fill
the remaining empty cells below.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
6 Copy the bgy_id column and paste it again in the same column as VALUES, to prevent
removal of the leading zeros upon loading in QGIS.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
7 Insert Pivot Table and choose table/range.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
8 Set the following 9 Open a new excel file and create
parameters: a new table with column names
bgy_id and light_roofing and
Rows paste as VALUES the generated
data from the pivot table.
• Construction Material
of the Roof
• Bgy_id

Values
• Bgy_id

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data) Using the same excel file with the
11

10 Go back to the light_roofing data, add another


generated Pivot Table. column for light_wall and paste the
Remove Construction generated values. Put “0” in the value
corresponding to light_roofing for
Material for the Roof
bgy_id 086419004 to denote that
and set the following there are no households with light
parameters: roofing materials in the barangay.
Rows
• Construction Material
of the Outer Walls
• Bgy_id
Values
• Bgy_id
CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Exploring Tabular Data (Extracting Features from Tabular


Data)
12 Save the file as Limasawa_lightroof_lightwall. Ensure that the Save as Type is set
to CSV (Comma Delimited).

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Outline of the Presentation


A. Conversion of CSDBE to GIS-ready Tables
(AVP)
B. Loading of GIS-ready tables
C. Exploring Tabular Data (Extracting Features
from Tabular Data
D. Combining table features using Join function
E. Creation of Bivariate Map

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


The Join function allows linkage of two attribute tables using common values of
features for further processing and analysis.
1 In the menu bar, select Layer and click Data Source Manager.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


2 In the Data Source Manager
window, click Delimited Text. Click
the browse button and locate
Limasawa_lightroof_lightwall.csv.
• Set the layer name to
Limasawa_lightroof_lightwall. c

• Uncheck Detect field types in


the Record and Fields Options to
retain the leading zeros in the c

data
• Select No Geometry under
Geometry Definition.
Click Add, then Close.
CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


3 Open the attribute tables of Limasawa_Southern Leyte_bgyboundary and
Limasawa_lightroof_lightwall. Identify the common fields of the attribute tables for the
Join function. In this case, the geocode and bgy_id fields will be used.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


4 Open the attribute table of the Limasawa_Southern Leyte_bgyboundary and click Toggle
editing mode. Click the Open field calculator button.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


5 In the Field Calculator window, set the
following parameters:
• Tick the checkbox beside Create a New
Field
• Output field name: bgy_id
• Output field type: Text (string)
• Output field length: 10
In the Expression, encode:
Region code Number of digits
• Ensure that there are
no spaces in the
code.

lpad(('08'+"geocode"),9,'') • TWO (2) SINGLE


quotation marks are
used before the last
closing parenthesis.

Click OK. And Save edits.


CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


• The encoding of lpad(('08'+"geocode"),9,'') is done to generate a common field to
perform the JOIN function for two (2) separate layers.
• Ensure the proper encoding of PSGC codes in the respective areas
• In the event that the leading zeros in the bgy_id of the csv file did not load in QGIS,
the user shall encode lpad(('8'+"geocode"),8,'') to generate a common field.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


A new bgy_id column containing the same values as the bgy_id of the
Limasawa_lightroof_lightwall layer shall be generated in the Limasawa_Southern
Leyte_bgyboundary layer.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


6 Open the Limasawa_Southern Leyte_bgyboundary Layer Properties window,
select Joins tab and click Add new join button.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


Mini Exercise # 3: Joining GIS-ready Tables to Shapefiles
7 In the Add Vector Join window, set the following
parameters:
• Join layer: Limasawa_lightroof_lightwall.csv
• Join field: bgy_id
• Target field: bgy_id
Cache join layer in memory is enabled by default to
speed up the Attribute table lookup.
Tick the checkbox beside Joined fields and select
light_roofing and light_wall. Click OK.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


8 Click Apply then OK.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


9 Check the Limasawa_Southern Leyte_bgyboundary layer attribute table if the
merging is successful.

In attribute table joins, the data from the joined layer has not migrated to the target
layer’s attribute table, but rather a symbolic link.
.
CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


10 Edit the name of the joined field by using the Refactor fields. In the Processing
Toolbox, type refactor.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


11 Set the parameters in the Refactor
Fields window:
• Input layer: Limasawa_Southern
Leyte_bgyboundary
• Name for light_roofing layer:
light_roof
• Name for light_wall layer:
light_wall
• Ensure that the Type for both fields
is changed from TEXT to INTEGER
(64 bit). Set the length to 10.
• Load fields from layer:
Limasawa_Southern
Leyte_bgyboundary
CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


In the Refactored field, click browse, then
Save to file, and save the file as:

ME3_LastName_FirstName.shp

Click Run, then Close.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


The exported shapefile shall be added to the Layers panel.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Combining table features using Join function


12 Open the attribute table of the newly-exported refactored layer. When there are NULL
values in the light_roof and light_wall columns, click the Toggle editing mode button,
and manually encode 0 in the fields with NULL values to denote that there are no
households constructed with light materials in that specific area.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Outline of the Presentation


A. Conversion of CSDBE to GIS-ready Tables
(AVP)
B. Loading of GIS-ready tables
C. Exploring Tabular Data (Extracting Features
from Tabular Data
D. Combining table features using Join function
E. Creation of Bivariate Map

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map

A choropleth map is a thematic map wherein values are usually presented in colors or
patterns using one (1) variable and is referred to as a univariate map. This map can be
generated by using the Graduated Symbology in QGIS.

On the other hand, a bivariate map uses two (2) variables in a single map. It is often used
to compare or determine the relationship between these variables.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map

An example of two (2) univariate maps combined to generate a bivariate map

Source: https://www.joshuastevens.net/cartography/make-a-bivariate-choropleth-map/

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map


Using the refactored layer from the previous section, create a bivariate map using the data
on housing materials with light roofs and light walls.
1 Duplicate the refactored layer. Rename the 1st layer as Limasawa_Southern
Leyte_lightroof and the duplicate copy as Limasawa_Southern Leyte_lightwall.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map


2 Open the layer properties of Limasawa_Southern
Leyte_lightroof, select Graduated in the
Symbology tab. Click Classify, remove the all
other categories value by clicking the (delete)
button. Set the following parameters:
• Value: light_roof
• Color ramp: BuGn
• Mode: Natural Breaks (jenks)
• Blending mode (Layer): Multiply
3 Set the Classes to 3 and encode 0.00-1.00, 1.00-
10.00, and 10.00-15.00 in the Values. Click
Apply, then OK.
CBMS Module III-A: Thematic Mapping using CBMS Data
Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map


4 Open the layer properties of
Limasawa_Southern Leyte_lightwall, select
Graduated in the Symbology tab. Click Classify,
remove the all other categories value by clicking
the button. Set the following parameters:
• Value: light_wall
• Color ramp: Blues
• Mode: Natural Breaks (jenks)

5 Set the Classes to 3 and encode 4.00-12.00,


12.00-43.00, and 43.00-64.00 in the Values. Click
Apply, then OK.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map


Upon clicking the Apply button, the
map canvas shall load as shown.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map


6 Install the Bivariate legend plugin. This plugin generates the legend to be used for
bivariate maps.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map


7 Open the Bivariate legend plugin and set
the following parameters:

• Top layer: Limasawa_Southern Leyte_lightroof


• Tick the checkbox beside Reverse colors
• Bottom layer: Limasawa_Southern Leyte_lightwall
• Square width: 30
• Multiply

Click Generate legend.

8 Click Export legend to image and save the file


as Limasawa_bivariate.png, click Save.

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map


9 Create a map layout using the generated data
on construction materials and the bivariate
legend.

10 Save the project as:


ME3_LastName_FirstName.qgs

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Creation of Bivariate Map


Exercise # 2: Creation of bivariate map

Using Padre Burgos_bldg_materials.xlsx and Padre Burgos_Southern


Leyte_bggboundary.shp located in Day 2 - 2_Datasets - Dataset 2 folder, create a
bivariate map using the data on light roof and light wall construction materials.

Save the map as:


E2_RSSO/PSO_LastName_FirstName.png

CBMS Module III-A: Thematic Mapping using CBMS Data


Republic of the Philippines
Philippine Statistics Authority

Thank you!

CBMS Module III-A: Thematic Mapping using CBMS Data

You might also like