Map2Raster

A friend had a back log of hand made habitat maps that needed digitising into vector and raster maps for further analysis. They asked me how this might be done. After a bit of searching and playing around on QGIS I came up with a protocol and decided to put together a tutorial.

The tutorial involves some fictitious data I made for Goon Hilly in Cornwall. After making a .shp file of the area of interest, I gridded it off, printed it out and coloured in the grid with three colours to make a habitat map. I then made a second habitat map with a fourth colour to represent the urban infrastructure. The maps were then scanned in and can be downloaded (below) in the tutorial.

 

Aim

Aim: Digitise a hand drawn habitat map

Requirements:
- QGIS
- Downloaded files (click here); Goon Hilly shape files, Habitat_map1.PDF, Habitat_map2.PDF

We will:
1. import the files
2. Georeference the PDF of the scanned habitat maps
3. Create a grid
4. Vectorise the habitat types
5. Create a raster

Step 1: Import

a. Drag and drop .shp file into QGIS

b. Check the global CRS is EPSG: 27700 (British National Grid). If not change it.

c. Set the transparency
i. right click the layer, select properties then symbology
ii. Click 'colour'
iii. Change the opacity to something between 0-40%

Step 2: Georeference

a. Click Raster > Georeferencer
(if this is not an option head to Plugins > manage and install plugins, search for Georeferencer, select/install it and the option should now be visible)

b. Open the scanned image 'Habitat_map1.PDF'; File > open raster

c. Click the 'add point' tool and select a point on the image to reference. Try to select an obvious part of the polygon boundary such as an edge with a strong angle.

d. After selecting a point to reference a window will pop up. Select the ‘From map canvas’ button and then click on the corresponding edge of the .shp file and then click 'OK'.

e. Repeat this at least 4 times. The more points referenced the more accuratley the scanned image will be matched to the .shp file polygon.

f. Once you have finished selecting points click the 'settings' button and make sure the settings are as follows:
i. Transformation type = Linear
ii. Resampling method = Nearest neighbour
iii. Target SRS = Project CRS
iv. Output raster; click the dotted button to assign the file path and name

g. Click the 'Start georeferencing' button to finish.

h. Compare the boundaries to make sure the scanned image has been geo-referenced adequately enough. If not, repeat the process with more points.

Step 3: Create a Grid

a. Vector > research tools > create grid and check the settings match those below. Select the extent on canvas and draw a box around the grid of the scanned image. Before clicking ‘Run’, click the dotted button to choose a path and file name.
NOTE: The vertical and horizontal spacing of the scanned habitat map grid is 100m x 100m.

b. Change the transparency of the grid; right click the layer, select properties then symbology and change the opacity to ~20%

c. Clip the grid to the polygon; Vector > Geoprocessing tools > Clip using the settings below.

Atep 4: Vectorise

a. Right click the clipped grid and duplicate the layer. Save this duplicated layer as a new .shp file and name it so it can be identified as the corresponding scanned map e.g. 'GoonHilly_habitat1.shp’.

b. Add 2 new fields to the attribute table:
i. Open the Grid layers attribute table (right click layer and select ‘open attribute table).
ii. Click the 'toggle editing' button
iii. Click the 'new field' button and add a text field called ‘Habitat’ with a length of ~20 characters
iv. Add another field that is an integer called ‘HabitatID’ with a length of ~3 characters.

d. Select the grid squares to assign a habitat type e.g. gorse or heather:
i. Go back to the main window and click the 'select features by area or single click' button, then select the grid squares you want to assign to a particular habitat by either dragging the mouse over them or holding ctrl and clicking on multiple grid squares.

e. Assign the habitat type:
i. Click Edit > modify attributes of selected features
ii. Enter the habitat and habitatID to the relevant fields.
NOTE: Keep a record of the numbers you assign habitats so the coding system can be replicated in subsequent maps.

f. Fill all grid squares and then toggle out of editing mode to save the layer

g. To better keep track of the squares that have been assigned you can assign colours to the habitat types as you add each new habitat:
i. Right click the layer and go to properties, then symbology. Change ‘single symbol’ to ‘categorized’, change the column to the ‘Habitat’ column and then click classify.
ii. Change the empty field (by right clicking it) to 100% opacity so only the grid outlines can be seen.

Step 5: Rasterise

a. Click Raster > conversion > Rasterize (vector to raster)

b. Change settings:
i. Input = clipped grid layer
ii. Field = Habitat ID (numeric field)
iii. Output raster size units = Georeferenced units
iv. resolution = 1 (otherwise the grid squares may shift a few pixels)
v. Output extent = click the dotted button and select ‘use layer extent’ and choose the clipped grid layer v vi. In the advanced parameters section, enter the file name and location

c. Colour raster:
i. Right click raster layer, then properties, then symbology
ii. Change render type to Paletted/unique values and click classify.
iii. You can then right click the categories to change the colours to a desired palette which can be saved for later use.

Now do it all again for the second habitat map. Remember, you can import the georeferenced points that were saved in step 2. If the points do not line up on the scanned image you can click the 'move point' button to move the points to the correct places.

Leave a Reply

Your email address will not be published. Required fields are marked *