Georeferencing#

Georeferencing in QGIS is the process of aligning a raster image, such as a scanned map or aerial photograph, to a known coordinate system so that it can be used in spatial analysis. This involves assigning real-world coordinates to the image by identifying control points on the raster that correspond to known locations on the earth, often using existing vector layers or coordinate grids as a reference.

In many cases, governmental institutions publish maps only as PDFs, without public access to the underlying data. In these cases, knowing how to correctly georeference a map allows you to access and use the information in your GIS analyses. In the case below, the soil degradation map of Somalia is only available in a pdf report. In order to use the information in a GIS analysis, we can use the georeferencer to assign geographic coordinates to the pixels of the image. After georeferencing the image, the result is a raster file (.tiff). This dataset can be vectorized (converted into vector data) or joined with other raster data, to gain additional information.

Georeferencing is the process of giving each pixel on a map geographic coordinates. This is done by selecting points on a map, and assigning them a geographic coordinate, either by enter the coordinates manually, or selecting the corresponding point in the QGIS map canvas. These points serve as reference points for the georeferencing algorithm to add geographic coordinates to each pixel in the raster.

../../_images/example_georefencing_hague.png

Fig. 61 A digitised old map of the Hague (Source: Kokoalberti)#

Georeferencing in QGIS#

In QGIS, the Georeferencer tool is used for this process. Users manually place control points on the raster image and match them to corresponding locations in a reference dataset. The software then uses these points to transform the image, adjusting its scale, rotation, and position to accurately overlay it with other geospatial layers. Georeferenced images become valuable for digitizing features and conducting spatial analyses within a GIS.

There are several transformation algorithms available in QGIS to gereference a map. If the map is in the same CRS and only needs to be rotated, a linear transformation is sufficient. However, if the image or map is in a different CRS or is visibly skewed, a polynomial transformation is needed. The more complex the transformation algorithm is, the more Ground Control points you need.

../../_images/en_georef_transformations.png

Fig. 62 Different transformation types: linear (left), polynomial 2nd degree (middle), polyonmial 3rd degree (right) (Source: ESRI)#

Transformation types#

Transformation types (from the QGIS Documentation)

Linear

The Linear algorithm is used to create a world file and is different from the other algorithms, as it does not actually transform the raster pixels. It allows positioning (translating) the image and uniform scaling, but no rotation or other transformations. It is the most suitable if your image is a good quality raster map, in a known CRS, but is just missing georeferencing information. At least 2 GCPs are needed.

Polynomial 1

The Polynomial 1 algorithm allows a more general affine transformation, in particular also a uniform shear. Straight lines remain straight (i.e., collinear points stay collinear) and parallel lines remain parallel. This is particularly useful for georeferencing data cartograms, which may have been plotted (or data collected) with different ground pixel sizes in different directions. At least 3 GCP’s are required.

Polynomial 2-3

The Polynomial algorithms 2-3 use more general 2nd or 3rd degree polynomials instead of just affine transformation. This allows them to account for curvature or other systematic warping of the image, for instance photographed maps with curving edges. At least 6 (respectively 10) GCP’s are required. Angles and local scale are not preserved or treated uniformly across the image. In particular, straight lines may become curved, and there may be significant distortion introduced at the edges or far from any GCPs arising from extrapolating the data-fitted polynomials too far.

Helmert

The Helmert transformation also allows rotation. It is particularly useful if your raster is a good quality local map or orthorectified aerial image, but not aligned with the grid bearing in your CRS. At least 2 GCPs are needed.

Projective

The Projective algorithm generalizes Polynomial 1 in a different way, allowing transformations representing a central projection between 2 non-parallel planes, the image and the map canvas. Straight lines stay straight, but parallelism is not preserved and scale across the image varies consistently with the change in perspective. This transformation type is most useful for georeferencing angled photographs (rather than flat scans) of good quality maps, or oblique aerial images. A minimum of 4 GCPs is required.

Thin Plate Spline (TPS)

The Thin Plate Spline (TPS) algorithm “rubber sheets” the raster using multiple local polynomials to match the GCPs specified, with overall surface curvature minimized. Areas away from GCPs will be moved around in the output to accommodate the GCP matching, but will otherwise be minimally locally deformed. TPS is most useful for georeferencing damaged, deformed, or otherwise slightly inaccurate maps, or poorly orthorectified aerials. It is also useful for approximately georeferencing and implicitly reprojecting maps with unknown projection type or parameters, but where a regular grid or dense set of ad-hoc GCPs can be matched with a reference map layer. It technically requires a minimum of 10 GCPs, but usually more to be successful.

How to Georeferencing in QGIS#

In order to georeference a PDF map, you need to follow the following steps:

  1. The first step is to export the Map from the PDF as an image. For example, you can take a screenshot using the Snipping Tool on Windows, or by pressing Shift + Command + 4 on MacOS. Name and save the screenshot.

  2. In your QGIS window, add a basemap using the QuickMapServices Plugin. Ideally, use a basemap where you can identify exact locations on both the basemap and the map you want to georeference.

  3. Open the Georeferencer by navigating to the Top Bar > Layer > Georeferencer (see Fig. 63)

../../_images/en_3.36_open_georefencer.png

Fig. 63 Opening the Georeferencer in QGIS 3.36#

  1. A new window will open. This is the georeferencer. To add an image to georeference, click on Open Raster.

  2. Select the image of the map you want to georeference. Click Open.

  3. The image will appear in the middle of the georeferencer window. Click on Transformation settings....

  4. A new window will open. Here you can set the transformation type and the target CRS. Below, you can set the name and save location of the file. Make sure that the Load in project when done is checked.

  1. Click on Ok.

  2. Once you have set the transformation type, you can start adding Ground Control Points (GCP) by clicking on Add Point. Ground Control Points are points that you ascribe specific geographic coordinates.

  3. Click on a point on the map image. This will be the precise location that you can identify on both the basemap and the map you wish you georeference.

  4. Once you clicked on a position, a new window will appear. Here, you add the coordinates to the point you selected. There are two options to do this:

    • Enter the coordinates manually. You will need to know the exact coordinate. Sometimes, you have a coordinate grid on maps where you can

    • Select the points . This mode will minimize the georeferencer and open the QGIS Map canvas. Zoom to the same location you selected on the non-georeferenced map and Click once.

    • Once the coordinates are entered, click Ok

  5. The georeferencer window will open again. This time, below the map image, you can see a point in the table. These are the Ground Control Points. Continue adding more GCP. Spread them out over the entire map. Make sure that the Mean error in the bottom right corner of the georeferencer window is as low as possible (below 5 is ideal).

../../_images/en_3.36_georef_dialogue_GCP.png

Fig. 64 Georeferencer dialogue in QGIS 3.36#

  1. Once you have added enough points, click on Start Georeferencing. QGIS will use the Points you added to transform the image into a georeferenced image, where every pixel has GPS coordinates ascribed to it.

  2. You can close the georefencer window. Decide wether you want to save the GPC points in a file. If you are not sure if your georeferencing accuracy was precise enough, save the GPC points so you don’t have to do all the work again.

  3. Congratulations, the georeferenced map will now appear as a raster layer in your QGIS-project

../../_images/en_3.36_finished_georef.png

Fig. 65 A georeferenced map of Somalia in the QGIS Map Canvas#