Difference between revisions of "Digitizing in QGIS"

From CUOSGwiki
Jump to navigationJump to search
Line 9: Line 9:
   
 
==Installing QGIS for Digitizing==
 
==Installing QGIS for Digitizing==
There are several versions of QGIS available for download. For the purposes of this tutorial, we will be using the long-term release version (QGIS 2.18.24 'Las Palmas'). Follow this link ([[https://qgis.org/en/site/forusers/download.html]]| https://qgis.org/en/site/forusers/download.html) to the QGIS site. Insure that you’re on the “Instillation Download” tab. (Figure 1) There are three versions of the QGIS installer available in this tab. The first is a network installer which is not needed for our application. The other two are the latest release (Version 3.2) and the long-term release (Version 2.18). We will be using the long-term release because it provides the most stability and is more widely used due to it receiving major updates less frequently.
+
There are several versions of QGIS available for download. For the purposes of this tutorial, we will be using the long-term release version (QGIS 3.4). Follow this link ([[https://qgis.org/en/site/forusers/download.html]]| https://qgis.org/en/site/forusers/download.html) to the QGIS site. Insure that you’re on the “Instillation Download” tab. (Figure 1) There are three versions of the QGIS installer available in this tab. The first is a network installer which is not needed for our application. The other two are the latest release (Version 3.2) and the long-term release (Version 3.4). We will be using the long-term release because it provides the most stability and is more widely used due to it receiving major updates less frequently.
   
 
[[File:Download Screen.png]]
 
[[File:Download Screen.png]]
   
   
Click on the “QGIS Standalone Installer Version 3.8 (64 bit)” to begin installing the program. (Figure 2)
+
Click on the “QGIS Standalone Installer Version 3.4 (64 bit)” to begin installing the program. (Figure 2)
   
   

Revision as of 14:14, 1 October 2019

Purpose

The purpose of this tutorial is to demonstrate the process of creating a vector model by digitizing an aerial image within QGIS.

Objective

The objective is to retrieve an aerial image of the City of Ottawa and using QGIS software digitize the different land use cover classes and geographical features within the photo.

Software

The software that will be used for this tutorial is QGIS 2.18.15. QGIS is a user friendly open source geographic information system, it runs on Linux, Unix, Mac OSX, Windows and Android and supports numerous vector, raster and database formats and functionalities. The software can be downloaded at [QGIS].

Installing QGIS for Digitizing

There are several versions of QGIS available for download. For the purposes of this tutorial, we will be using the long-term release version (QGIS 3.4). Follow this link ([[1]]| https://qgis.org/en/site/forusers/download.html) to the QGIS site. Insure that you’re on the “Instillation Download” tab. (Figure 1) There are three versions of the QGIS installer available in this tab. The first is a network installer which is not needed for our application. The other two are the latest release (Version 3.2) and the long-term release (Version 3.4). We will be using the long-term release because it provides the most stability and is more widely used due to it receiving major updates less frequently.

Download Screen.png


Click on the “QGIS Standalone Installer Version 3.4 (64 bit)” to begin installing the program. (Figure 2)


VersionQGIS.png


Once the download is complete, simply open the installer and allow it to open. You’ll then be presented with a setup wizard. (Figure 3) Simply click next and agree to the subsequent Licensing Agreement. Then set your file to whichever destination you wish. If you don’t know where you want your QGIS to go, simply leave the default value in place.


QGIS Launcher.png


The final prompt before install will be titled “Choose Components”. For the purposes of this tutorial, all that is required to be checked is the “QGIS” component. All others can remain blank. (Figure 4) Finally, click the “Install”, this should take 10-15 minutes. Once this is complete, simply hit the “Finish” button. Now you can launch the QGIS Desktop and get started.


QGIS Launcher Final.png

What is Digitizing?

Digitizing in the realm of GIS is simply the act of taking a piece of geographic information, such as a map or raster image, and turning it into vector information. This process has existed since the advent of GIS in an analog format. This old manual technique involved a table (digitizing tablet) and a puck, which was a handheld mouse like device that the operator used to created points, polylines and polygons. This technique was mostly used to import existing physical paper maps and aerial images into a machine readable format. Luckily, we’ve come a long way since the juvenile stages of GIS, and there are now several pieces of software we can use to preform digitizing on digital images and maps; including open source options like QGIS.

Why is Digitizing Important?

Digitizing is important because it lets use do inquiries on the geometry of the produced vector data. For example, we can query the area of a polygon or length of a polyline. We can also do statistical operations on these queries, like determining the mean area of all the polygons belonging to one ground type class. It also makes the image more readable by classifying ground features.

Data

The data for this tutorial are extracted from an aerial photo that was retrieved from ([[2]]| https://library.carleton.ca/find/gis/geospatial-data/carleton-campus-aerial-images), Were using the “2017 orthophotos - City of Ottawa (20cm)” theme however any will do. The image is 20cm resolution aerial images of Carleton University from 2017. The steps in this tutorial can be accomplished with any georectified aerial image.


Ortho Image Location.png


Methods

This section outlines the steps that will be taken to digitize the image.

Before Beginning

Make sure to have QGIS downloaded and an aerial image saved to a location that it can be accessed.

Starting New Project

For this tutorial we will want to create a new project where all of the data will be stored.

  • Along the main toolbar locate the "Project" tab-->New

Adding Aerial Image

To add the aerial image that was chosen and saved, it can be added into the QGIS canvas by using the "Add raster layer" button.

  • The "Add raster layer" button is located along the left panel
           Addrasterlayer1.png
  • Locate the drive that you saved your aerial photo in and click "Open"
  • Your aerial photo should now be open on the QGIS canvas, you can use the "Zoom in" toolZoominpic.png and the "Zoom out" toolZoomout.pngto help you identify geographical features or land uses within the aerial image.
        Ottawa1.PNG

Snapping Options

When digitizing there should be no gaps between vector layers, so setting up the snapping options will ensure that all lines and polygons are placed tightly together.

  • Along the main toolbar locate "Setting" and select "Options"
  • The "Options" window will open and you will need to locate the "Digitizing" tab and click it
  • Within the "Digitizing" tab you will see subheadings-locate "Snapping"
  • Within the "Snapping" subheading, you will set change the settings to the following:
    • "Default snap mode" select "to vertex and segment"
    • "Default snapping tolerance" set to "10.0 pixels"
    • Search radius" to "10.0 pixels"

Setting the Projection

Before beginning to digitize the image, you need to make sure the correct projection is set for the image.

  • To set the projection locate your aerial photo on the "Layer Panel"
       Imagelayertab.png
  • Right click on the aerial photo and select "Properties"
    • Within the "General" tab in the properties window, locate the "Coordinate reference system" subheading and click on the "Coordinate tab" Coordinatetab.png
    • A window titled "Coordinate reference system selector" will open and within the filter search bar you can search for the appropriate coordinate system for the image you are using. For an aerial image of Ottawa the coordinate system will be MTM zone 9. Once you have selected your coordinate system click "Ok" and "Apply".

Digitizing - Polylines

Polylines are used to represent linear objects whose area is not as important as their length. Prominent examples of features that are represented by polylines would be roadways whose width is not substantial and waterways.

  • Along the main toolbar locate "Layer" select "Create Layer" and select "New Shapefile Layer"
  • A new box will open, the first choice is whether you want to draw a point, line or polygon
    • Choose "line" as we will draw the roads within the image
  • The next step is to set the projection so that the lines are within the same coordinate system as the aerial image
    • Click the "coordinate tab" Coordinatetab.png and a new bow will open titled "Coordinate Reference System Selector". Within the filter option search for MTM zone 9 and select it and click "Ok"
  • Still within the "New shapefile layer" box, you will need to fill in the fields for the vector line. Under the subheading "New field" fill in the following;
    • Name; Roads
    • Type; Text data
    • Length; leave the default value
    • click "Add to fields list"
    • Within the "Fields list" box there is a default vector layer, you may want to delete this. You can delete it by selecting it and clicking the "Remove field" button
               Shapefilelayer1.png
    • Save your new shapefile, to the location that your project is saved
  • Along the main toolbar locate the "Toggle editing button" Toggleediting.png
  • Select the "Add feature" button Addfeaturetab.png, using this feature draw along a road, when you are finished drawing the road right lick and a new box will open titled "Roads-feature attributes"
    • Within the roads field, label the road with the appropriate name (i.e. "Bronson")
    • To double check to see if the information entered into the feature attributes box, you can go back to the "Roads" layer within the "Layers Panel", right click it and go to "Open Attribute Table". Within the table there should be the road name that you entered.
Roadsattribute.PNG
  • The roads that you drew should now be present on the aerial image, if you wanted to adjust the appearance of that vector layer(making them wider or a different colour, you can do this by;
    • Right click the "Roads" tab within the "Layers panel" select "Properties" and select "Style"
  • To continue to digitize you may want to classify the parcels of land into different land classes. The same process would be repeated:
    • create new layer
    • select polygon
    • set coordinate system
    • give appropriate title to your new vector layer
    • add to field list
    • draw polygon
    • customize vector layer

Digitizing - Polygons

Polygons are used to represent land coverage areas such as forest, fields and manmade structures. Although polylines can be used for roads, if the area of the road is important like on a major highway, then a polygon can be used to represent it. This can be done by creating a buffer around the line. Polygons are the only vector type that can be used to determine area.

  • Again, go to "Layer" select "Create Layer" and select "New Shapefile Layer"
    • In the “New Shapefile Layer” box select “Polygon” under the “Type” header
  • Set the projection to match your image, if you did this to create a polyline already it should retain the correct coordinate
    • Click the "coordinate tab"Coordinatetab.pngand a new bow will open titled "Coordinate Reference System Selector". Within the filter option search for MTM zone 9 and select it and click "Ok"
  • Name your new layer based on what it represents in the “New field” field. In this case, we’re representing Buildings
  • Click “OK”
    • Save your new shapefile, to the location that your project is saved and give it a suitable name


New SHP Layer - Polygon.png


  • In the main toolbar click "Toggle editing button" Toggleediting.png
    • Select the "Add feature" button Create Polygon.png, this works just like the polyline, except the lines form an enclosed polygon
  • For this example, we’ll create a polygon that represents St. Patrick’s building on the Carleton University campus
    • Simply use the mouse pointer and left mouse button to place points
    • QGIS will automatically create a closed polygon with a minimum of two points
    • Trace the outline of St. Patrick’s building
    • Once finished, simply click the right mouse button and name the polygon, in this case the name will be “St. Patrick’s”


Poly Before Creation.png


  • Once finished, simply click the right mouse button and name the polygon, in this case the name will be “StPatricks”
    • Click “OK” and the polygon will be created


Naming Polygon Window.png


Polygon After Completion.png

  • To insure the edits have been made correctly right click on the “Buildings” layer in the “Layers Panel” and click the “Open Attribute Table” option
    • “StPatricks” should appear in the attribute table


Digitizing - Points

Points are good for representing objects whose area is of little concern and all that is required is a single x, y and z coordinate. Unlike polyline and polygons, only one point per feature is used. Examples of objects that are usually represented as points include lamp poles, fire hydrants and bus stops.

  • Again, go to "Layer" select "Create Layer" and select "New Shapefile Layer"
    • In the “New Shapefile Layer” box select “Point” under the “Type” header
  • Set the projection to match your image, if you did this to create a polyline or polygon already it should retain the correct coordinate
    • Click the "coordinate tab"Coordinatetab.png and a new box will open titled "Coordinate Reference System Selector". Within the filter option search for MTM zone 9 and select it and click "Ok"
  • Name your new layer based on what it represents in the “New field” field. In this case, we’re representing Traffic Lights
  • Click “OK”
    • Save your new shapefile, to the location that your project is saved and give it a suitable name


New SHP Layer - Point.png


  • In the main toolbar click "Toggle editing button"Toggleediting.png
    • Select the "Add feature" button Create Point.png and left click a traffic light
    • Only one point can be used to represent each feature, so once you place the point you’ll be prompted to name the feature
    • Call it “Traffic Light 1” and hit “OK”


Naming Point Window.png


  • The new point will appear as a small round point
  • To insure the edits have been made correctly right click on the “TrafficLights” layer in the “Layers Panel” and click the “Open Attribute Table” option
    • “Traffic Light 1” should appear in the attribute table

Calculating Area of Vector Layer

If you wanted to calculate the geometric area of the different land use cover classifications, this can be done by following these steps:

  • Select one of the polygon vector layers and right click on it and select "Open attribute table"
  • You will need to "Toggle editing mode" on, click the toggle button Toggleediting.png
  • Now will need to add a new column within the attribute table where you will do the calculation for geometry for each polygon, you will need to click the "New field" button Newfieldtab.PNG.
  • The "Add field" box will open, fill in the following;
    • Name: "Area"
    • Type: "Whole number (integer)"
    • Length: "10"
    • Once filled in, click "Ok"
  • A new column should now be added in the attribute table titled "Area".
  • To calculate the area, you will need to click the "Field calculator" Fieldcalculator.PNG
  • The "Field calculator" box will open, you will need to select "Update existing field" and select the "Area" column.
  • You now will need to select "Geometry" from "row_number"

Geometry.png

  • A drop down list will open for geometry and you will need to select "$area" and click "Ok"
  • The window will close and within your attribute table you should now have a calculated area for the area column

Final Vector Model

  • When you have digitized all the geographical features and classified the parcels of land into different land use classifications, your final vector model should be similar to:
           Finalvectormodel.png
  • As well, the "Layers Panel" should include all the different land classifications layers that you added onto the map.
         Finallegend.png
  • Within each layer, there should be a corresponding attribute table, right click and select open attribute table.
             Attributetable.png

Conclusion

Following this tutorial, you should have a completed vector model that was created by taking an aerial photo and digitizing the geographical features and land use classes that provides necessary information from that specific region.