Digitizing Map Data (QGIS3)

Digitizing is one of the most common tasks that a GIS Specialist has to do. Often a large amount of GIS time is spent in digitizing raster data to create vector layers that you use in your analysis. QGIS has powerful on-screen digitizing and editing capabilities that we will explore in this tutorial.

Overview of the task

We will use a raster topographic map and create several vector layers representing features around a park.

Other skills you will learn

  • Building pyramids for large raster datasets to speed up zoom and pan operations.

  • Working with a Spatialite database.

Get the data

Land Information New Zealand (LINZ) provides raster topographic maps at 1:50,000 scale for the New Zealand mainland and Chatham Islands.

Download the GeoTIFF Image file from the Christchurch Topo50 map download page.

For convenience, you may directly download a copy of the dataset from the link below:

BX24_GeoTifv1-02-clip.tif

Data Source [LINZ]

Procedure

  1. Go to Layer ‣ Add Raster Layer. Locate the downloaded BX24_GeoTifv1-02.tif and click Open.

../../_images/149.png
  1. This is a large raster file and you may notice that when you zoom or pan around the map, the map takes a little time to render the image. QGIS offers a simple solution to make rasters load much faster by using Image Pyramids. QGIS creates pre-rendered tiles at different resolutions and these are presented to you instead of the full raster. This makes map navigation snappy and responsive. Right-click the BX24_GeoTifv1-02 layer and choose Properties.

../../_images/228.png
  1. Choose the Pyramids tab. Hold the Ctrl key and select all the resolutions offered in the Resolutions panel. Leave other options to defaults and click Build pyramids. Once the process finishes, click OK.

../../_images/320.png
  1. Before we start, we need to set default Digitizing Options. Go to Settings ‣ Options….

../../_images/49.png
  1. Select the Digitizing tab in the Options dialog. Set the Default snap mode to Vertex. This will allow you to snap to the nearest vertex. I also prefer to set the Default snapping tolerance and Search radius for vertex edits in pixels instead of map units. This will ensure that the snapping distance remains constant regardless of zoom level. Depending on your computer screen resolution, you may choose an appropriate value. Click OK.

../../_images/510.png
  1. Now we are ready to start digitizing. We will first create a roads layer and digitize the roads around the park area. Select New GeoPackage Layer… icon from Panels. A GeoPackage is an open, non-proprietary, platform-independent and, standards-based data format for geographic information system implemented as an SQLite database container. This makes it much easier to move it around instead of a bunch of shapefiles. In this tutorial, we are creating a couple of polygon layers and a line layer, so a GeoPackage will be better suited. You can always load a GeoPackage and export layers as a shapefile or any other format you want.

../../_images/610.png
  1. In the New GeoPackage Layer dialog, click the button and save a new GeoPackage database named digitizing.gpkg. Choose the Table name as Roads and select Line as the Type. The base topographic map is in the EPSG:2193 - NZGD 2000 CRS.

../../_images/710.png
  1. When creating a GIS layer, you must decide on the attributes that each feature will have. Since this is a roads layer, we additionally will have 2 basic attributes - Name and Class. In New Field Enter Name of the type Text data, with 50 as Maximum length and click Add to attribute list. Now create a new attribute Class of the type Text data, with 50 as Maximum length. Click OK

../../_images/810.png
  1. Once the Roads layer is loaded, click the Toggle Editing button to put the layer in editing mode.

../../_images/910.png
  1. Click the Add Line Feature button. Click on the map canvas to add a new vertex. Add new vertices along with the road feature. Once you have digitized a road segment, right-click to end the feature.

備註

You can use the scroll wheel of the mouse to zoom in or out while digitizing. You can also hold the scroll button and move the mouse to pan around.

../../_images/1011.png
  1. After you right-click to end the feature, you will get a pop-up dialog called Road - Feature Attributes. Here you can enter attributes of the newly created feature. Since the fid is an Autogenerate field, you will not be able to enter a value manually. Leave it as such and enter the road name as it appears on the topo map. Optionally, assign a Road Class value as well. Click OK.

../../_images/1114.png
  1. The default style of the new line layer is a thin line. Let’s change it so we can better see the digitized features on the canvas. Right-click the Roads layer and select Properties.

../../_images/1212.png
  1. Select the Symbology tab in the Layer Properties dialog. Choose a thicker line style such as topo road from the predefined styles. Click OK.

../../_images/1311.png
  1. Now you will see the digitized road feature clearly. Click Save Layer Edits to commit the new feature to disk.

../../_images/1410.png
  1. Before we digitize the remaining roads, it is important to update some other snap settings that are important to create an error free layer. Right-click on any empty space on the toolbar area and activate the Snapping toolbar

../../_images/159.png
  1. Now an Enable Snapping (Magnet Icon) will appear on the panel. Click on it to enable it and select All Layers and select Open Snapping Options...

../../_images/168.png
  1. In the Snapping options dialog, click the Snapping on intersection which allows you to snap on an intersection of a background layer.

../../_images/179.png
  1. Now you can click Add feature button and digitize other roads around the park. Make sure to click Save Edits after you add a new feature to save your work. A useful tool to help you with digitizing is the Vertex Tool. Click the Vertex Tool button and select Vertex Tool (Current Layer).

../../_images/187.png
  1. Once the node tool is activated, click on any feature to show the vertices. Click on any vertex to select it. The vertex will change the color once it is selected. Now you can click and drag your mouse to move the vertex. This is useful when you want to make adjustments after the feature is created. You can also delete a selected vertex by clicking the Delete key. (Option+Delete on a mac)

../../_images/197.png
  1. Once you have finished digitizing all the roads, click the Toggle Editing button. Click Save.

../../_images/206.png
  1. In the New GeoPackage Layer dialog, click the button and select GeoPackage database named digitizing.gpkg. Name the new layer as an attribute called Parks. and select MultiPolygon as the Type. The base topographic map is in the EPSG:2193 - NZGD 2000 CRS. Click OK. In New Field Enter Name of the type Text data, with 50 as Maximum length and click :guilabel:` Add to attribute list.`

備註

Polygon - Planar Surface defined by 1 exterior boundary and 0 or more interior boundaries. Each interior boundary defines a hole in the Polygon. Multi-Polygon - It is used to represent areas with holes inside or consisting of multiple disjoint areas. For eg, 3 discontinuous polygons can be drawn and grouped as a single feature.

../../_images/2111.png
  1. Now select layer Parks then Toggle Editing and click the Add feature button and click on the map canvas to add a polygon vertex. Digitize the polygon representing the park. Make sure you snap to the road’s vertices so there are no gaps between the park polygons and road lines. Right-click to finish the polygon.

../../_images/229.png
  1. Enter the park name in the Parks - Feature Attributes pop-up.

../../_images/235.png
  1. Multi-Polygon layers offer another very useful setting called Avoid intersections of new polygons. Select Enable Snapping (Magnet Icon), click on it to enable it and click :guilabel:` All Layers` and select Advanced Configuration. Choose Avoid Overlap on Active layers from the forth button in Enable snapping toolbar. Now in Edit Advanced Configuration Check the box in the Avoid Overlap column in the row for the Parks layer.

../../_images/246.png
  1. Click on Add feature to add a polygon. With the Avoid Overlap, you will be able to quickly digitize a new polygon without worrying about snapping exactly to the neighboring polygons.

../../_images/255.png
  1. Right-click to finish the polygon and enter the attributes. Magically the new polygon is shrunk and snapped exactly to the boundary of the neighboring polygons! This is very useful when digitizing complex boundaries where you need not be very precise and still have topologically correct polygon. Click Toggle Editing to finish editing the Parks layer.

../../_images/265.png
  1. Now it is time to digitize a building’s layer. Create a new polygon layer named Buildings by clicking on New GeoPackage Layer… icon from Panels.

../../_images/275.png
  1. Once the Buildings layer is added, turn off the Parks and Roads layer so the base topo map is visible. Select the Buildings layer and click Toggle Editing.

../../_images/265.png
  1. Digitizing buildings can be a cumbersome task. Also, it is difficult to add vertices manually so that the edges are perpendicular and form a rectangle. We will use a QGIS toolbar called Shapes Digitizing to help with this task. Right-click on any empty space on the toolbar area and activate

    the Shapes Digitizing Toolbar.

../../_images/294.png
  1. Zoom to an area with the buildings and click Rectangle by Extent button. Click and drag the mouse to draw a perfect rectangle. Similarly, add remaining buildings.

../../_images/304.png
  1. You will notice that some buildings are not vertical. We will need to draw a rectangle at an angle to match the building footprint. Click the Rectangle from center.

../../_images/3110.png
  1. Click at the center of the building and drag the mouse to draw a vertical rectangle.

../../_images/324.png
  1. We need to rotate this rectangle to match the image on the topo map. The rotate tool is available in the Advanced Digitizing toolbar. Right-click on an empty area on the toolbar section and enable the Advanced Digitizing toolbar.

../../_images/331.png
  1. Click the Rotate Feature(s) button.

../../_images/341.png
  1. Use the Select Single feature tool to select the polygon that you want to rotate. Once the Rotate Feature(s) tool is activated, you will see crosshairs at the center of the polygon. Click exactly on that crosshairs and drag the mouse while holding the left-click button. A preview of the rotated feature will appear. Let go of the mouse button when the polygon aligns with the building footprint.

../../_images/351.png
  1. Save the layer edits and click Toggle Editing once you finish digitizing all buildings. You can drag the layers to change their order of appearance.

../../_images/361.png
  1. The digitizing task is now complete. You can play with the styling and labeling options in layer properties to create a nice looking map from the data you created.

../../_images/371.png
comments powered by Disqus