Georeferencing maps with QGIS
Sometimes we receive some paper based map with useful information, but it is not ready to be processed.
- 1 Georeferencing
- 1.1 Data
- 1.2 Project setup
- 1.3 Workflow
- 2 Exercise
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).
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.
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.
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:
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:
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.
We will follow this simple workflow:
- Open the georeferencer plugin
- Open the image to georeference (TouristMapOfWuhan.jpg)
- Put the map and the image side by site
- Define several point pairs: one on the map and the corresponding on the map canvas
- Using the point pairs, we will call GDAL to create a copy of the image in GeoTIFF format, with the computed coordinates built in
- Display the resulting image below the highway layer, to check if it fits properly
- 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.
Define point pairs
To define point pairs, we use a three step workflow, as depicted in the following figure.
- First, we click the Add point button.
- Click on the image first
- 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.
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.
Fill the dialog with the following options.
The resulting map
Using the same layers from the previous exercise, georeference the image campusmap.jpg.
The following screen capture illustrates the result.