Tutorial

Creating and Editing Geospatial Data in QGIS

Summary

This tutorial provides an introduction to creating geospatial data in QGIS from scratch, including how to draw (i.e. digitize) features, edit the geometry of new and existing geospatial features and create/calculate new feature attribute data.

What You’ll Learn in this Tutorial

  • Map features including houses and roads in a new subdivision in London, Ontario
  • Tools and concepts learned:
  • Create brand new geospatial data files, and modify the geometry of features using editing tools
  • Calculate attribute data using the Attribute Table and Field Calculator
  • In this tutorial, you will learn how to create point, line, and polygon shapefiles and digitize features using the Editing Panel. Additionally, you will learn how to edit existing geometries.

Prerequisites

  • Install the latest QGIS LTR here.
  • Download and unzip the tutorial data here.

1. Create a New QGIS Project

  1. Open QGIS 3.x or create a new project if it is already opened.
  2. On the Browser panel, expand XYZ Tiles and add OpenStreetMap to the map canvas. Note that the project CRS (visible in the bottom right corner) is automatically set to EPSG:3857 (Pseudo-Mercator).
  3. Expand the tutorial folder and add the shapefile new_subdivision.shp to the map.
  4. Right-click on the new subdivision layer in the Layers panel and select Zoom to Layer(s). Once you zoom into the area, turn off the layer by unchecking it in the layer panel.

2. Create a New Shapefile

In the Browser panel, create a new shapefile in the tutorial folder by right clicking on the folder and select New then Shapefile.

  1. Name the new file tutorial_point.shp
  2. Set the geometry type to point.
  3. Set the CRS to EPSG:26917.
  4. Press OK.

3. Edit the New Point Layer

  1. Edit the point layer by selecting it in the layer panel and then pressing the Toggle Editing on the toolbar area. Alternatively, you can also right-click and click toggle editing. When the toggle editing button is pressed, the Add Point Feature tool and the Vertex tool on the digitizing toolbar at the top will become available.
  2. Click the Add Point Feature tool, then click on one of the houses on the OSM basemap.
  3. A popup will appear. Enter 1 for the id value and press ok.
  4. Commit the changes to the Shapefile by pressing the save button on the editing panel.
  5. Turn OFF the editing session by clicking on the Toggle Editing button. You have now created your first feature!
  6. To create point features representing all houses in the new subdivision, repeat steps a through d for each house footprint on the base map. Enter a new id value for each iteration (e.g. 2, 3, 4…).

4. Edit the Line Layer

Toggle editing on the line layer to digitize the roads in the new subdivision. Do the following:

  1. Toggle editing on the line layer.
  2. Click the Add Line Feature button and then click on the map at the starting position, such as a road intersection.
  3. Follow the road and click as you go – more vertices are often needed to capture curved features like roads. When you get to the end of a road, right click and the attribute form will appear. Enter 1 for the id value and click OK.
  4. Save the edits and toggle off the editing session.

5. Edit the Polygon Layer

Toggle editing on the polygon layer to digitize the wooded areas in the new subdivision. Do the following:

  1. Toggle editing on the polygon layer
  2. Click the Add Polygon Feature button and then click on the map at the starting position.
  3. Follow the perimeter of the wooded area and left click at each corner.
  4. One you add the last corner, right click to show the attribute form. Enter 1 for the id value and press OK.
  5. Save the edits and toggle off the editing session.

6. Use the Snapping Tool with the Line Layer

Go to View > Toolbars or right click in the grey space next to any button on the toolbars at the top to add the Snapping Toolbar to the main toolbar. This will be used to add additional lines and make sure that the start/end of lines all connect.

  1. Click the Enable Snapping button (looks like a red magnet).
  2. On the same toolbar, set the first option to “Active Layer” – this means that when creating a new feature, it will only snap to that layer. If you want to snap to other layers, select All Layers or go into the advanced configuration.
  3. Toggle editing on the line layer and click Add Line Feature.
  4. Hover your mouse over the end of the lad line that was created and note what happens. Left click to start a new line and the end of the previous line.
  5. Digitize the road and right click the end of the line segment.
  6. Save the edits and toggle editing off.

7. Modify the Geometry of Existing Polygons

  1. Toggle off snapping on the Snapping Toolbar
  2. Toggle Editing on the polygon layer.
  3. On the editing toolbar, select the Vertex Tool.
  4. Hover your mouse oven an existing vertex of the polygon.
  5. Left click to select it.
  6. Move your mouse to select the new position and left click.
  7. Save the edits on the Editing Toolbar and toggle editing off.
  8. Continue digitizing roads and any other polygons in the new subdivision.

8. Calculate the Area of Each Polygon

To calculate the area of each polygon, open the attribute table and toggle editing – note that you can also edit the attribute data in the Attribute Table.

  1. Click on the Open Field Calculator.
  2. For Output field name, enter “area_sqm”.
  3. Change the field type to Decimal.
  4. Set field length to 10 and the precision to 2.
  5. In the expression window, enter $area
  6. Press OK.
  7. Save the edits and toggle editing off.

How can we help?

Contact us today to schedule a free consultation with a member of our team.

    captcha