Georeferencing Raster Imagery in QGIS using Vector Data
Contents
- 1 Purpose
- 2 Introduction
- 3 Acquiring Data
- 4 Installation
- 5 Starting QGIS
- 6 Adding Geospatial Data in QGIS
- 7 Accessing a Plugin
- 8 Using Georeferencer DGAL
- 9 Terms
- 10 References
Purpose
The purpose of this tutorial is to understand and learn how to conduct a georeferencing process on a specific data set in QGIS. Also, you will learn how to navigate through QGIS and learn how to use its basic functions. For the purpose of this tutorial, a basic understanding of GIS is assumed.
Introduction
QGIS
QGIS is cross-platform and is able to operate on Mac OS X, Linux, UNIX and Microsoft Windows. QGIS is available in multilingual formats and is licenced under GNU GPL (OSGeo) http://www.qgis.org/en/site/about/index.html. QGIS, previously known as Quantum GIS, was initially created by the Open Source Geospatial foundation in 2007 and is maintained by the QGIS Development Team. The software is written in C++ language. The software integrates many plugins that are written in either C++ or Python. SQLite, GDAL, GRASS GIS, PostGIS and PostgreSQL provide users with access to different data formats.
QGIS can be used in conjunction with other open source GIS software packages such as PostGIS, GRASS and MapServer in order to extend the software’s capabilities. Users have access to Python plugins and plugins that are able to geocode using the Google Geocode API as well as an array of geoprocessing tools that are similar to those found in the well-known software package ArcGIS. QGIS is free open-source geographic information system (GIS) software that provides users with the ability to view, edit and analyse data. Users are able to generate maps using a variety of map layers using different projections. QGIS is compatible with both vector and raster data as well as geodatabases.
Georeferencing
Geo-referencing in GIS allows the user to use a known coordinate system to align geospatial data so that it may be viewed, queried or analyzed with other geospatial data. This process involves manipulating the data through shifting, scaling, rotating or skewing in order to align the datasets.
Satellite imagery can be affected by geometric distortions as a consequence of sensor geometry, inconsistency in the scanner or platform, earth rotation or earth curvature. These issues can be corrected by referencing the imagery to existing maps. Since satellite imagery and aerial photographs do not contain reference information to a location when in their original format. In order to use this information in combination with other geospatial datasets it is necessary to correct the imagery so that it has a similar resolution and projection as the data you wish to work with.[3]
Acquiring Data
Supplementary geospatial data can be downloaded from Geobase [4] or the Geoconnections Discovery Portal online [5]
The files used for this example include the following and can be found here [6], while the Satellite Imagery of Carleton can be found here [7]:
Data Used | Data Format | Data Source |
---|---|---|
Rail | Vector Polygon | Layer: Rail, 2010 / Producer: Carleton University Construction Services |
Carleton Boundary | Vector Polygon | Layer: Carleton Boundary, 2010 / Producer: Carleton University Construction Services |
Canal | Vector Polygon | Layer: Canal, 2010 / Producer: Carleton University Construction Services |
Buildings | Vector Polygon | Layer: Buildings, 2010 / Producer: Carleton University Construction Services |
Rideau River | Vector Polygon | Layer: Rideau River, 2010 / Producer: Carleton University Construction Services |
Roads | Vector Polygon | Layer:Roads, 2010 / Producer: Carleton University Construction Services |
Satellite Imagery | Portable Network Graphics (PNG) | Layer: Carleton University Campus, 2010 / Producer: Digital Globe (Google) |
- Figure 1 to the right shows the data set from the link provided. The link of course brings you to the Carleton Library GIS data page and therefore requires your Carleton login information. Make sure to save the data used in this tutorial to your computer and extract all of them to a file that you will be working with.
Installation
You can download QGIS from the following link [8]. Make sure that you choose the latest version that is available. Choose your platform: Windows, Mac OS X, Linux, BSD, or android. If you have windows, check or specifications and either you will use 32 bit or 64 bit. Begin the download by activating the .exe and follow the Installation Wizard to save QGIS to the appropriate directory. Once QGIS is fully installed onto your computer, you can begin by running it.
Starting QGIS
- Open QGIS from your start menu in order to run the software. Make sure to select the Desktop version.
- Once the software is initiated, the QGIS window will appear.
Adding Geospatial Data in QGIS
Vector Data
- To add vector data into QGIS navigate to the toolbar situated at the top of the window, as demonstrated in Figure 4.
- Select the Add Vector Layer icon.
- A window will appear that prompts you to choose your file.
- Toggle on the appropriate source type and set the coding option using the drop down menu.
- Next, browse to the source of your vector file by clicking the Browse button on the window as seen in Figure 6.
*This will bring up the search window.
- Navigate to your folder and change the All Files drop down to ESRI Shapefiles to help narrow your search. If you want to be fast and efficient, you can hold the Ctrl key and select all of the desired files you wish to add. This will save your selection and add all of the files at once rather than you having to continuously clicking on the Add Vector Layer Icon and repeating this process over and over again.
- Your files will appear in the Layer Panel section and the files will be drawn in the white to the right of the Layer Panel.
- If want to look at the properties associated with each layer and change their symbology, right-click on the appropriate file in the Layer Panel as seen in Figure 9. Make sure the layers are in the appropriate order. This can be subjective but in this case you want to make sure buildings, roads, and rails are not under the Carleton Boundary for example.
- To view data associated with your vector layer, select Open Attribute Table.
- A window will open that will provide users with a variety of options associate with the layer as seen in Figure 11. In Properties, you can see the symbology of the layer but selecting the Styles tab. Users are able to change how their data is represented using this tab. Additional tabs such as General, Labels, Fields, Rendering, Display, Action, Joins, and so on which allow users to manipulate their data to their liking.
- Select the General tab in order to view the layers coordinate system and file name.
This is particularly useful whenever you need to georeference a raster file to match the projection of your vector layers.
Raster Data
- To add a raster file into QGIS navigate to the toolbar at the top of the window and select the Add Raster Layer icon.
- Follow the same steps provided for adding a vector file.
Accessing a Plugin
- To access the plugins available in QGIS navigate to the main toolbar near the top of the program and under Plugins select Manage Plugins.
- A window will open providing you with several options for plugins. Scroll through them until you come across Georeferencer DGAL.
- Toggle the Georeferencer DGAL on and you can close the menu.
Using Georeferencer DGAL
The Georeferencer allows you to reference rasters to geographic coordinates or projections by creating a new GeoTiff file by adding a world file to the existing raster image. To reference a raster you are to locate points on the image that you can accurately identify their coordinates. X and Y coordinates can be Degrees Minutes Seconds (dd mm ss.ss), Decimal Degrees (dd.dd) or projected coordinates (mmmm.mm) depending on your data.
Opening the Georeferencer
- Navigate to the main toolbar, and select the Raster Menu. You will notice that Georeferencer can be found at the bottom of the menu. Open the Georeferencer...
- The Georeferencer window will appear and you will be able to add the file you wish to georeference, in our case it is the satellite image of the Carleton Campus.
Adding a Raster
- To georeference your image, you must first add it into the georeferencing window.
- Navigate to the main toolbar of the Georeferencer and select the Add Raster Layer icon.
- Follow the steps provided for adding a vector file to navigate to and add the appropriate raster file.
- Once you find your image and select it to be added, the Coordinate Reference System Selector will pop up. Since the image you are using must be georeferenced, you therefore do not have to select the coordinate system. If you did know what coordinate system your image was in then you will want to select the correct coordinate system.
Adding Control Points
If you already have control points saved, you can load the file by selecting the Load Points icon Otherwise… Select the add control point icon .
- A window will appear prompting you to add the coordinates of the point, or find it on the referenced file within the main window of QGIS.
- If you know the coordinates, enter them. Otherwise select From Map Canvas
- To delete a point, select the Delete Point icon
- You can move points by selecting the Move Points icon on the toolbar.
Zooming In and Out
- To zoom in on the image in the georeferencer window select the Zoom In icon.
- To zoom out on the image in the georeferencer window select the Zoom Out icon.
- To move around the image, select the Pan icon
Points Table
- The points which you have placed on your map image will appear below the raster image in the window.
- To save your points select the Save Points icon on the toolbar.
- This will save your points to an .aux.xml file for later viewing, or to add back into the Georeferencer.
- If the residuals are high for some of your points, you should go back and move the point to be more accurate.
Transformation Settings
To access the transformation settings navigate to the toolbar on the Georeferencer and select the Transformation Settings icon.
After adding the Geographic Control Points (GCPs) you will need to define the settings for the georeferencing procedure.
- Depending on how many points you have added to your image you may want to choose different transformation algorithms for your image.
Transformation Type
Choose an appropriate transformation type.
- The transformation types available to you include:
- Linear: This is used to generate a world-file that will be different from the other algorithms available because it does not actually transform your image. This probably won't be the best option if you are using scanned imagery.
- Helmert: This transformation will run simple scaling and rotation transformations.
- Polynomial Algorithms: These will match source and destination control points. The 2nd order polynomial transformation allows for some curvature in your transformation. Using a 1st order polynomial transformation (affine) will perserve collinearity and will only permit scaling, translation and rotation on the image.
- Thin Plate Spline: This transformation is able to introduce local deformations in the data. This is good if the original image being georeferenced is of poor quality.
- Projective: The projective transformation is a linear rotation and translation of coordinates.
Defining the Resampling Method
- Select one of the resampling method options by clicking on the drop down list. Your choice will vary depending on the objectives of your task.
- Choose one of the following options:
- Nearest neighbour
- Linear
- Cubic
- Cubic Spline
- Lanczos
Compression
- Select the type of compression you wish to occur on your image.
- The options include:
- NONE
- LZW
- PACKBITS
- DEFLATE
Output Raster
- Select the location for the output file by selecting the Output Raster icon and navigating to the appropriate folder.
Target Spatial Reference System (SRS)
- Choose the target coordinate system for your raster image by clicking the Target SRS icon [[9]]
- A window will appear prompting you to choose a coordinate system for your image.
Generating a pdf map and report
- To save a map or report to disk as a .pdf file, select the .pdf document icon next to Generate pdf map and/or Generate pdf report.
- Navigate to the appropriate directory to save your files.
Set Target Resolution
Toggle on Set Target Resolution to set the pixel resolution for your output raster.
Additional Options
- Toggle on Use 0 for transparency when needed to make areas with the value of 0 transparent.
- Toggle on Load in QGIS when done to add the image into QGIS as a layer whenever the georeferencing process is complete.
- Toggle on Create world file for linear transformations.
Select OK when complete.
Running the Georeferencer
Once all of the GCPs have been added and the Transformation Settings have been selected you can now georeference your raster image.
- Select the Start Georeferencing icon on the main toolbar.
- This will create a new georeferenced image.
Georeferenced Raster
- QGIS will prompt you to add the new georeferenced raster into your map document. The file will appear in the Layers Panels. Move your layers so that the vector polygon layers appear on top of the raster image.
- There you have it, a fully georeferenced image of the Carleton University Campus with Vector Data Associated with it.
- Hope you took something from this tutorial.
Terms
GNU GPL
The GNU General Public Licence is a widely used free software license that allows users of the software the liberty to use, study, share and modify the software. [10]
C++
C++ Language is an open ISO-Standardized language and is a compiled language. It supports both manifact and inferred typing as well as both static and dynamic type checking. It is able to run on many different platforms and has a large support library for help. [11]
Python
Python programming language runs on a variety of platforms and is free to use since it is an OSI-approved open source license. [12]
Vector Data
Vector Data is a coordinate-based representation of geographic features by way of points, lines and polygons. An individual point feature is represented as a singular point pair whereas ordered lists of vertices represent polygon and lines. Attributes as associated with each feature in vector data. [13].
Raster Data
Raster data represents space as a grouping of equally sized cells that are organised in rows and columns that are made up of singular or multiple bands. Each of these cells contains both an attribute value and coordinates. Similar cells represent the same type of feature and coordinates are stored in the ordering of the matrix. Rasters can be digital aerial photographics, satellite imagery, digital pictures or scanned map and can be either thematic (discrete) or continuous [14]
References
52°North Initiative for Geospatial Open Source Software. (2013). ILWIS Open. Retrieved December 10, 2013, from 52°North: http://52north.org/communities/ilwis/ilwis-open
cplusplus.com. (2013). Information on the C++ language. Retrieved December 10, 2013, from cplusplus: http://www.cplusplus.com/info/
esri. (2013). GIS Dictionary. Retrieved December 10, 2013, from esri support: http://support.esri.com/en/knowledgebase/GISDictionary/term/vector
ESRI. (2008, September 22). What is a raster data? Retrieved December 10, 2013, from ArcGIS 9.2 Desktop Help: http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=What_is_raster_data%3F
Geomatics Solutions. (2011). NAD83 / MTM zone 9. Retrieved 2013, from Georepository: http://georepository.com/crs_32189/NAD83-MTM-zone-9.html
GNU. (2013, September 12). GNU General Public License. Retrieved December 10, 2013, from GNU Operating System : https://gnu.org/licenses/gpl.html
Python Software Foundation. (2013). Python Programming Language – Official Website. Retrieved December 10, 2013, from Python: http://python.org