Topic 5.1 - Getting Started With Spatial Analysis
Topic 5.1 - Getting Started With Spatial Analysis
TOPIC 5.1:
Buffer analysis
Source: https://www.spiceworks.com/tech/artificial-intelligence/articles/what-is-spatial-analysis/
1 2 3
MERGE DISSOLVE BUFFER
4 5 6
CLIP INTERSECTION DIFFERENCE
1 2 3
MERGE DISSOLVE BUFFER
4 5 6
CLIP INTERSECTION DIFFERENCE
Provided with the geotagged facilities in Limasawa per barangay, you need to
combine all these layers to create a single merged layer.
The following datasets will be used:
Limasawa_[bgycode]_facilities – geotagged facilities in each barangay in Limasawa
Limasawa_bgyboundary – barangay boundaries in Limasawa
1 2 3
MERGE DISSOLVE BUFFER
4 5 6
CLIP INTERSECTION DIFFERENCE
Dissolve
This function combines adjacent polygon features by
dissolving features belonging to the same class or with
similar values for the specified attributes. This simplifies the layers
to a single continuous feature.
Provided with the barangay boundaries file of Limasawa, you need to generate a single
municipal-level boundary of Limasawa.
The following datasets will be used:
Limasawa_bgyboundary – barangay boundaries layer of Limasawa
Dissolve
1
Before starting, only the Limasawa_bgyboundary must
be loaded in the Layers panel.
Dissolve
3 The Dissolve window will appear on the screen.
First, the layer for dissolving must be set under
Input layer parameter. Choose
Limasawa_bgyboundary from the dropdown.
Dissolve
4 In the next parameter, Dissolve field(s)
[optional], the common attribute value will be
set as a basis for merging the polygon into one
single polygon. One or more attributes can be
specified to dissolve features belonging to the
same class, alternatively, all features can be
dissolved in one.
Dissolve
5 Under the Dissolved parameter, the format of
the output layer will be configured.
Dissolve
6 Set the following:
File name: Limasawa_munboundary
Save as type: SHP files(*.shp)
7 Click Run.
Dissolve
8 The Limasawa_munboundary layer will be
added to the Layers Panel. It shows a
single-bounded polygon. Inside the attribute
table, notice that only feature is retained.
1 2 3
MERGE DISSOLVE BUFFER
4 5 6
CLIP INTERSECTION DIFFERENCE
Buffer
It is proximity function computes and creates a buffer area for all
the features, using a fixed or dynamic distance. It allows
identification of features whether it is within or outside the buffer
area.
You need to create a 750-meter buffer around the geotagged health centers in
Limasawa.
The following datasets will be used:
Limasawa_healthcenter – layer containing geotagged health centers in Limasawa
Limasawa_bgyboundary – barangay boundaries layer in Limasawa
Buffer
1 Open a new QGIS project.
In using the Buffer tool, Projected Coordinate System (PCS) must be set. To do this,
2 open the Properties under the Project menu. Then, select CRS tab and set the CRS to
WGS 84 / UTM zone 51N (EPSG: 32651). Click Apply.
Buffer
3 In the Layers Panel, add Limasawa_bgyboundary and
Limasawa_healthcenter.
Buffer
The Reproject Layer window will appear on the screen.
Buffer
5 Using the Reproject tool, set the parameters for
Limasawa_healthcenter.
First, choose the Input layer to be reprojected
from the dropdown.
Input Layer: Limasawa_healthcenter
Buffer
6 Select the Target CRS to be assigned to the
layer. Choose from the dropdown of the recently
used CRS or click select the CRS icon .
Buffer
7 Under the Reprojected parameter, the format of the
output layer will be configured. Click the button
to show several options for saving the layer.
The reprojected layer will be saved as a shapefiles.
To do this, choose Save to File… and access the
folder Task Force Training → Day 2 → 3_Outputs
→ Outputs 3 folder.
Buffer
8 Click Run.
Buffer
10 Limasawa_bgyboundary_rp and Limasawa_healthcenter_rp will be added to the
Layers Panel. Remove the Limasawa_bgyboundary and Limasawa_healthcenter layers.
Inside the Information Properties of both generated layers, notice that the CRS are
already set to EPSG: 32651 - WGS 84 / UTM zone 51N
Buffer
11 Under Vector tab, select Geoprocessing Tools and Buffer....
Buffer
12 Inside the Buffer window, set the Input layer that
contains the features that will be used as reference
in creating buffer.
Input layer: Limasawa_healthcenter_rp
Below the parameter, there is a Selected features only option. By checking the box, it
allows the creation of a buffer area around selected features.
Selected features only
Buffer
13 Next, the distance parameter. It refers to the
distance radius of the buffer area. There is also a
dropdown where the unit of measurement can be
set such as meters, kilometers, etc.
\
Buffer
Using the buffer tool, there are parameters such as End cap style and Join style that
can be configured to customize the appearance of the buffer area.
Buffer
15 For now, retain the default options for End cap
Style, Join Style, and Miter Limit parameters.
Buffer
17 Under the Buffered parameter, save the output
layer as a shapefile.
Buffered:
Task Force Training/3_Outputs/
Outputs 3/ Limasawa_healthcenter_750m_
buffer.shp
18 Click Run.
Buffer
The buffered layer, Limasawa_healthcenter_750m_buffer,
will be added to the Layers Panel. This contains six (6)
features with the attribute table similar to health center features
attributes from Limasawa_healthcenter_rp layer.
1 2 3
MERGE DISSOLVE BUFFER
4 5 6
CLIP INTERSECTION DIFFERENCE
Clip
This extracts the features of the input layer that overlaps or inside
the overlay layer and retains only the attributes of the input
layer once processing is completed.
Using the generated 750-meter buffer areas from the health centers in Limasawa, you
will use the clip tool retain the portions of the buffer area inside the Limasawa
boundary.
The following datasets will be used:
Limasawa_healthcenter_750m_buffer – generated 750m buffer area layer from the
health centers in Limasawa
Limasawa_bgyboundary_rp – reprojected layer of barangay boundaries in Limasawa
Clip
1 Under Vector tab, select Geoprocessing Tools → Clip...
Clip
2 In using the Clip tool, set the Input Layer which
contains the features that will be clip/cut.
Choose from the dropdown:
Input layer: Limasawa_healthcenter_
750m_buffer
3 Next, the overlay layer defines the area or
shape to be used as reference for clipping.
Overlay layer: Limasawa_bgyboundary_rp
Clip
4 Under the Clipped parameter, the format of the
output layer will be configured.
Retain the Clipped parameter as default to
create a temporary layer.
5 Click Run.
Clip
6 The Clipped temporary layer will appear in the attribute table. Rename this layer
to Limasawa_bufferinbndry_clip.
Clip
Notice that the temporary Clipped (polygon) layer output
shows the portion of Limasawa_healthcenter_750m_buffer
which is cut based on the boundary or shape of
Limasawa_bgyboundary_rp.
This is an example of how the Clip tool was used for two
polygon features. This will be used in the succeeding
demonstration of clip functionality in QGIS
Clip
9 In the Layers Panel, only retain the following:
Clip
This extracts the features of the input layer that overlaps or inside
the overlay layer, and retains only the attributes of the input layer
once processing is completed.
After generating the Clipped temporary layer, you need to extract a layer containing all
the households within the 750m buffer using the Clip tool.
The following datasets will be used:
Limasawa_hhbldgs – layer containing household buildings in Limasawa
Limasawa_bufferinbndry_clip – generated temporary layer from extracted 750m buffer
with the extent inside Limasawa boundary
Clip
1 Using the same QGIS project, add Limasawa_hhbldgs
to the Layers Panel.
Clip
2 Use the Reproject tool to change the CRS of
the layer to WGS 84 / UTM zone 51N (EPSG:
32651).
Input Layer: Limasawa_hhbldgs
Target CRS: EPSG: 32651 - WGS 84 /
UTM zone 51N
Reprojected:
Task Force Training/3_Outputs/
Outputs 3/ Limasawa_hhbldgs_rp.shp
Clip
3 Limasawa_hhbldgs_rp layer will be added in the Layers Panel. Remove the
Limasawa_hhbldgs from the Layers Panel.
Clip
4 Under Vector tab, use the Clip tool by
selecting the Geoprocessing Tools → Clip...
6 Click Run.
NOTE:
The succeeding outputs of the vector
geoprocessing tools to be discussed shall be
exported as temporary layers since there is a
bug/error in QGIS being encountered when
exporting them as a new layer.
Clip
7 Another temporary Clipped layer is added in the Layers Panel. Rename the
temporary Clipped layer as Limasawa_hhinbuffer_clip.
Clip
In this case, the Clip tool allowed the extraction of
household building points inside the 750-m buffer from
the health centers, within the extent of the barangay
boundaries of Limasawa.
Clip
The Clip tool only cuts the features of the input layer based on the boundary/shape of the
overlay layer without changing the fields of the attribute table of the input layer.
Clip
8 Activate Limasawa_healthcenter_750m_buffer and uncheck the Clipped layer.
1 2 3
MERGE DISSOLVE BUFFER
4 5 6
CLIP INTERSECTION DIFFERENCE
Intersection
This tool captures the overlapping portions of features in the Input and
Overlay layers, and the attributes of both layers are included in the
resulting layer. When compared to the Clip tool, this function generates the
same outputs on the map except for its attribute table.
Using the generated 750-meter buffer areas from the health centers in Limasawa, you
will use the intersection tool to extract the household buildings intersecting the buffer
area layer.
The following datasets will be used:
Limasawa_healthcenter_750m_buffer – generated 750m buffer area layer from the
health centers in Limasawa
Limasawa_hhbldgs_rp – reprojected layer of household buildings in Limasawa
Intersection
1 The same layers, Limasawa_bgyboundary_rp and Limasawa_hhbldgs_rp, will be
used to perform the Intersection tool.
Intersection
Another option is to open the Intersection tool from the
Processing Toolbox by searching Intersection.
The Intersection window will appear on the screen.
Here, the parameters for the intersection function will
be set.
Intersection
3 Set the target layers to be intersected. Indicate
these under the Input layer and Overlay layer
parameters. Choose from the dropdown:
Input layer: Limasawa_hhbldgs_rp
Overlay layer: Limasawa_healthcenter_750m_buffer
Below the parameters, there is an option to use the Selected features only for
the Input Layer and Overlay Layer. When disabled, this means that there are
no selected features from the attribute table.
Intersection
4 Under Input fields to keep and Overlay fields
to keep parameters, specific fields or columns
from both layers can be customized. If all fields
of both layers will be retained, these parameters
must be left empty.
In the Input fields to keep, click the ellipsis and
enable geocode, and click OK.
For Overlay field to keep, enable the
bgy_psgc, fsn, and name columns.
Intersection
5 Under the Intersection parameter, the format of
the output layer will be configured.
6 Click Run.
Intersection
The Intersection layer will be added to the
Layers Panel. Rename the layer as
Limasawa_buffer_hh_intersect.
Intersection
The output of the INTERSECTION tool generates features from two layers that intersect
and extract all/selected columns from both the Input and Overlay layers depending
on the configuration of parameters.
Limasawa_hhbldgs_rp Limasawa_healthcenter_750m_buffer
Intersection
Limasawa_buffer_hh_intersect
1 2 3
MERGE DISSOLVE BUFFER
4 5 6
CLIP INTERSECTION DIFFERENCE
Difference
This tool extracts features from the Input layer that fall outside or
partially overlap, features in the Overlay layer. Note that only
geometries will be extracted based on the overlay layer; however, the
attributes and features in the Input layer will be retained.
Using the generated 750-meter buffer areas from the health centers in Limasawa, you
will use the difference tool to extract the household buildings outside the buffer area.
The following datasets will be used:
Limasawa_healthcenter_750m – generated 750m buffer area layer from the health
centers in Limasawa
Limasawa_hhbldgs_rp – reprojected layer of household buildings in Limasawa
Difference
1 Using the same project, retain the layers Limasawa_healthcenter_750m_buffer and
Limasawa_hhbldgs_rp.
Difference
Another option is to open the Difference tool
from the Processing Toolbox by searching
difference.
The Difference window will appear on the
screen. Here, the parameters for the difference
function will be set.
Difference
3 First, set the Input layer in the Difference
window. The Input Layer is the layer from which
features are to be removed. Choose from the
dropdown:
Input layer: Limasawa_hhbldgs_rp
4 The Overlay layer is the extent or boundary to which the portion
Input Layer will be removed. Choose from the dropdown:
Overlay layer: Limasawa_healthcenter_750m_buffer
Below the parameters, there is an option to use the Selected
features only for the Input Layer and Overlay Layer
Difference
5 Under the Difference parameter, the format
of the output layer will be configured.
Difference: Retain as default
6 Click Run.
Difference
The output shapefiles using the Difference
tool will be added to the Layers Panel.
Clip vs Difference
In using CLIP tool, Whereas, in using the
only the features DIFFERENCE tool,
inside the Overlay only the features
layer will be outside the Overlay
extracted. layer will be extracted.