QGIS 2.16 tutorial: georeferencing images

Since our last tutorial regarding georeferencing images in QGIS is 4 years old, let us have a second look at this task in the current times of QGIS 2.16. For this tutorial we will use a Soviet map of Crewe in England to see changes in city structure with a snapshot from 1957. We will use simple and quite easy affine transformations for this purpose.

Objective

If you want to connect maps and images with other spatial data each data set needs to be “digitally located”. Each pixel of a map has in its original form only a reference according to the whole image: A pixel may be the 3216th in the 212th row but thats all for the beginning. You can translate this location (x=3216, y=212) to a geographic and therefore “real” spatial system by georeferencing it by using the defined coordinate system which the map is based on. We will show you, how this works.

what do you need

  • Quantum GIS (examples shown in QGIS 2.16.2
  • a scanned map either in JPG or as a tif-file

Time Effort

approx. 5-10 minutes

Step 1 – Preparational Steps

We will start with a new project and use Sentinel-2 image as a reference for this one. Sentinel-2 Images are normally shipped with the UTM projection using the wgs84 reference ellipsoid. So we will project the map onto this target SRS (Spatial Reference System). For downloading the Sentinel-2 image I was using the Earth Explorer and the image with the entity ID S2A_OPER_MSI_L1C_TL_SGS__20160719T112949_20160719T165219_A005611_T30UWD_N02_04_01. The different bands are combined to a composite image for the purpose of a reference using the merge function in the raster dialog of QGIS (Raster->Miscellaneous->Merge…) and choosing the bands four as red, three as green and two as blue: You will see, that the CRS (Coordinate Reference System) switched automatically to EPSG:32630 which corresponds to UTM Zone 30 using the WGS84 ellipsoid. Now we are ready. Our map will be projected into this UTM Zone.
Sentinel-2 image Crewe
The Sentinel-2 image of Crewe.

Step 2 – Working With the Map

Click now on Raster->Georeferencer->Georeferencer. In the new window you need to open your scanned image by clicking on Open Raster and choose your desired map. After this you will see the map in the Georeferencer As we can’t see any proper coordinates of the crosses, we need to do a visual editing by using Ground Control Points (GCPs) as a reference. Good GCPs are easy to see and differentiate, easy to distinguish and valid throughout the years of the image material:
  • Mountain tops
  • Monuments
  • Buildings
  • Street crossings
scanned image of Crewe
The scanned image in the Georeferencer Plugin
But prior searching and using any GCPs we need to define a proper reference system the image will be georeferenced with. As the Sentinel-2 reference image is in use and accompanied with OSM data we will use “EPSG:32630” as the Target Reference System in the properties of the transforation using Settings->Transformation Settings… This is not only asking you for the Target SRS (“EPSG:32630”) but also for the transformation type and the resampling method.
The transformation type defines the complexity of the mathematical computation to transform multiple points into their referenced coordinates. This is easy for one point but the map or image has multiple pixels and in the wanted result every pixel should be referenced correctly, shouldn’t it? To allow a stretch in x, y and combined xy direction we need at least three points for the referenciation. If you don’t understand why, here is a simple explanation using a sheet of paper:
There are several other transformation types which also allows “error free” transformation like the spline transformation but this is just “bogus”.
The resampling type defines the way the pixel value in the referenced image will be calculated. Nearest neighbor will use the pixel value that has most overlap. You might ask why is there an “overlap”?! If you transform a pixel it will not be quadratic anymore but more or less a rectangle or even further complex shape. So the question will arise: “What is the pixel value (quadratic) of something that consists of other non quadratic pixels”.
  • Nearest Neighbour: takes the pixel value from the most overlapping/nearest pixel and assign this value to the target pixel (which might result in rectangular steps in the target image!)
  • linear: will take an average of the surrounding pixels (might get a bit “blurry” but still one of my favourites)
  • cubic: will take even more pixels then bilinear into account (increasing blur effect!)
Other properties to choose are:
  • Compression should be none. So an image file and the values in it will not be distorted in any way.
  • Define your target images name and location in the Output raster field.
  • As the Target SRS you need to choose your defined target coordinate system.
  • Generate a PDF map if you like.
  • Generate a PDF report if you like. It will have the values of RMSE in case your interested in your performance
  • Load in QGIS when done is often a good choice
Properties for georeferencing a raster
Propetries in the Georeferencer Plugin
As we have the properties defined (don’t forget the output image path), we are ready to work with those GCPs. first create a new GCP on the scanned image. A popup will appear asking for the coordinates of this pixel. You can either type them by hand (which we can’t) or use the button “From map canvas”. We will go with this option and search for the corresponding feature in the Sentinel-2/OSM map and mark it there. Go ahead with this procedure till you have at least three points. The higher the number of GCPs the better result as the errors per pixel will be minimized due to averaging those errors and applying the best polynomial model in terms of RMSE (Root Mean Square Error).

Step 3 – Processing it

After you have marked the four points, click on the green arrow Start Georeferencing. If you missed to fill in the properties it will be now the best time to do so (fig. 2).
Click on “OK” and enjoy a small coffee or tea.

Step 4 – Quality Analysis

There are several ways to check the quality of the georeferenciation.
First: Use your eyes 😉 By simply adjusting the opacity of a layer you can check whether this layer fits fine into your already referenced material (in our case the Sentinel-2 and OSM data) RMSE You can try your best and search for a lot of GCPs. This will affect the overall quality of your model. The rule of thumb here is: The RMSE should be less then 1/2 a pixel. Here are some good thoughts on that.

Step 5 – Enjoy the Video

0 0 votes
Article Rating
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
wanjohi kibui
7 years ago

Very awesome.Nice