Coastal Flooding Assessment of Prince Edward Island using a 3D Model in QGIS

From CUOSGwiki
Jump to navigationJump to search


With global warming becoming a concerning issue in the past three decades, this brings up the question of the effects it has on geological, atmospheric and ocean processes. Human activities such as burning fossil fuels, cutting down forests and farming livestock influence the climate and Earth's temperature. The result of global warming is an increased risk of natural disasters. The focus of the analysis is coastal flooding and the area of interest(AOI) is Charlottetown, PEI(Prince Edward Island). Coastal flooding is a sudden and abrupt flow of the coastal environment caused by a short-term increase in water level due to storm surge and extreme tides. It takes place when seawater flows over low-lying land that is normally dry and exists near the coast. Prince Edward Island is an area of interest because it is an island surrounded by the Gulf of St.Lawrence and Northumberland Strait. It has an extensive coastline, which makes it susceptible to coastal flooding, and some areas of PEI are low in elevation, making them vulnerable to the effects of sea level rise and storm surges.

The objective of the tutorial is to illustrate the effectiveness of a 3D map for coastal flood risk assessment along with important information that can be extracted from it.

Software Requirements

In order to begin the tutorial, download the QGIS software package from the following link ( ). This tutorial was created using QGIS version 3.34.1. The latest version of QGIS is freely available for Windows, MacOS X, Linux and Android.


The raster data used for this analysis was obtained from High Resolution Digital Elevation Model (HRDEM) - CanElevation Series, produced by Natural Resources Canada for the city of Charlottetown. The dataset is hosted on the Open Data Canada website here: ( and the majority of the vector data was retrieved from the Government of Prince Edward Island Open Data portal website here: (

Download instructions are provided in the section below.


Charlottetown Digital Terrain Model Data

High Resolution Digital Elevation Model (HRDEM) - CanElevation Series

1. Click on the following link. This will take you to the directory where all of the DTM data is stored for the UTM 20 Zone.
2. Use the find function (Ctrl + F) to find each of the four images listed below which spans the area of interest.
3. Create a new folder on your computer named "Raw Data", in the "Raw Data" folder create two sub-folders named "Vector Data" and "Raster Data" which will be used to store the vector and raster data respectively.

Charlottetown Vector Data
1. Click on the following links and download the data as .shp files (a .zip file will be downloaded)
Roads: This is a line layer of the road network in Prince Edward Island.
Coastline Boundary: This is a polygon layer that spans the coastline surrounding Prince Edward Island.
Civic Communities: This is a polygon layer of communities in Prince Edward Island.
2. Extract the .zip files downloaded to the subfolder named "Vector Data".
3. As for the buildings data. It was obtained from here: ( in the form of GeoJSON, due to the fact it has a height attribute for each building which is important for 3D analysis.
4. Convert the GeoJSON to shapefile using this website: ( Ensure the co-ordinate system is the same as the image below, then click the "Convert Now" button and download the shapefile.

Buildings steps 1.png

QGIS Methods and Instructions

Importing and Merging

Step 1.

  • Open QGIS and create a new project.
  • Before any further geospatial analysis, the co-ordinate system of the project was set to NAD 1983 CSRS Prince Edward Island. Although the co-ordinate system of other layers should be different else they will not be displayed on the map.
  • Locate the folder where the vector and raster data were saved by making use of the browser. Highlight all 4 raster data and add them to the project. Once this is done, add the required vector data such as buildings, road network, civic community zones and 2000 coastline boundary.
  • When adding the the building and road network shapefile, a pop window might appear, select the first option and click Ok.
  • If the steps above were followed correctly, the co-ordinate system of the layers should be the same as the images below. This means the environment has been successfully set up for analysis. Raster and vector data should also be similar to the images below.

Co-ordinate system.png Roadnetworkcoordinate.png Buildingcoordinate.png Raster 1.png Vector 1.png

Merging Rasters

Step 2.

  • Use the merge tool (Raster -> Miscellaneous -> Merge) to combine the .tif files into one working raster image.
  • In the merge tool window, select the four .tif files through the Input Layers selection, directly under the Parameters tab.
  • Under the Merged heading select the Save to File… option, give the output a name and save it in your working folder.
  • Once the layers have been selected, click Run in order to merge the files.

Merge 1.png Merged opened 1.png

  • The merged file should look similar to the final image below:

Merge result 1.png

Select Feature, Clipping and Creating AOI

Select Feature

Step 3.

  • First operation to be done before clipping is extracting the city of Charlottetown from the Community Polygon layer. This is done by making use of Select Features option in the toolbar.
  • The selected feature is exported by right-clicking on the layer then selecting Export -> Save selected features as. A window will pop up that request for a filename, in order to properly save the selected feature as a shapefile.
  • Choose a name for the shapefile then select Ok.
  • The result of the selection should be the same as the bottom right image.

Select features 1.png Selected features 2.png Selected features 3.png Selected features 4.png


Step 4.

  • The Community Polygon shapefile takes into account docks that are situated around the coast of Charlottetown. In order to get rid of this part of the shapefile, it has to be clipped using the Coastline Boundary shapefile.
  • There are different ways to access the Clip tool in QGIS. For this analysis it was done simply by making use of the search bar under the Processing Toolbox located at the right side of the work environment in QGIS.
  • Type Clip in the search bar and select the first option under Vector Overlay as shown in the image below.
  • Once the tool is opened, set the Input layer to the shapefile that was extracted using the Select features in Step 3 and Overlay Layer set to the Coastline Boundary shapefile.
  • Ensure to save the result of the clip by selecting Save to File then click Run.
  • An error might be encountered after running the clip. To solve this issue, select Do not Filter (Better Performance) in the Advanced Options (Wrench icon) for both layers as shown in the image below, then click Run again.
  • The road network is clipped to cover only the city of Charlottetown. Set the parameter of the Clip tool as follows; Input layer as Road Network shapefile and Overlay layer as the output shapefile of the clip executed earlier, then click Run.

Clip 11.png Clip 22.png Clip 33.png Clip 44.png Clip 55.png Clip 7.png

Creating AOI

Step 5.

  • Create a polygon that can be used to clip the raster layer and also further concentrate the study area to the coast of Charlottetown.
  • Using the toolbar, select Layers -> Create Layer -> New Shapefile Layer.
  • A window will pop up, which requires a filename for the new file, AOI (Area of Interest) would suffice for the purpose of this tutorial.
  • Select Polygon as the Geometry Type and ensure the co-ordinate system is NAD 1983 CSRS Prince Edward Island (EPSG: 2954) then Click Ok. A new layer named AOI will appear in the Layers section at the bottom left of the work environment.
  • Right click on the AOI layer and select Toggle Editing. Once this is selected, navigate to the top panel and find the Add Polygon Feature button.
  • Draw a border that roughly spans infrastructure (buildings and road network) close to the coast of Charlottetown when complete, right click on the outline and a new window will pop up that request for ID, type 1 then click Ok.
  • If all steps are followed properly, the result should be similar to the sixth image at the bottom right. Do not forget to click Save layer edits and un-toggle the editing.

Aoi final 1.pngCreate aio 22.pngCreate aoi 33.png Create aoi 44.pngCreate aoi 55.pngCreate aoi 66.png

Final Clipping

Step 6.

  • A second round of clipping is done on the road network and buildings shapefile, since the analysis is not based on the overall area of Charlottetown. We will make use of similar steps in Step 4, the only difference is the Input layer and Overlay layer selection.
  • For the road network, set the Input layer to the Buildings shapefile and Overlay layer to the AOI shapefile created in Step 5, select Save to File and give the shapefile a name then click Run.
  • For the buildings, set the Input layer to the Clipped Road Network from Step 4 and and Overlay layer to the same AOI shapefile, select Save to file and give the output shapefile a name then click Run.
  • The final output should look like the third image as shown below.

Final clip 1.pngFinal clip 2.pngFinal clip output.png

Step 7.

  • The merged raster created in Step 2 will be clipped using the AOI shapefile. This will be executed with the help of Clip by Mask Layer tool.
  • In the search toolbar of the Processing Toolbox, type Clip and select the Clip by Mask Layer under Raster Extraction.
  • Once the tool is opened, set the Input Layer to the merged raster and Mask Layer to the AOI shapefile, finally select Save to file and give the output raster a name then click Run.
  • The final output should look like the raster image as shown below.

Clip raster 1.png Clip raster 2.png Clip raster 3.png

Raster Calculator

Step 8.

  • Raster calculator is commonly used to extract all elevation pixels below or above a certain threshold. For the purpose of this tutorial, the threshold for the flood level simulated will be 2m.
  • Using the toolbar, select Raster -> Raster Calculator.
  • Select the merged raster that was clipped in Step 7.
  • Input the following expression in the Raster Calculation Box: "merged_raster_clipped@1" <= 2, create a name for the output file and ensure it is in .tif format.
  • Click Ok and run the expression.
  • The raster image below meets the threshold that was set using the raster calculator.

Raster calc.png Raster calc-2.png Raster calc output.png

Changing NoData Value

Step 9.

  • Changing NoData values allows you to set a specific value in the raster dataset to be transparent. This is useful for visualization purposes, as it makes it easier to distinguish between valid data and exclude certain areas from analysis.
  • Using the toolbar, select Raster -> Conversion -> Translate.
  • Set the parameters as follows: Input Layer should be set to the raster obtained from Step 8, NoData Value should be set to 0.
  • Finally select Save to file and give the output raster a name then click Run.

No data value 1.png No data value 2.png


Step 10.

  • Using the toolbar, select Raster -> Conversion -> Polygonize (Raster to Vector).
  • The only parameter to set for this tool is the Input Layer. It should be set to the raster obtained from Step 9.
  • Select Save to file and give the output shapefile a name then click Run.
  • At this stage of the analysis, ensure the only visible layers are road network, buildings and shapefile which are obtained using the polygonize tool.
  • If step 1-10 was executed correctly, your map should be similar to the second image below.

Polygonize 1.png Polygonize 2.png


Step 11.

  • An important aspect of the 3D analysis are the buildings. For this reason, the symbology should be configured properly to have a good representation of height difference across the buildings in the area of interest.
  • Right click on the Buildings shapefile, select Properties then click Symbology on the window that pops up.
  • Change the type of the symbology to Categorized and the Value parameter to the height attribute of the buildings.
  • Edit the values represented by the symbology to be similar to the second image below, then click Apply to save the changes.
  • Click Ok to close the window.
  • After the changes are made, the buildings should be grouped with the colors selected based on their height (m). Refer to the map below for an example.

Symbology 1.png Symbology 2.png

Symbology 3.png


Step 12.

  • Finally, here is the fun part of the analysis.
  • Using the menu toolbar, select Plugins -> Manage and Install Plugins. A new window will pop up.
  • Click the All section and type: Qgis2threeJS then select Install plugin.
  • Note: The Install plugin option is replaced with Reinstall plugin if its was previously installed.
  • If the plugin was successfully installed, it should appear in the vector toolbar with this icon:

Qgis icon.png

  • Click the icon and a new window should pop up.
  • In the Layers section of the tool, check the Flat plane and Buildings shapefile obtained from Step 6, it should automatically import the 2D map and shapefile into the 3D work environment. Both layers should be available in the Animation section as shown in the image below:


  • Right click on the Buildings shapefile and select Properties as shown below:


  • Once the window pops up, set the Type to Extruded and Height to the height attribute of the Buildings shapefile, then click Apply followed by Ok to close the window. Illustrated in the image below:


  • Optionally, you can increase the extent of extrusion for the buildings by selecting Scene -> Scene Settings. Increase the Z exaggeration to 2.0, then click Apply followed by Ok to close the window :

Qgis60.png Qgis70.png

  • To finalize the 3D map, a legend and north arrow needs to be added.
  • In order to add a north arrow, select View -> Widgets -> North Arrow in the toolbar. Make sure Enable North Arrow is checked, then click Apply followed by Ok to close the window:

Northarrow1.png Northarrow2.png

  • Create a legend for the 2D map. Go back to the 3D environment, click View-> Widgets->Header/Footer labels. A window should pop up that gives the option to create a header or footer. In the header section, type: <img src="qgis_legend.png" alt="Legend">.Lastly, click Apply followed by Ok to close the window. If done correctly, a box with a question mark should appear at the top left of the screen as shown in the image on the right:

Legend1.png Legend3.png

  • Final product:
Final product 1.png
  • The tutorial ends here


To sum it all up, based on the map above it can be concluded that buildings that are colored in purple are high risk and susceptible to flooding, especially those situated near the coast. Buildings that are colored in red and brown are medium risk depending on their proximity to the coast. Lastly, buildings that are colored in blue are low risk due to them having the highest elevation. Although, there are outliers that exist. Some buildings colored in blue have a low elevation. The tall buildings could serve as an evacuation muster point, in the case of severe flooding. This is one of the benefits of making use of a 3D map, especially from the perspective of a city planner.


“Step-By-Step: Use of Digital Elevation Data for Storm Surge Coastal Flood Modelling | UN-SPIDER Knowledge Portal.”,

“Management of Coastal Flooding.”,