Georeferencing maps with QGIS

From Open source mapmaking technologies
Jump to: navigation, search

Sometimes we receive some paper based map with useful information, but it is not ready to be processed.

Georeferencing

In this module, we are going to georeferencing a paper map (simply called image in the following text, to distinguish from the QGIS map canvas).

Data

The necessary data for this exercise is available from QGISGEOREF zip archive.

We have Wuhan district limits, water areas and strems, and Wuham highways available.

We also have a wonderful Tourist map of Wuhan city. The image has a square grid, indexed by number and letters on the margins, but no geographic coordinates. This is the image that we want to georeference.

TouristMapOfWuhan 600x.jpg

As we will see, we need to visually identify which features are on the image (the tourist map) an also on the QGIS map canvas. For foreigners, it will not be easy. You can check on OpenStreetMap where the image will fit.

Project setup

Let's start by creating a map with the vectorial data we have. Add all the 4 shapefiles we have to QGIS, either by drag and drop, or by using the Add vectorial layer dialog.

Layer order and style

Ensure that you can see all layers. Drag the layers to get this layer order, from top to bottom:

  • wuhan-highway
  • wuhan-water-stream
  • wuhan-water
  • wuhan-district

Adjust the style of each layer:

  • wuhan-highway: use a dark magenta/violet color
  • wuhan-water-stream: use a blue color; change pen width to 1.
  • wuhan-water: use the same blue of wuhan-water-stream; change border style to No pen (ie no border)
  • wuhan-district: use black border, with width 1; fill style No brush (ie disable polygon fill)

You should get a map like the following:

Layer order and style.png

Activate Georeferencer plugin

If you never used before the Georeferencer plugin, it might not be available in the Raster → Georeferencer menu.

To enable it, go to Plugins → Mange and Install Plugins...

Search for 'Georef' and activate the Georeferencer GDAL plugin.

Activate georeferencer plugin.png

Workflow

We will follow this simple workflow:

  1. Open the georeferencer plugin
  2. Open the image to georeference (TouristMapOfWuhan.jpg)
  3. Put the map and the image side by site
  4. Define several point pairs: one on the map and the corresponding on the map canvas
  5. Using the point pairs, we will call GDAL to create a copy of the image in GeoTIFF format, with the computed coordinates built in
  6. Display the resulting image below the highway layer, to check if it fits properly
  7. If the result is satisfactory, close the georeferencer plugin

Maybe we can not to a perfect job on the first time. We can repeat the process a second time to improve the georeference process.

Please note in advance: the data on the image has a different source and is not so updated. You can not have a precise matching of all streets in both maps.

Open the georeferencer plugin

Open the georeferencer plugin, available in Raster → Georeferencer → Georeferencer.

Open the TouristMapOfWuhan.jpg image

Use Open Raster (on File menu), and open TouristMapOfWuhan.jpg. There is no coordinate system defined for this image, and so QGIS asks for the coordinate system. You can cancel the dialog.

Put the map and the image side by site

Try do adjust your windows, to see side by side the image and the map. Try to zoom the map canvas to the same area of the image.

Side by side for georeferencing.png

Define point pairs

To define point pairs, we use a three step workflow, as depicted in the following figure.

Enter point pairs sequence.png

  1. First, we click the Add point button.
  2. Click on the image first
  3. And then click on the corresponding point on the map

After click on the image, a dialog will show, asking you to enter the point coordinates. Instead of enter point coordinates, we select From map canvas button, to get the coordinates from the map.

After select the point on the map, the dialog is filled with the corresponding coordinates. Click Ok to close the dialog.

A pair of points will appear bellow the image, in the georeferencer window.

Georeferencer dialog with one point pair added.png

The columns srcX and srcY are (pixel) coordinates from the image; the destX and dstY are ground coordinates from the map.

Define more point pairs, 5 or 6 to start.

Computing the transformation

After adding several points, we can compute the image transformation. Choose File → Start georeferencing. A reminder will show.

Please set transformation type.png

Fill the dialog with the following options.

Georeferencer options.png

The resulting map

Image georeferenced.png

Exercise

Using the same layers from the previous exercise, georeference the image campusmap.jpg.

The following screen capture illustrates the result.

Campus image georeferenced.png