Uploaded by Muhammad Zhafran

QGIS Tutorial by Indo-RNO v1.0

advertisement
QGIS Basic Tutorial
By Pusat Loker RNO Only
a.k.a. Indo-RNO
“When a man dies, his acts come to an end, but three, recurring charity, or knowledge (by which people) benefit, or a pious son, who prays for him (for the deceased).”
-Sahih Muslim 1631-
Why QGIS?
Mapinfo 2021 Official Price
Mapinfo
Alternative
FREE!
Powerful!
Getting
Better,
Better and
Better!
Supported by QGIS Developer
Community
Table of Content
1. Installation
a. Program
b. Plugin
c. Material
2. Basic Principle
a. File Type
b. CRS
3. Frequently Used Symbols
4. Display Basic Accessories on Canvas
a. Scale
b. Image
c. Compass
d. Title
e. Copyright
f. Annotations
g. Google Map
5. Open File
a. Vector: TAB/MIF/SHP
b. Raster: Google Map/Earth, Elevation
c. Text: CSV
d. Excel: XLSX
6. Download Raster for Offline Use
a. DEM/Contour/Elevation
b. Google Map
7. Searching and Finding
a. Search Location by Long Lat
b. Copy Long Lat of Location
c. Search Value on Layer
8. Thematic Layer
a. Add Color on Layer
b. Add Color on Raster
c. Add Label
9. Export Layer to KML/KMZ
10. Contour/Elevation Check
11. Selection and Query
a. Manual Select on Canvas
b. Filter Expression by Script
c. Select Data by Polygon
12. Edit Layer
a. Change Value of Column
b. Change Table Structure
c. Split Polygon
13. Clipping by Polygon
a. Vector
b. Raster
14. Create Shape
a. Border Polygon
b. Route Line
c. Buffer
d. POI Based on Long Lat
e. Gcell
15. Append / Merge
a. Join Layers by Same Column
b. Join Attributes Data inside Polygon
16. Join Layer
a. Join Layers by Same Column
b. Join Attributes Data inside Polygon
17. Heatmap
a. Basic Heatmap
b. IDW Interpolation
c. Linear Interpolation
18. MR/Covmo 40x40 meter
a. Change Scale MR for Display Only
b. Create MR Square/Grid Shape
Permanently
19. Map Reporting
20. Network Audit
a. Inter Site Distance (ISD)
b. Nearest Site to Polygon
c. LAC Island//Mushroom with Voronoi
Contributors
Aldindha Octa Airlangga
aldindha.work@gmail.com
https://www.linkedin.com/in/aldindha/
Installation
1. Download and Install QGIS: https://qgis.org/en/site/forusers/download.html
2. Open QGIS and go to Plugins → Manage and Install Plugins → Search and install the following plugins:
a. Search Layers
b. Profile Tool
c. SRTM Downloader
d. Spreadsheet layers
e. Shape Tools (in Vector)
f. Lon Lat Tools
g. KML Tools
h. QCopyCanvas
i. QuickMapServices
3. Download Link for Materials:
https://1drv.ms/f/s!Ari-fJDiX6PzjdtKV9ZkIINu5nvV7A?e=bNntEL
4. Download Link for Tutorial Update:
https://1drv.ms/f/s!Ari-fJDiX6PzjdtL-daJdbcyuASF_w?e=eWfFts
Basic Principle
File
Type
Vector
Vector data is used to
represent real world features
in a GIS.
Ex: .TAB, .MIF, .SHP
Raster
Raster data are a grid of
regularly sized pixels.
Ex: Google Map/Earth, DEM
(Contour), .TIF
Text
A delimited text file is an
attribute table with each
column separated by a
defined character and each
row separated by a line break
Ex: .CSV, .TXT
Excel
A spreadsheet consists of a
table of cells arranged into
rows and columns and
referred to by the X and Y
locations.
Ex: .XLS, .XLSX
Ctrl + Shift + V
CRS Type
EPSG:4326 - WGS 84
Ctrl + Shift + R
Unit: Degree
EPSG:3857 - WGS 84 /
Pseudo-Mercator
Ctrl + Shift + T
No Shortcut
Unit: Meters
A coordinate reference system (CRS) then
defines, with the help of coordinates, how the
two-dimensional, projected map in your GIS is
related to real places on the earth. The decision
as to which map projection and coordinate
reference system to use, depends on the
regional extent of the area you want to work in,
on the analysis you want to do and often on
the availability of data.
Frequently Used Symbols
Zoom In
See Info of Feature
Move Canvas
Measure Line Distance
Move Label
Add Annotation Text to Canvas
Search Layers
Create New Shapefile
Edit Layer
Add Polygon/Line
Contour Check
Download Online Contour
Shape Tools
Deselect Features
Zoom to Long Lat
Select Features
Select Features by Polygon
Export to KMZ
Screenshot Canvas
Display Basic Accessories on Canvas
1. Go to View → Decorations → Select the following
setting
a. Scale Bar
b.
c.
North Arrow
d.
Title Label
e.
Copyright
Image
Enter Image file path
*Tips: always use buffer for text labelling
2. Go to Edit → Annotation → Text Annotation →
Click on Canvas → Double click on box created →
Setting Opacity to 0% on both Linked layer and
Map marker
Display Basic Accessories on Canvas
3.
Go to Web → QuickMapServices → Google → Google Road
Open File
1. Vector: TAB, MIF, SHP
a. Ctrl + Shift + V or Go to Layer → Add Layer → Add Vector Layer
b. On Source select file-> Add
2. Raster: Google Map/Earth, DEM/Elevation, TIF
a. Ctrl + Shift + R or Go to Layer → Add Layer → Add Raster Layer
b. On Source select file-> Add
3. Text: CSV, TXT
a. Ctrl + Shift + T or Go to Layer → Add Layer → Add Delimited Text Layer
b. On File Name select file→ On X field and Y field select Long and Lat of the
File → Add
4. Excel: XLSX, XLS
a. Go to Layer → Add Layer → Add Spreadsheet Layer
b. On File Name select file→ On Sheet select data sheet of File
c. Checklist Geometry → On X field and Y field select Long and Lat of the
File → OK
*The Layer will be opened on Layer Panel on the left bar
Download Raster for Offline Use
1. DEM / Contour / Elevation
a. Indonesia local DEM all province:
https://www.indonesiageospasial.com/2020/01/download-dem-srtm-30-meter-seindonesia.html
b. Custom area by Canvas
Go to Plugin → SRTM Downloader → Canvas Extent ->
Download → Enter Username and Password (register free
on link) → OK
2. Google Map: Select only Google Map on Layers panel
a. Current Display (No zoom)
Go to Project → Import/Export → Export Image to Map →
Map Canvas Extent -> Save
b. Current Display in Detail (Zoom in)
✓ Double click Google Map Layers panel → Export →
Save As
✓ Select File Name → Map Canvas Extent → Fill “1” on
both Horizontal and Vertical -> OK
Searching and Finding
1. Search Location by Long Lat
a. Search Location on https://maps.google.com/
→ Right click and select Lat Long
b. Go to Plugins → Lat Lon Tools → Zoom to
Coordinate → Paste Lat Long Value → Enter
c. Click
to setting marker
2. Copy Long Lat of Location on Canvas
a. Right click anywhere to canvas → Copy
Coordinate → Map CRS
b. Paste to Notepad/Excel
3. Search Value on Layer
a. Go to Plugins → Search Layers → Search
Layers
b. Write value to search → Select Layers →
Search Fields → Select “Zoom to selected
features” → Click Search
c. Click one of the result
Thematic Layer
1. Add Color on Layer
a. Double click on layer → Symbology → There are 3 symbol often used:
✓ Single Symbol: for a single symbol with no criteria of value
✓ Categorized: for String/Text type of value → Go to Value to select
column of layer to be colored → Classify
✓ Graduated: for Decimal type of value
b. These are features often used:
✓ Fill Color → Color inside polygon
✓ Fill style → Fill type inside polygon
✓
✓
✓
✓
✓
✓
✓
✓
Stroke color → Color of line/border
Stroke style → Color
Opacity → Transparency
Style → Save and Load style as template
Value → Column name of layer as reference
Color ramp → Spectrum of color
Classify → Automatic color adjustment
Classes → Number of value range
* Double click on Symbol/Value edit manually
Thematic Layer
c. Add Color Ramp
✓ Back to Canvas → Go to Settings → Style Manager →
✓ Color Ramp → Click + → Select Catalog: cpt-city
✓ Select any color → OK
✓ Type name of Color → Tick Add to favorites → Save
Thematic Layer
2. Add Color on Raster
a. Double click on layer → Symbology → On Render Type select Singleband pseudocolor → Select Color ramp → Classify → OK
b. To change Opacity go to Transparency → Set Global Opacity value → OK
* Double click on Value/Color/Label to edit manually
* Click on + to add more range of value
Thematic Layer
3. Add label
a. Double click on layer → Labels → There are 3 symbol often used:
✓ Text: change font, style, size, color
✓ Buffer: add buffer background of label
✓ Callouts: add line of label → On Toolbar click symbol
to move label
Export GCELL Layer to KML/KMZ
1. Go to Vector → KML Tools → Export KMZ
2. Setting as the following:
a. Input Layer: a layer to be exported. Ex: Gcell
b. Name/Label field: a field/column to be labelled on KMZ file. Ex: Sitename
c. Checklist Export style for single, categorized, and graduated symbols
d. Output KMZ file → Save to a File: Output file path
3. Click Run
4. After finished .KMZ file can be opened on Google Earth
KMZ file opened in Google Earth
Contour/Elevation Check
1.
2.
3.
4.
5.
6.
Go to Plugins → Profile Tool → Terrain profile
Select DEM layer
Click Add Layer
Click on Canvas to stretch from one point to another point, double click to finish
Right click to close measurement
Click Save As to save as image file
Selection and Query
1. Manual Select on Canvas
a.
b.
Go to Select Features icon → Select any → Click any object/feature on
Canvas
To use multiple selections use Ctrl + Click any object/feature on
Canvas
* Features/Object selected will be colored in Yellow
2. Filter Expression by Script
a.
b.
c.
d.
Use
Right click on layer → Filter
Select Fields to search → All
Use Expression with base “Field” operator ‘Value’
Herewith frequent expression to use:
✓ Select one value:
“Field” = ‘Value’
✓ Select multiple value:
“Field” = ‘Value’ OR “Field” = ‘Value’
✓ Select value contain string:
“Field” LIKE ‘%Value%’
to deselect/unselect features click on
* Features/Object filtered by multiple value
Selection and Query
3. Select Data by Polygon
a. Go to Vector → Research Tools → Select by Location
b. Select features from layer to be selected → tick are within → By
comparing to the features from select polygon layer to be
mask/border → Run
Before
* Ex: Select feature from (MR), By comparing to the features from (Polygon Kota
Pekanbaru) → Result: All MR inside polygon Kota Pekanbaru are selected
* Features/Object selected will be colored in Yellow
After
Edit Layer
Right click on layer → Toggle Editing
1. Change Value of Column
There are 2 way to edit layer:
a. Right click on layer → Open Attribute Table → Edit any cell value to change.
To filter a value click
on bottom left → Field Filter → Select column name → Type value to search → Enter
b. Identify feature
on one of the object canvas → Click
→ Edit any value to change
c. Right click on layer → Save Layer Edits
Edit Layer
2. Change Table Structure
a. Go to Processing → Toolbox → Search Refactor fields
b. Select both Input Layer and Load fields from template layer
from same layer
c. Edit any fields such as: Name, Type, add fields, delete fields,
move field up and down
d. Run
Edit Layer
3. Split Polygon
a.
b.
c.
d.
e.
Right click on Polygon layer → Toggle Editing
Go to Edit → Split Features
Click on Canvas to create line to split Polygon. Right click to finish.
Change value on new polygon
Right click on layer → Save Layer Edits
Before
Cutting
After
Clipping by Polygon
1. Vector
a.
b.
c.
d.
Go to Vector → Geoprocessing Tools → Clip
On Input Layers select vector layer to be clipped
On Overlay Layer → select polygon as border to clip
Run
* Ex: Input (Gcell), Overlay (Polygon Kota Pekanbaru) → Result: Gcell inside
Polygon Kota Pekanbaru
2. Raster
a.
b.
c.
d.
Go to Raster → Extraction → Clip Raster by Mask Layer
On Input Layers select raster layer to be clipped
On Mask Layer → select polygon as border to clip
Run
* Ex: Input (.tif of Google Map), Mask (Polygon Kota Pekanbaru) → Result: .tif of
Google Map inside Polygon Kota Pekanbaru
* To reduce file size convert to .PNG go to → Raster → Conversion → Translate
→ Select clipped (mask) on Input Layer → on Converted select Save to File →
Run
Clipping by Polygon - Result
Vector → Gcell inside Kota Pekanbaru only
Raster → .TIF of Google Map inside Kota Pekanbaru Only
Create Shape
1. Border Polygon
a.
b.
c.
d.
e.
Go to Layer → Create Layer → New Shapefile Layer
Select File name → Geometry type → Polygon →
Change CRS to EPSG:3857 → Select Name, Type, Length
(if need to add new column/field) → Add to Fields List
→ OK
Right click on new shapefile layer → Toggle Editing
Go to Edit to add shape. There are several menu to add
shape:
✓ Freestyle: Add polygon feature
✓ Circle: Add Circle → Add Circle by a Center Point
and Another Point
✓ Square: Add Rectangle → Add Rectangle from
Extent
Click on Canvas to draw Polygon → Right Click to Finish
→ Add Value
2. Route Line
a.
b.
c.
d.
e.
Go to Layer → Create Layer → New Shapefile Layer
Select File name → Geometry type → Line → Change
CRS to EPSG:3857 → Select Name, Type, Length (if
need to add new column/field) → Add to Fields List →
OK
Right click on new shapefile layer → Toggle Editing
Go to Edit → Add Line Feature
Click on Canvas to draw Line → Right Click to Finish →
Add Value
* Do thematic layer to change color and shape line
Create Shape – Polygon and Route → Result
Create Shape
3. Buffer
a.
b.
c.
Open/Add Polygon/Line to Layer Panel. Make sure the CRS type is EPSG:3857 - WGS 84 / PseudoMercator
Go to Vector → Geoprocessing Tools → Buffer
On Input Layer select Polygon/Line → Custom Distance and its unit (meters/kilometers) → On Join
style select Miter → Run
Create Shape
4. POI Based on Long Lat
a.
b.
c.
d.
Prepare CSV/Excel file of POI which consist of Long Lat
Add CSV/Excel file of POI to Layer Panel
Go to Vector → Shape Tools → Create shapes → Create circle
Use the following setting:
✓ Input layer: POI layer
✓ Shape type: Polygon
✓ Circle radius: POI distance from center to border
✓ Radius units: Kilometers/Meters
e.
Run
Result
Create Shape
5. Gcell
a.
Prepare CSV/Excel file of Gcell which contain at least the following column
✓ Sitename
✓ Cellname
✓ Band: Network system define shape size. Ex: L900, L1800, L2100, Indoor
✓ Long Lat: Coordinate of location
✓ Azimuth: Direction of antenna
✓ Azimuth Width: Horizontal size
✓ Radius: Vertical size
Herewith recommendation value of Azimuth Width and Radius:
Band
L900
L2100
L1800
INDOOR
Azimuth Width Radius
15
100
45
65
70
50
359.999
20
Sorting Radius column from Largest to Smallest
b.
c.
d.
e.
Add CSV/Excel file of Gcell to Layer Panel
Go to Vector → Shape Tools → Create shapes → Create pie wedge
Use the following setting:
✓ Input layer: Gcell layer
✓ Shape type: Polygon
✓ Azimuth mode: Use center azimuth and azimuth width
✓ Beginning azimuth: Azimuth of Gcell
✓ Ending azimuth: Azimuth width of Gcell
✓ Radius: Radius of Gcell
✓ Radius units: Meters
Run
Result
Append / Merge
1. Merge Vectors
a.
b.
c.
Go to Vector → Data Management Tools → Merge Vector
Layers
On Input Layers select vector layers to be merged
Run
2. Merge Rasters
a.
b.
c.
d.
Go to Raster → Miscellaneous → Merge
On Input Layers select vector layers to be merged
On Advanced Parameters replace No Data to 0
Run
Append / Merge - Result
Join Layer
Before
1. Join Layers by Same Column
a.
b.
c.
d.
e.
Prepare 2 layer: Base layer and Additional layer. Both layer must have one same column name
Add both layer on Layer Panel
Right click on Base layer → Joins → Click +
Use the following setting:
✓ Join layer: Additional layer
✓ Join field: field of Additional layer to join
✓ Target field: field of Base layer to be joined
✓ Joined fields: Select column of Additional layer to be added
OK
* Ex: Base layer (Gcell), Additional layer (PRB data) → Result: Gcell with have new column of PRB Util
After
Join Layer
Gcell with 38 fields (0-37)
POI with 13 fields (0-12)
2. Join Attributes Data inside Polygon
a.
b.
c.
Go to Vector → Data Management Tools → Join Attributes by
Location
Use the following setting:
✓ Base Layer: Additional layer
✓ Join Layer: Polygon of Border
✓ Geometric predicate: within
✓ Discard records which could not be joined: Ticked
Run
* Ex: Base layer (Gcell), Join Layer (POI) → Result: Gcell inside POI with all
column combined
Joined Layer with 51 fields (0-50)
Heatmap
Prepare CSV/Excel of PRB/Payload in sector level using Bear Distance.xlsx calculator, then add to
Layer Panel based on Long Lat Azimuth/Sector
1. Basic Heatmap
a.
b.
c.
Double click layer → Symbology → Change to Heatmap
Use the following setting:
✓ Color ramp: Pick any
✓ Radius: 10 millimeters
✓ Weight points by: Value of color
✓ Opacity: 25%
OK
Result
Long Site
101.4025
101.4025
101.4025
101.367777
Lat Site
0.461111
0.461111
0.461111
0.484722
Azimuth Distance (Km) Bearing2
0
120
240
0
Long Azimuth
Lat Azimuth
0.1
0
101.4025 0.46200932
0.1 2.094395102 101.4032807 0.46066184
0.1 4.188790205 101.4017193 0.46066184
0.1
0 101.367777 0.48562032
Heatmap
2. IDW Interpolation
a.
b.
c.
d.
e.
Re-Open layer by Export and Change CRS to EPSG:3857 - WGS 84 / Pseudo-Mercator
Go to Processing → Toolbox → Grid (IDW with nearest neighbor searching)
Use the following setting:
✓ Point layer: Main data
✓ The radius of the search circle: 600
✓ Z value from field: Value of color
✓ Additional command-line parameters: -outsize 10000 10000
Run
Thematic by Graduated symbol
Result
Heatmap
3. Linear Interpolation
a.
b.
c.
d.
e.
Re-Open layer by Export and Change CRS to EPSG:3857 - WGS 84 / Pseudo-Mercator
Go to Processing → Toolbox → Grid (Linear)
Use the following setting:
✓ Point layer: Main data
✓ Search distance: 600
✓ Z value from field: Value of color
✓ Additional command-line parameters: -outsize 10000 10000
Run
Thematic by Graduated symbol
Result
MR/Covmo 40x40 meter
1. Change Scale MR for Display Only
a.
b.
c.
d.
d.
Prepare CSV/Excel of MR data → Add
to Layer Panel
Double click on MR layer → Symbology
→ Graduated
Go to Symbol → Simple Marker
Use the following setting:
✓ Size: 40, Meters at scale
✓ Stroke style: No Pen
✓ Symbol (Bottom): Square
✓ Color ramp: BGYR (Invert Color
Ramp)
✓ Classes: 4
✓ Value: Blue (-92 to 0), Green (-102
to -92), Yellow (-110 to -102), Red
Resul
(-140 to -110)
t
OK
MR/Covmo 40x40 meter
2. Create MR Square/Grid Shape Permanently
a.
b.
c.
d.
e.
f.
g.
Prepare CSV/Excel of MR data → Add to Layer Panel
Go to Vector → Shape Tools → Create shapes → Create polygon
Use the following setting:
✓ Input layer: MR data
✓ Shape type: Polygon
✓ Number of sides: 4
✓ Starting angle: 45
✓ Radius: 28.284271
Run
Double click on Output layer → Symbology → Graduated
Use the following setting:
✓ Stroke style: No Pen
✓ Color ramp: BGYR (Invert Color Ramp)
✓ Classes: 4
✓ Value: Blue (-92 to 0), Green (-102 to -92), Yellow (-110 to -102),
Red (-140 to -110)
OK
MR/Covmo 40x40 meter - Result
Result
Angle and Radius
* Radius is a distance from center point to elbow
0o
Angle
45o
c
b
a
𝑎2 + 𝑏2 = 𝑐 2
* Angle is a degree from center point to elbow
•
Use the Pythagorean
theorem to calculate radius
on Pythagorean
theorem.xlsx
𝑐=
𝑎2 + 𝑏2
𝑅𝑎𝑑𝑖𝑢𝑠 =
𝑐
2
Map Reporting
1. Go to Project → New Print Layout → Enter
title → OK
2. Herewith frequent items to put on report:
a. Add Map: Current canvas
b. Add Picture: Select file image
c. Add Label: Custom text annotations
d. Add Legend: Current layer on Layer Panel
e. Add Scale Bar: Scale distance of map
f. Add North Arrow: Compass
3. Go to Layout → Export as Image → Save
Label
North Arrow
Map
Add Map
Add Picture
Add Label
Add Legend
Legend
Add Scale
Bar
Add North
Arrow
Picture
Scale Bar
Network Audit
1. Inter-Site Distance (ISD)
a.
b.
c.
d.
e.
f.
Add Gsite to Layer Panel
Go to Vector -> Analysis Tools -> Distance Matrix
Use the following setting:
✓ Input points layer: Gsite
✓ Input unique ID field: Sitename
✓ Target points layer: Gsite
✓ Targget unique ID field: Sitename
✓ Use only the nearest (k) target points: Number of neighbor site to measure
Run
On output layer add Kecamatan field from Gsite by Join Layer → Export to XLSX
Pivot Table result by Kecamatan and sorting from Smallest to Largest
Result: LIMAPULUH is the Kecamatan which have the densest site population according
to smallest ISD
It is also can be used to define 1st tier sites of every site
Result
Kecamatan
Count of InputID Average of Distance
LIMAPULUH
30
951
PEKANBARU KOTA
10
966
SENAPELAN
10
1,108
SAIL
10
1,182
SUKAJADI
15
1,270
MARPOYAN DAMAI
80
1,524
BUKIT RAYA
45
1,773
PAYUNG SEKAKI
40
1,878
RUMBAI
160
2,319
TENAYAN RAYA
80
2,393
RUMBAI PESISIR
35
3,350
Network Audit
2. Nearest Site to Polygon
a.
b.
c.
d.
e.
Add Gsite to Layer Panel
Go to Processing -> Toolbox -> Distance to nearest hub (line to hub)
Use the following setting:
✓ Source points layer: Polygon Kecamatan
✓ Destination hubs layer: Gsite
✓ Hub layer name attributes: Unique field
✓ Measurement unit: Meters
Run
On output layer → Export to XLSX
* Result: Information of Kecamatan with its nearest site distance
Result
KECAMATAN
HubName -> Sitename
HubDist -> Distance Kecamatan to Site (m)
RUMBAI
LINGKAR_BARAT_UNRI_CR
792.8908649
PAYUNG SEKAKI
DHARMA_BAKTI_PBR_IB
1154.987623
BUKIT RAYA
PEPUTRA
1037.104486
MARPOYAN DAMAI
MAPOYANDAMAI_CR
241.5069876
TENAYAN RAYA
TENAYAN_RAYA_PBR_GT
2116.77197
LIMAPULUH
TANJUNG_RHU
238.7342171
SAIL
SUKAMULYA
262.2879235
PEKANBARU KOTA
GUBERNURAN_RIAU
162.2848372
SUKAJADI
TVRI_PEKANBARU
680.4735496
SENAPELAN
KAMPUNG_BANDAR
268.5824686
RUMBAI
TENGKU_MAHMUD_PBR_PL
902.5812699
RUMBAI PESISIR
ROAD_OKURA_PBR_TB
992.8651063
Network Audit
3. LAC Island//Mushroom with Voronoi
a.
b.
c.
d.
e.
Go to Vector → Geometry Tools → Voronoi Polygons
Select Gsite on Input layer → Run
Use the following setting:
✓ Input layer: Voronoi polygons
✓ Dissolve fields: LAC
Run
Categorized thematic Dissolved layer to identify island/mushroom LAC
Result:
• There is a site with LAC 12 in LAC 11 area
• There is a site with LAC 13 in LAC 12 area
Download