Digitizing in QGIS

From CUOSGwiki
Jump to navigationJump to search

Purpose of This Tutorial

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 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 3.4. 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

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 ([| QGIS Download]) to the QGIS site. Insure that you’re on the “Installation 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.8) 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.

Installing2.JPG


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


Installing1.JPG


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.JPG


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 perform digitizing on digital images and maps; including open source options like QGIS.

Why is Digitizing Important and What is its Purpose?

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.

Often times aerial images are taken of landscapes however, boundaries between land-use classes are often quite difficult to see without any visual modifications. Not only does digitizing help visualize spatial data, but it also often allows for much more interpretation. Converting aerial image data into vector shape files opens up possibilities for a wide variety of spatial analysis. Thematic maps in GPS programs often use some sort of digitization as the majority of their data is derived from aerial images and that data would not be sufficient for travel within a city(Google Maps, Wayz etc.)

Data

The data for this tutorial are extracted from an aerial photo that was retrieved from ([[1]]| https://library.carleton.ca/find/gis/geospatial-data/carleton-campus-aerial-images), We're using the “2017 orthophotos - City of Ottawa (20cm)” theme however any other aerial image dataset will do. For the purpose of familiarity, the image we will be using is a 20cm resolution aerial images of Carleton University from 2017. The steps in this tutorial can be accomplished with any georectified aerial image. Generally, you would like to choose an area that you are relatively familiar with as it could help with your interpretation of the land.


Ortho Image Location.png

Choosing Your Own Aerial Image

After opening up the interactive map of Ottawa, please consider your area of interest as this will have huge implications on the success and effectiveness of your digitizing project. Some areas in Ottawa, especially in downtown are quite dense therefore they often require many different classes and this could negatively effect your efforts. However, if you choose an aerial image with a bland variety of land-use, you might not be able to come up with enough classes. When choosing an aerial image, please think about possible classification schemes and aim for around 5-7 different classes as this will generally look the most pleasing. Please refer to the example below regarding an ideal image for digitizing:

IdealAI.jpg

Choosing the Correct Coordinate System For Your Image

After you have imported your aerial image, it is crucial that you check the meta-data of the file and ensure that it is being projected in the proper coordinate system. In our case, we are analyzing a photo of Ottawa therefore we should be using NAD 84 MTM Zone 9. If digitizing multiple images make sure they are all using the same and most appropriate coordinate system.

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. Generally you would like to have a folder associated with this project that could be used as your working directory. Most people tend to work out of their C: drive when doing spatial analysis.

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
           AddRasterData.JPG
  • 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"

SnappingOptions1.JPG

  • 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"

SnappingOptions2.JPG

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"

Setting the Projection1.JPG

    • 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".

Setting the Projection2.JPG

Determining Land-Type or Land-use Classes

Prior to digitizing your aerial image, you must determine the classes that you will be using for the project. The types of classes often rely on two factors: the quality of the image and the amount of detail you would like to visualize. When determining land-use classes for a large agricultural landscape, you might have different levels of detailed classes that would allow the map reader to easily distinguish between areas on the digitized area. A specific range of classes could be very useful for determining different crop types, forest land or wetlands. However, when you are digitizing aerial images within a city, you must generalize to a certain extent. This generalization allows for your map to be visually pleasing while encompassing the most important items. Classes become broader such as residential areas, commercial areas, and parks. In our case, we are digitizing an aerial image of a residential area in Ottawa therefore we will use basic classes.

We will use the following classes in our digitized map as it would make the map aesthetically pleasing and effective:

1) Rails 2) Roads 3) Water 4) Commercial 5) Residential 6) Grass 7) Shopping 8) Parks 9) School


Please refer to the image below if you are having difficulties determining classes for your project:

LanduseOptions.PNG

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"

DigitizingPolylines1.JPG

  • 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

DigitizingPolylines2.JPG

    • 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"

DigitizingPolylines3.JPG

    • 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.

DigitizingPolylines4.JPG

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"

DigitizingPolygon1.JPG

    • 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

DigitizingPolygon2.JPG


  • 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

DigitizingPolygon3.JPG

  • 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
  • When digitizing your aerial image with polygons, often times we find ourselves making small mistakes which often leave us deleting our work and starting again. However, if you have misplaced a few nodes on a polygon, you have the option to rotate the entire vector feature to better fit the intended area. This function can also be applied to poly-lines as well therefore mistakes cause little to no loss in time. Please refer to the screenshot below for context:

QGISRotate.png

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"

DigitizingPoint1.JPG

    • 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


DigitizingPoint2.JPG


  • In the main toolbar click "Toggle editing button"Toggleediting.png
    • Select the "Add feature" button Create Point.png and left click a traffic light

DigitizingPoint3.JPG

    • 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"

CalculatingAreaofVectorLayer1.JPG

  • You will need to "Toggle editing mode" on, click the toggle button Toggleediting.png

CalculatingAreaofVectorLayer2.JPG

  • 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

Querying your data

After you have finished digitizing the image, spatial analysis can be conducted easily to any of the classes that you have just created. By creating new shape files for each class, you will be easily able to query certain land-cover and analyze them individually. In our case, each road, park, residential neighborhood, and water body will have its own shapefile therefore you can effectively work using those vector files.

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. However, the amount of human error is vital to consider before completing any type of analysis. User error will be present as this tutorial relies heavily on the input of the person completing the work therefore this must be known going forward.