Georeferencing a scanned map with QGIS

Some times you need to have vector data that haven’t been digitized yet, like some old maps with building footprints or street lines. We can scan a map, georeference it in QGIS, and then digitize those features to create new vector layers. Scanned maps don’t contain spatial reference information, so to digitize we need to reference the raster in a specific coordinate system.

In this example we will georeference a map of the city of Barcelona with the layout of the old medieval walls (XIII-XIV) with QGIS.

The original map was downloaded from wikipedia.  Author: Servei d’Arqueologia de Barcelona.

We’ll use the ‘Georeferencer’ plugin instaled by default on QGIS. Click on Raster > Georeferencer > Georeferencer and a new window will open. Select the raster file called ‘Planta_muralla_medieval_de_Barcelona.jpg‘ and set the coordinate reference system (CRS), in this case we use the ETRS89 UTM31N (25831).

Sometimes the scaned map provides crosses with coordinates “written” on the image so you can enter the coordinates manually.

In this case there is no coordinates on the map so we’ll use an already georeferenced layer. If we don’t have in local any layer of the zone, the easier way to do it is load some WMS layer with the location of the map and with the same coordinate system. We will use the Web Map Service of the Institut Cartogràfic i Geològic de Catalunya:

URL: http://geoserveis.icc.cat/icc_mapesbase/wms/service?

There is several layers in the WMS, we’ll use Topographic map of Catalonia 1:5.000

Once this WMS layer is added we go back to the Georeferencer window and start adding points:

When you click on ‘add point’ a popup appears asking for the X, Y coordinates.

If you know the coordinates of the point (because they are on the map, or you have GPS points) just enter the coordinate and click OK. In this case we need to enter the coordinates by clicking on the reference dataset (the WMS) loaded in QGIS map canvas. As you are adding control points these are added to the table of  GCP (Ground Control Points) on the bottom.

This Ground Control Points are locations that can be accurately identified on the raster map and in real-world coordinates. The number of point you need to create depends on the complexity of the transformation you plan to use. You should spread the points all over the map rather than concentrating them in one area. 

The points that are added to the map will be stored in a separate text file ([filename].points) usually together with the raster image. This allows us to reopen the Georeferencer plugin at a later date and add new points or delete existing ones to optimize the result.

Define the transformation settings for the georeferencing process

  • The Thin plate spline (TPS) algorithm is able to introduce local deformations in the data. This algorithm is useful when very low quality originals are being georeferenced. It consider the GCP as exact, in case one of then have errors will produce a big distorsion
  • The Polynomial algorithms 1-3 are among the most widely used algorithms for georeferencing, in case some of the GCP has errors the algorithm do an interpolation.

After all GCPs have been collected and all transformation settings are defined, just press the button mActionStartGeoref Start georeferencing to create the new georeferenced raster.

When the process is finished the map will be added to the project layers, and we can digitize information from it, like the medieval walls.

In the next post we’ll see how to see that georeferenced image on a map by converting it to tiles.