Chapter 2 On screen digitising

On screen digitising produces new vector layers. There are three basic geometries that can be captured.

  1. Points
  2. Lines
  3. Polygons

The geometries are associated with sets of attributes that are held as a table. So, if a point represents some observation on the ground, say the position of a soil core that is analysed in the laboratory the attributes may be the amount of organic matter, pH, sediment type etc. Lines and polygons also have attributes.

Vector layers can also consist of multiple geometries with a single attribute table. To understand this think in terms of a country, such as the United Kingdom, that consists of multiple islands. In order to hold country level data that correspond to every polygon we use a table with multiple geometries. Roads with many sections consist of multiple lines. Collections or observations of a species may consist of multiple points. We will look at how to work with this concept later in this practical. We can add attributes to the geometries either while digitising on screen or later. If a table of data has a unique identifyier that corresponds to the captured geometries (say a code for the soil sample) the attributes can be merged into the map after the lab work has been completed.

2.1 Digitising tool bar

The basic tool bar for digtising should already show up on the default layout of QGIS. If you right click on a blank space on the top bar you can add or subtract tool bars easily. You may want to add the advanced digitising tool (useful if you need to cut holes in polygons). You should certainly add the snapping toolbar when working with polygons as this is usually essential.

To start digitising you need to add a new blank layer to the map. Go to layer on the top menu, create layer then create new shapefile layer.

Shapefiles are generic but do remember that a shapefile consists of multiple files. Make sure all the work is saved in the same folder as the project. If you do this you can easily move the work onto another PC or laptop.

The default geometry type is point, so make sure that you change this to polygon before saving the new layer. To begin with we’ll just digitise a throw away practice layer in order to get used to all the concepts involved. For the actual phase one mapping assignment you will start again and use these skills to more carefully delimitate the boundaries of the habitat types using both points collected on the ground and visual cues from base map imagery.

Change the geometry type to polygon and type in a file name to save as. Check carefully again at this moment that the file is being saved in the same directory as your project. The vector layer will be made up of the geometry, that you will draw on screen, and a table of attributes that you can add after drawing each polygon. Many other attributes can be added through deriving them within the GIS. For example, the area of the polygon, its perimeter and a range of other elements can be derived directly from the geometry. Other elements, such as average slope, elevation above sea level etc can be derived by combining the polygon with terrain analysis. We will see how this can be achieved later. So, when you are digitising you only need to think about adding attributes that you have observed yourself. In the case of a phase one mapping exercise these attributes may be the code for the vegetation type and some observations regarding the condition of the area. These are held in the form of text. So you might add two attributes in this trial run. The first would be called something such pas vegcode, or phase1code. The second may be condition. Don’t worry too much about the details for this trial run. You can be more careful and more specific for the assignment task.

2.2 Drawing a polygon

Once you have set up your shapefile with a couple of attributes and saved it you can start digitising.

Choose an area of Hengistbury with some paths (we’ll see why later) and draw a polygon. You can use a satelite image as a guide, but for the moment don’t worry too much about actually drawing around real features (wait until you have the assignment data for that). Select the new layer in the layers panel. Click on the pencil tool at the top to start editing. You should see the draw polygon icon become active. If you do not, it is probably because you have used the default point option when creating the shapefile. If this happens go back and start the process again.

2.2.1 Valid and invalid geometries

You have to be careful when digitising to avoid invalid geometries. The commonest mistake is to form a knot. This occurs when you draw back over a line forming a kite tail type polygon. If you think about it, this is invalid as a single polygon as it actually consists of two polygons that just touch at a single vertex.

Another problem may arise if you click on exactly the same point twice. So be careful. If you do produce an invalid geometry QGIS will warn you. Just right click, cancel and start on the polygon again.

2.3 Saving the polygon

Once you have drawn the first polygon right click to end. If you can’t see the polygon it may be because your layer is hidden under other active layers. Move the layer up to the top of the layers panel. QGIS will have filled the polygon with some default colour. I usually change the style when digitising to a see through hashed style of some kind. You can do this by right clicking the layer, finding properties and adjusting the symbology (don’t click on styles at this point, we will see how useful styles are later).

You can enter some attribute data when saving the polygon. This can always be editted later if you want.

The polygon is now visible and will be shaded in with some default (usually ugly!) colour. If it is not visible, move the layer to the top in the layers panel.

Right clicking the layer allows you to open the properties menu.

You can now try altering the shading. We will see later how different attributes can be given different types of shading in order to form a chloropleth map.

2.4 Snapping

Snapping is an extremely important concept to understand when producing vegetation maps. If you start drawing another polygon without touching activating snapping you will find that you can draw it anywhere on the screen exactly in the same way as the first. This is good for some purposes.

However it means that you can draw over the first polygon easily. This could lead to some areas being given two different sets of attributes, which is clearly a problem. You can also leave gaps between the polygons, which may be OK, but may be undesirable if the aim is to make sure that the entire area is classified. Snapping is designed to solve this. However it can be a bit fiddly to use, so it needs some practice. Find the magnet tool at the top of the screen and turn snapping on. Notice that there are several options alongside the magnet including snalling distance and whether to snap to vertices, segments or both.

You can change the snapping distance and also decide whether to snap to vertices, segments or both using the snapping tool. Snapping to vertices can often be the safest method, but it can depend on the shape of the poygon. If you set the snapping distance too large you will find points being annoyingly drawn back to the previous polygon, when that is not what you want. So you should try switching snapping on and off and adjusting the other elements until you are comfortable that you understand the concept. Don’t worry at this stage about drawing around actual features as that may be distracting.

With snapping on, if you click near the first polygon the vertex will be drawn to meet it.

You can then draw along the line and meet the polygon again

Experiment until you gate the hang of snapping.

Make a map with several polygons with no gaps between them.

2.5 Avoiding intersections

One trick that can save a lot of time and effort is to turn on the avoid intersections feature. This is available in the advanced settings of the snapping toolbox.

Avoiding intersections with layers that are distinct from the one that you are actually creating is a truly advanced feature, as it can be very awkward to use correctly. However avoiding intesections with your own layer is quite a simple trick. Find the tool.

Choose to avoid intesections on the current layer.

If you have now set this up you can safely draw right over the layer you have already created. The areas that intersect with the previous polygons will be removed leaving you with a perfcet join. This is often much easier than using snapping and is particularly useful if you wish to draw polygons with holes in them, for example habitat around a lake. in this case draw the lake first then draw a larger polygon on top of it after setting up the avoid intersection feature. The new polygon will form a ring around the lake.

2.6 Splitting on paths

Nature reserves often have paths and other features running through them. You could digitise these yourself as lines. In our case some lines have been provided from the open street map layer.

This operation will introduce a few useful geoprocessing operations. The first is buffering. We will make a new temporary layer around the paths with a width that corresponds to the area that we wish to extract from our prototype vegetation classification.

Find buffering from the vector geoprocessing menu at the top of the window. Choose the lines layer that you saved from the Open Street map lines earlier (If you haven-t done this, look for it in the WFS connection and save a copy locally).

Set the distance around the paths that you wish to buffer to and run the buffer, saving the results to a temporary file.

You can see the temporary results. You could save these into your project if you think you may use the buffer again. Temprorary files vanish when the program is closed, which is actually a good thing (feature, not a bug), as it prevents too many intermediate steps piling up in your project. However think about whether you have a use for the results later or not. For example, if you wanted to measure the proportion of the area that was within 2 m of a path then this layer might prove useful.

Now find the difference option, again from the geoprocessing menu. Finding the differences between two geometries or the interesections between them is a very common GIS operation. As these operations form a new layer the original attributes that are copied from the original layers may not always apply to the results. For example, if you had calculated the area of the polygons before differencing it will now be less. The old attributes will be copied over to start with, but you may change these later. Again, save the results as a temporary layer.

Look at the results You may want to move the layer order and switch the visibility of layers.

If you look at the attribute table you will see that you still have the same number of rows as you had in the original layer. However if you look at the map you can see that there are now more polygons than before. This is an example of a multipolygon geometry. The original habitat polygons have been split up by the action into several pieces, but they are held together. If you wish to turn this layer into a table with one polygon per row then you need to run the multipart to single part operation on the layer.

Find the option to split the geopmetry.

Now investigate the results.

2.7 Summary

In this class you have looked at the basics of on screen digitising. Accurate digitising is something of an art form and takes time to master. There are some more advanced features, such as snapping to different layers, cutting and filling holes and drawing curves that we have not looked at. There are many online tutorials available that show some of these methods. You will not need particularly advanced techniques to produce the phase one map for the assignment. As there are many different options available in GIS the best way to learn is through practical experience and solving problems as they arise. Save the work as you go on, and always remember that saving a project does not save changes to individual files. Get into the habitat if backing up any major changes to your work as you progress. Save files with a new name if you are worried that changes might not turn out as you expect, so you can easily roll back to the file you started with. Think about how geoprocessing operations such as buffering, differencing and finding intersections can speed up the work and produce new layers that may be useful.