Tips for Using QGIS

Foreword

Generating Basic Environment Category Grids

The most basic grid you are likely to create is a habitat grid. This is file of points of the form x,y,category(n). The first stage is to get a geo-referenced map of the area under study into QGIS. I looked at a couple of ways of doing this which included using open streetmap but in the end downloaded a small portion of OS data. The OS data had to be referenced using the geo-referencer plug-in and then warped to the WGS-84 map projection which I wanted to use.

 

The next step is to generate a vector shape layer, drawing polygons to represent to habitat type and assigning category numbers and descriptive names as required. This is shown in the picture to the right. I used a georeferenced scan of the forest plantation plan published by the forestry commission as a guide, but also used local site knowledge as the plan is a bit out of date with reality. You need to make sure that no gaps are left between polygons, the object snap feature works well most of the time, but you need to exercise some care in this part of the activity, or you will spend hours cleaning up the rasterised data at a later stage.

 

The next stage is rasterisation, this converts the vector shape layer to a simple bitmap with the pixel values assigned to the appropriate category value. You do this with the raster-conversion-rasterise command. You can select the number of points you require in the final environment grid if this is the only one you are using, however I chose to produce an over-sampled grid and then use the clipper function to select the required area for analysis using a pre-set mask, and then the warp function to resample the area to the grid required (I did this because of the need to set up multiple environment grids). You need select "nearest neighbour" as the interpolation method, because you have discrete categories. I found it most reliable to work in geo-tiff format, some functions did not appear to work in .ntf format. Whatever method you use, at some point you will need to convert to an ESRI ascii file, and you do this via the raster-convert-translate command. You will probably fnd there is still some "salt and pepper noise" in the final grid file. I looked at automatic ways of removing this, but failed miserably. The quickest way of dealing with this is to read the data in excel, and use format-cells to identify any zero value cells, then manually correct the errors and save again in ascii format space de-limited file.

 

Proxy and Calculated Grids

Generating mathematically derived grids is somewhat harder, however you can generate simple euclidean distance grids using QGIS without too much difficulty.

 

In my case, I was interested in the distance (inside and outside) away from the forest boundary, so what I did was to generate two polygons corresponding to outside and inside the forest. This shown in the attached picture to the right. Those sharp eyed among you will notice it's not in a WGS-84 projection, but a mercator projection in order to preserve distance (at least over a small projection area like this). These shapefile layers need to be merged using the mmqgis plug-in-transfer-merge layers command. This flattens the layers into one, so you can now use the raster-analysis-proximity command to generate a map of distance to the closest edge, interior or exterior as required. Note, it's best to use the bilinear or cubic interpolation method this time as the function is continuous. You then need to use the raster-warp command to translate back from mercator to WGS-84, after which you can then resample, clip and translate the data as before.

In the case of habitat features like streams and hedgerows, I decided to model proximity to the feature centre-line. I generated the features from the OS Survey map using line features in .shp vector layer, and then proceeded to rasterise and generate the proximity grip in exactly the same way as described above. Note, you need to assign each stream feature the same ID, or you'll confuse the proximity function.

 

If you have access to public domain maps like the UK OS Survey data, it's easy to extract the required features. The OS data for water is in two .shp files, one for water areas and a lines .shp file for small streams and water outline. The first thing I did was to select just the features in the areas of interest using the geoprocessing clip function. I then rasterised both the lines and polygon files, but also used the -te switch in the rasterise command line to define the extent of the modelled region in both cases (if you don't do this, the rasterised extent is defined by the object extent itself, which may be different in the two cases) and the -tr switch to set the grid spacing to 0.5 m. You can then add the two rasters together using the raster calculator tool, and it's ready for the proximity analysis as above.

 

Pitfalls to Aviod