Skip to content
← Back to QGIS from first project to capstone
QGIS · Part 02 of 20Beginner· 10 min readSources

Georeferencing in QGIS: Image to Image, Image to Ground and Image to Map

Give an unreferenced image real coordinates using the QGIS Georeferencer. Three methods with control points, transformation types, residual errors, and a check of the result.

What is georeferencing?

Georeferencing gives an image a position on the Earth by linking points on the image to known coordinates. The image is then warped, or stored with a transform, so that GIS can draw it in the right place.

It is not the same as orthorectification. Georeferencing fits an image to coordinates. Orthorectification also removes distortion from terrain and sensor geometry using a DEM. A georeferenced image can still have terrain displacement.

Three methods, named by what supplies the known coordinates:

MethodKnown coordinates come fromTypical use
Image to imageAnother image that is already georeferencedAligning an old or unreferenced image to a recent one
Image to groundPoints measured in the field, for example GPSSurvey photos, drone images, scanned plans with surveyed corners
Image to mapA georeferenced map, or the printed grid on a paper mapScanned toposheets and old maps

Key terms

  • GCP (ground control point): a point you can find on the image and for which you know the true coordinates.
  • Source coordinates: pixel position on the image (column, row).
  • Target coordinates: the real-world coordinates in the target CRS.
  • Transformation: the mathematical model that moves the image onto the GCPs.
  • Residual: the distance between where a GCP lands after the transformation and where it should be. Smaller is better.
  • RMSE (root mean square error): one number summarising all residuals.

Prepare the practice images

The tutorial rasters are already georeferenced, so we first make an unreferenced copy to practise on.

  1. Open your QGIS project with sentinel2/43PGQ/TCI.tif (reference) and the Landsat 8 true-colour (SR_B4, SR_B3, SR_B2 as red, green, blue; see Part 1).
  2. Zoom to an area with clear features such as Bengaluru city, lakes, roads and the airport.
  3. Show only the Landsat layer.
  4. Project > Import/Export > Export Map to Image.
  5. Untick Append georeference information (embeds a world file or XML).
  6. Save as landsat_unreferenced.png.
Export Map to Image dialog, georeference option unticked
Figure 2.1. Export Map to Image dialog, georeference option unticked

This PNG has no coordinates. If you open it in QGIS, it appears near 0,0.

Open the Georeferencer

Layer > Georeferencer. The window has a top toolbar, the raster on the left, and the GCP table at the bottom.

  1. File > Open Raster (or the open icon) and choose landsat_unreferenced.png.
  2. Settings > Transformation Settings (details below).
Georeferencer window with the raster open and GCP table empty
Figure 2.2. Georeferencer window with the raster open and GCP table empty

Transformation settings

SettingRecommended valueWhy
Transformation typePolynomial 1Straight, predictable, needs at least 3 GCPs. Good start for satellite images
Resampling methodNearest neighbour for classified data, Cubic for imageryControls how new pixel values are computed
Target CRSEPSG:32643Match the reference image
Output rasterlandsat_georef.tifChoose a short path
CompressionLZWSmaller file
Create world file onlyOffWe want a warped GeoTIFF
Save GCP pointsOnLets you reopen and edit later
Load in QGIS when doneOnSee the result immediately
Transformation Settings dialog filled in
Figure 2.3. Transformation Settings dialog filled in

Which transformation type?

TypeMinimum GCPsDoesUse when
Linear2Shift and scale onlyImage only needs moving and scaling
Helmert2Shift, scale and rotateScans of maps that are not distorted
Polynomial 13Adds shear (affine)Most satellite images and scans
Polynomial 26Bends the image slightlyMild non-linear distortion
Polynomial 310More bendingRare, risky with few points
Thin Plate Spline10 or moreRubber-sheeting, forces points to match exactlyOld, warped or hand-drawn maps
Projective4PerspectiveOblique photos, building facades

More GCPs help only if they are well placed. Spread them around the whole image, including near the corners, and avoid clustering.

Method 1: image to image

You will pick matching features on the unreferenced Landsat image and on the Sentinel-2 reference.

Pick good control points

Good points:

  • Road intersections and bridges
  • Airport runway ends
  • Corners of reservoirs or large buildings
  • Sharp field boundaries

Poor points:

  • Shorelines or rivers that move between dates
  • Clouds and shadows
  • Anything that has been built or removed between acquisitions
  • Vegetation edges

Steps

  1. In the Georeferencer, zoom to a first feature (for example a runway end).
  2. Click Add Point (Ctrl+P) and click the exact spot on the image.
  3. In the Enter Map Coordinates window click From Map Canvas. The Georeferencer minimises.
  4. In the main QGIS canvas, click the same feature on the Sentinel-2 layer. The coordinates fill in. Click OK.
  5. Repeat for at least 8 to 10 points around the whole image.
  6. The GCP table at the bottom shows each point's source X/Y, destination X/Y and residual.
Add Point on the image side, at an intersection
Figure 2.4. Add Point on the image side, at an intersection
Same intersection picked on the Sentinel-2 canvas
Figure 2.5. Same intersection picked on the Sentinel-2 canvas
GCP table with 10 points and residuals visible
Figure 2.6. GCP table with 10 points and residuals visible

Read the residuals

  • A residual is shown in pixels of the source image.
  • Aim for an RMSE under 1 pixel. For a 30 m Landsat image that is about 30 m on the ground.
  • If one point has a much larger residual than the others, it is probably wrong. Select it in the table, press Delete, or re-pick it.

Run

  1. Click Start Georeferencing (the green play button). QGIS writes landsat_georef.tif and loads it.
  2. Drop the transparency of the new layer or use Swipe (install the Layer Swipe plugin or use Layer Styling) to compare it against Sentinel-2.
  3. Check at features that were not used as GCPs, such as another road junction. That is a fair accuracy test.
Start Georeferencing button and output loaded
Figure 2.7. Start Georeferencing button and output loaded
Georeferenced Landsat over Sentinel-2 with 50% transparency, showing aligned roads
Figure 2.8. Georeferenced Landsat over Sentinel-2 with 50% transparency, showing aligned roads

Method 2: image to ground

Here the known coordinates are typed in, for example from a GPS survey or a plan with surveyed corners.

For practice you can read coordinates from the Sentinel-2 layer and treat them as if they were GPS readings.

  1. Open landsat_unreferenced.png in the Georeferencer again (File > Open Raster).
  2. Click Add Point on a feature.
  3. In Enter Map Coordinates, type the X / East and Y / North values yourself. Set the Target CRS to match what your GPS recorded.
  4. Click OK, then add the other points.
  5. For an exercise, read the coordinates from the Coordinate box in the status bar, or from the Derived section of the Identify results, while pointing at the feature on the Sentinel-2 layer.
Enter Map Coordinates with typed coordinates and CRS selector
Figure 2.9. Enter Map Coordinates with typed coordinates and CRS selector

Some points to watch:

  • Use the right CRS. GPS gives latitude and longitude in WGS 84 (EPSG:4326). If your target is EPSG:32643, enter the coordinates as UTM metres, or set the point CRS to EPSG:4326 and QGIS will convert.
  • Axis order: X is easting (longitude), Y is northing (latitude). Swapping them is the single most common mistake.
  • Units: degrees and metres can not be mixed in one GCP set.

Method 3: image to map

Use this for scanned maps, such as a toposheet.

A paper map usually prints a graticule (latitude and longitude lines) or a grid (UTM or other projected grid) with labels at the edges. Those intersections are excellent GCPs.

  1. Scan or photograph the map flat, at 200 to 300 dpi.
  2. Open it in the Georeferencer.
  3. Add a point at each grid line intersection, typing the coordinates from the labels.
  4. Use at least 4 points near the four corners and a few more in the middle.
  5. Choose Polynomial 1 for a clean scan, Thin Plate Spline for an old or warped map.
  6. Set the Target CRS to the CRS stated in the map margin (a Survey of India toposheet is usually in a Polyconic or Everest-based CRS, so read the legend carefully).
  7. Run and check against OpenStreetMap (use QuickMapServices) or Sentinel-2.
A scanned map in the Georeferencer with grid-intersection GCPs
Figure 2.10. A scanned map in the Georeferencer with grid-intersection GCPs
Georeferenced scan overlaid on OSM at 50% transparency
Figure 2.11. Georeferenced scan overlaid on OSM at 50% transparency

Save and reuse the GCPs

  • Save GCP Points writes a .points file. Reload it with Load GCP Points to edit and rerun.
  • Generate PDF Map and Generate PDF Report from the toolbar create a documented record of the residuals.
The residual plot or PDF report
Figure 2.12. The residual plot or PDF report

Common mistakes

  • Using too few GCPs, or all in one corner.
  • Choosing features that moved: shorelines, vegetation edges, temporary buildings.
  • Using high-order polynomials with few points. They can twist the image away from the control points.
  • Swapping X and Y, or mixing degrees with metres.
  • Forgetting to set the target CRS before running.
  • Checking accuracy only with the same GCPs that built the transformation.
  • Resampling several times. Each warp softens the image, so georeference once from the original.

Key takeaways