Download as pdf or txt
Download as pdf or txt
You are on page 1of 58

Introduction to

CJWK
What is QGIS?
• Quantum GIS or QGIS is an open source (Free) GIS processing
software
• It offers various functions such as different vector and raster analysis,
including the production of maps.
• This tutorial will;
❑ Show how to install current version of QGIS software
❑ Show some examples of GIS processing;
1. Georeferencing and Digitizing
2. Vector Analysis (Reproject, Importing and Exporting Coordinates)
❑Producing Simple Map

CJWK
How To Install QGIS
• Browse to QGIS website (https://www.qgis.org/en/site/)
• Click the “Download Now” Button

CJWK
How To Install QGIS
• Two version of the Standalone installer from OSGeo4W packages
available : Latest release and Long term release
• Latest release includes more features while Long term release is
more stable (Choose stable version to reduce software crash)
• Select QGIS standalone Installer Version 3.16 (64 bit if your laptop/pc
has 64 bit operating system)
• Wait for installer to finish download

CJWK
How To Install QGIS
• In “Downloads” folder, double click on the QGIS installer
• The Setup window will appear. Click Next → I Agree

CJWK
How To Install QGIS
• Set destination folder →C:\Program Files\QGIS 3.16
• Click Next

CJWK
How To Install QGIS
• In Choose Components Window, do not select the other Data Sets
(to save space)
• Click Install

CJWK
How To Install QGIS
• Click Finish once the installation is completed

CJWK
How To Install QGIS
• QGIS software should appear in your “Recently added” tab in start
menu
• Click on QGIS Desktop 3.16.7

CJWK
QGIS Interface

CJWK
Setting up Project in QGIS

• Click New Empty Project


• To save the project, click the Save button or go to “Project”,
click “Save”
• Browse to desired directory in your Laptop / PC and name the
project
• Click Save

CJWK
Changing CRS of Project

• Coordinate Reference System of the project can be changed


• In bottom right corner, Click “EPSG:4326”
• Project Properties Window will appear
• In “CRS” Tab, Browse and Select WGS 84 (Authority ID EPSG:4326)
• Click OK

CJWK
Changing Coordinate Display

• Coordinates of the project can also be changed


• In bottom right corner, Click “EPSG:4326”
• Project Properties Window will appear
• Select “General” Tab
• In coordinate and bearing display, coordinates can be changed to Map
units (degrees); Decimal Degrees; Degrees, minutes; Degrees, minutes,
seconds
• Select desired coordinate display and click OK

CJWK
Examples of GIS Process
(Georeferencing)
• Georeference is the process in which we set the coordinates of an
image / scanned map that has no coordinate system
• Images or maps in JPEG format are examples of data that has no
coordinate systems
• Two Methods in Georeferencing
1. Inputting known coordinates into points
2. Using reference image

CJWK
Georeferencing

• In “Raster” tab, select “Georeferencer”


• Georeferencer Window will appear

CJWK
Georeferencing

• In Georeferencer window, Select “File” tab, select “Open Raster”


• Open raster window will appear, select image that needs to be
georeferenced
• Image selected will appear in Georeferencer window
• Select “Transformation Settings”
• Set “Transformation Type” to desired choice
• Set “Target SRS” to EPSG:4326 – WGS 84
• Set “Output Raster” directory
• Tick ( ) Save GCP points
• Tick ( ) Load in QGIS when done
• Click OK
CJWK
Georeferencing (Method #1)

• Select “Add Point”


• The cursor in the georeferencer window will change to cross symbol
• Select area in the image to add the point
• Input the X and Y coordinates (Based on the values in the image)
• Input multiple points
• Click Run

CJWK
Georeferencing (Method #1)

• Georeferenced image will appear in Project Window


• In “Layers” right click on georeferenced image and click properties
• Select Transparency Tab and change “Global Opacity” to 50% or less
• Click OK
• Add image or raster/vector with known coordinate system to check
whether the georeferenced image have been georeferenced correctly
• Check if the boundaries of the area match the reference image (Make
sure the reference image is below the georeferenced image in
“Layers” tab
• Alternative: in “Browser” Tab, find “XYZ tiles”. Drag
“OpenStreetMap” to the “Layers Tab”
CJWK
Georeferencing (Notes)

• If georeferenced image does not match the reference image, go back


to “Georeferencer” window and add/delete/move the GCP
• You can delete or move the GCP using
• In bottom right of georeferenced window, make sure “Mean error”
has the smallest value (Larger value means larger error)

CJWK
Georeferencing (Method #2)

• In “Layers” tab, add in a reference image with known coordinates


• Find areas that have similar features in both the reference image and
the image to be georeferenced
• When selecting the GCP (Add point), instead of inputting the
coordinates, click “From Map Canvas”
• Select the similar features from the reference image
• Input multiple points
• Click Run
• Next steps the same with Method #1

CJWK
Digitizing

• Digitizing is a process where features from an image are “digitized” as


a vector layer (shapefile)
• A vector layer can be
1. Polygon
2. Lines
3. Points
4. Multipoints
• Vector layers are useful because they can be used as boundaries or
used to extract information from other datasets

CJWK
Digitizing

• In Project window, Right click on the top toolbar


• “Panels” and “Toolbars” tab will appear
• In “Toolbars”, Tick ( )
• Advanced Digitizing Toolbar
• Shape Digitizing Toolbar
• Snapping Toolbar
• The selected toolbars will appear in the top toolbar

CJWK
Digitizing

• Select “Layer” → “Create Layer” → “New Shapefile Layer”

CJWK
Digitizing

• New Shapefile Layer window will appear


• In “File name” set the desired directory and name of the shapefile
• Set “Geometry Type” to desired choice (in this tutorial, select
polygon)
• Make sure CRS is set to EPSG:4326 – WGS 84

CJWK
Digitizing

• In “New Field” section, type name of the field (Length of name is


limited so ensure name of field is short)
• Type in “For_Class” to represent forest class
• Set “Type” to the desired type of field
• For forest class field, select “Text Data”
• Set the length (number of letters that can be written inside the field)
• Click “Add to Field List”
• For_Class field will appear in “Field List” Section

CJWK
Digitizing

• Add another field called “Area (ha)” to represent area of the polygons
that will be digitized
• Set “Type” to the desired type of field
• For area , select “Decimal Number”
• Set the length (number of digits that can be written inside the field)
• Set Precision to 6 (number of decimal places)
• Click “Add to Field List”
• Area (ha) field will appear in “Field List” Section
• Click OK

CJWK
Digitizing

• The newly created shapefile will appear in the “Layers” tab


• Right click on the shapefile, click “Toggle Editing” or search the project
toolbar for the toggle editing button
• A pencil icon will appear in the box next to the name of the shapefile
selected

CJWK
Digitizing

• In “Advanced Digitizing Toolbar”, click the “Enable Snapping” button


• Select “Avoid Overlap on Active Layer”

• Start digitizing the polygon by clicking the “Add Polygon Feature”


button in the “Data Source Manager Toolbar”

CJWK
Digitizing

• Left click to digitize the area desired (trace the borders of the area)
• Right click to finish the polygon
• “Feature Attributes” window will appear
• Type in the information in each field section if known or leave NULL
if unknown
• Type in the polygon number in “id” field
• Type in the forest class number in “For_Class” field
• Click OK
• Polygon digitized will appear

CJWK
Digitizing

• Start digitizing the next polygon from the vertices of the previous
polygons
• Enabling “Snap” function prior to digitizing will ensure no gaps
between neighbouring polygons (ensure all the areas are digitized)
• Enabling “Avoid Overlap on Active Layer” function prior to digitizing
will ensure the neighbouring polygons do not overlap with each
other
• Delete/Edit a polygon by browsing through “Advanced Digitizing
Toolbar”
• When all areas have been digitized, right click on the shapefile in the
“Layers” tab and click “Toggle Editing” to stop editing process. Click
Save in the “Stop Editing” window
CJWK
Digitizing

• Digitizing can also be done when there is an active internet


connection → using base map as reference
• In “Browser” tab, find “XYZ Tiles”
• Drag “OpenStreetMap” to the “Layers” tab
• Open Street Map will be displayed

CJWK
Digitizing

• Other base map can also be inserted inside the “XYZ Tiles”

1. Google Maps: https://mt1.google.com/vt/lyrs=r&x={x}&y={y}&z={z}


2. Google Satellite:
http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}
3. Google Satellite Hybrid:
https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}
4. Google Terrain: https://mt1.google.com/vt/lyrs=p&x={x}&y={y}&z={z}
5. Google Roads: https://mt1.google.com/vt/lyrs=h&x={x}&y={y}&z={z}
6. ESRI :
https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapS
erver/tile/{z}/{y}/{x}

CJWK
Digitizing

• Right click “XYZ Tiles”, select “New connection”


• XYZ Connection window will appear
• Type in the name of the base map
• Insert the URL of the base map
• Click OK
• Drag the base map into “Layer tab”
• Repeat steps to digitize

CJWK
Vector Analysis

• Various analysis can be done on vector files


• This tutorial will show how to;
1. Reproject layers to different CRS
2. Import coordinates from CSV, GPX and KML files into QGIS
3. Extract coordinates from shapefile and export to CSV file

CJWK
Vector Analysis (Reproject)

• The “Reproject” function changes the coordinate reference system


(CRS) of a layer
• QGIS can display layers with different CRS into the same project
(other softwares may not)
• Easiest way to know the CRS of a layer
• Right click on the layer, select “Layer CRS”
• The first line (or the grey coloured text) is the CRS of the layer
• Although the layers can be displayed in QGIS, some problems may
occur during further analysis if the CRS of each layer is not changed
• Ex: Different coordinates

CJWK
Vector Analysis (Reproject)

• Select “Vector”→ “Data Management Tools” → “Reproject Layer”

CJWK
Vector Analysis (Reproject)

• “Reproject Layer” window will appear


• Set “Input Layer” to the desired layer to reproject
• Set “Target CRS” to the desired CRS of the new layer
• In “Reprojected” section, select “Save to File” to save the new layer
• Tick ( ) Open output file after running algorithm
• Click Run

CJWK
Vector Analysis (Importing Coordinates)

• Common files used to import coordinates to QGIS are from CSV,


GPX and KML files
• Comma-separated values (CSV) files are obtained from spreadsheets
• GPX files are obtained from GPS devices
• KML files are obtained from Google Earth Pro application

CJWK
Vector Analysis (Importing Coordinates
from CSV files)
• Select “Layer”→ “Add Layer” → “Add Delimited Text Layer”

CJWK
Vector Analysis (Importing Coordinates
from CSV files)
• “Data Source Manager Delimited Text” window will appear
• Browse CSV file from “File name”
• In “File Format” section, select CSV
• In “Geometry Definition” section, select “Point Coordinates”
• In “X field” select the x/Longitude coordinates
• In “Y field” select the y/Latitude coordinates
• Tick ( ) DMS coordinates if the coordinates are in Degree Minutes Second
format. Keep untick if coordinates are in Decimal Degree format
• Set “Geometry CRS” to the desired CRS
• Click “Add”

CJWK
Vector Analysis (Importing Coordinates
from GPX and KML files)
• QGIS will automatically open files from GPS and KML files
• Browse the GPX and KML file from the “Browser” panel, click and
drag to the “Layers” panel

• When opening GPX file, “Select Vector Layers to Add” window will
appear. Select the desired layers

CJWK
Vector Analysis (Importing Coordinates)

• Save the coordinates displayed in the project window as shapefile to


use in other analysis
• In “Layers” panel, right click the layer to export as shapefile
• Select “Export” → “Save Features As”

CJWK
Vector Analysis (Importing Coordinates)

• “Save Vector Layer as” window will appear


• In “Format”, select “ESRI Shapefile”
• Browse the desired directory and name the shapefile in “File name”
• Set “CRS” to desired CRS
• Tick ( ) “Add saved file to map” if you want to display the shapefile
in the project windows
• Click OK

CJWK
Vector Analysis (Extracting Coordinates
from Shapefile)
• Digitize points into the layer (Create a new Shapefile layer, set
geometry as point)
• Select “Vector” → “Geometry tools” → “Add Geometry Attributes”

CJWK
Vector Analysis (Extracting Coordinates
from Shapefile)
• “Add Geometry Attributes” window will appear
• Select the layer desired in “Input Layer”
• In “Calculate using” section, select “Layer CRS” or “Project CRS”
• In “Added geom info” section, select “Save to File” to save the new
layer. Otherwise, select “Create temporary layer”
• Click Run
• Right click on the new layer and select “Open Attribute Table”
• The coordinates are displayed in decimal degrees as “xcoord” and
“ycoord”

CJWK
Vector Analysis (Extracting Coordinates
from Shapefile)
• To change the coordinates extracted from Decimal Degrees to
Degree Minute Second (DMS) format, open attribute table of the
layer
• Select “Toggle editing mode” from the attribute table window
• Select “Open Field Calculator”

• “Field Calculator” window will appear


• Tick ( ) “Create a new field”
• Set “Output field name” to desired name (xcoord_dms)
• Set “Output field type” as “Text (string)”
• Set “Output field length” to “20”
CJWK
Vector Analysis (Extracting Coordinates
from Shapefile)
• In “Expression” under “row_number” section, expand “Conversions”
• Double click “to_dms” function
• Function will appear in “Expression”

CJWK
Vector Analysis (Extracting Coordinates
from Shapefile)
• In “Expression” under “row_number” section, expand “Field and
Values”
• Double click “xcoord”

CJWK
Vector Analysis (Extracting Coordinates
from Shapefile)
• In “Expression” section, add in ,’x’,5)
• Click OK

CJWK
Vector Analysis (Extracting Coordinates
from Shapefile)
• New field “xcoord_dms” will be added to the attribute table with
coordinates values in DMS format
• Repeat steps for y coordinates. Name field as “ycoord_dms”
• Click “Save edits” and “Toggle Editing” to finish

CJWK
Vector Analysis (Exporting attribute table
to CSV file)
• Right click on the layer to export
• Select “Export” → “Save Feature as”
• “Save Vector Layer as” window will appear
• In “Format”, select “comma separated value [CSV]”
• Browse the desired directory and name the shapefile in “File name”
• Set “CRS” to desired CRS
• Tick ( ) “Add saved file to map” if you want to display the shapefile
in the project windows. Untick if otherwise
• Click OK

CJWK
Producing Maps

• Maps can be produced in QGIS


• Ensure all the layers area displayed inside the “Layers” panel
• Select “Project” → “New Print Layout”
• “Create Print Layout” window will appear
• Name the print layout
• Click OK
• A new map window will appear

CJWK
Producing Maps

• Ensure all the layers area displayed inside the “Layers” panel
• Select “Project” → “New Print Layout”
• “Create Print Layout” window will appear
• Name the print layout and click OK
• A new map window will appear

CJWK
Producing Maps

• Right click on the empty canvas and click “Page properties” to change
the properties of the map (Details will appear in the “Items” panel)
• In the “Toolbox” panel click “Add map”
• Click and drag inside the canvas to desired size of the map
• The layers that are displayed in the “Layers” panel will appear
• Click “Move item content” to edit the position and size of the layers
• Left click and drag to reposition the layers
• Hold ‘CTRL’ key and scroll button of the mouse to adjust the size
• In the “Items” panel, under “Item Properties” section, expand “Main
Properties” and tick ( ) “Lock layers” to prevent the layers from
moving during map editing
CJWK
Producing Maps

• To add gridlines to the map, under “Item Properties” section expand


“Grids”
• Add the grid and click “Modify Grid”
• Edit the appearance of the grid based on your preference
• Set “CRS” to desired CRS
• Set “Interval” to “Map Units”
• Set the X and Y interval
• Edit the frame based on your preference
• Tick ( ) “Draw Coordinates” to display the coordinates in the grid
• Edit the display of coordinates based on your preference

CJWK
Producing Maps

• In the “Toolbox” panel click “Add Legend”


• Click and drag inside the canvas to desired size of the legend
• Edit the appearance of the legend based on your preference in the
“Item Properties” section
• In the “Toolbox” panel click “Add Scale Bar”
• Click and drag inside the canvas to desired size of the scale bar
• Edit the appearance of the scale bar based on your preference in the
“Item Properties” section
• In the “Toolbox” panel click “Add North Arrow”
• Click and drag inside the canvas to desired size of the north arrow
• Edit the appearance of the north arrow based on your preference in
the “Item Properties” section
CJWK
Producing Maps

• To save the map, select “Layout” at the top toolbar → “Export as


Image”
• Set the desired directory of the image, the name and type of file.
Click save
• “Image Export Options” window will appear
• Set the desired export resolution in “Export Options”, click Save

CJWK
-END-

CJWK

You might also like