Difference between revisions of "Georeferencing Raster Imagery in QGIS using Vector Data"

From CUOSGwiki
Jump to navigationJump to search
 
(121 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==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.
+
The purpose of this tutorial is to learn how to conduct a georeferencing process on a non-georeferenced air photo in QGIS. In doing so, you will also gain knowledge on navigating through, and working with, the QGIS environment. For the purpose of this tutorial, a basic understanding of GIS is assumed.
   
 
==Introduction==
 
==Introduction==
===QGIS===
+
===QGIS: An Introduction===
[[File:QGIS-Logo.png|thumb|left|alt=QGIS| QGIS ''[[http://www.gfosservices.it/wp/wp-content/uploads/2011/02/QGIS-Logo.png]]'']]
+
[[File:QGIS-Logo.png|thumb|right|alt=QGIS|Figure 1: QGIS Logo]]
  +
<p>QGIS is an open-source GIS Software initially created in 2007 as Quantum GIS by the Open Source Geospatial Foundation under GNU license. Open-source means the program is free to use, and the code used to make it is freely accessible. The software GUI contains many of the same geoprocessing and cartographic tools as well-known ArcGIS, along with an extensive Python library that can be used to automate processing. Other open-source software packages are also integrated into the QGIS environment, such as: SQLite, GDAL, PostGIS and PostgreSQL, while others such as GRASS and MapServer work directing in conjunction with QGIS. The programs runs on Mac OS, Linux, UNIX, Android, and Microsoft Windows. </p>
<p>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. </p>
 
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===
 
===Georeferencing===
<p>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.</p>
+
<p> When data is collected via a remote sensing platform, whether that be a camera in a plane, or a thermal sensor in a satellite, the data collected must be aligned to real-world locations in order to be useful. Geo-referencing in GIS allows the user to do just this, using a known coordinate system and known points on the ground to align remotely sensed data so that it may be viewed, queried or analyzed with other geospatial data. These reference points are known as ground control points, or GCPs, and are stored in the metadata of .tif raster files once created. Creating GCP's allows GIS software to transform the data into different geographic referencing systems by shifting, scaling, rotating or skewing the imagery. </p>
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.[http://52north.org/communities/ilwis/ilwis-open]
 
   
 
==Acquiring Data==
 
==Acquiring Data==
Supplementary geospatial data can be downloaded from Geobase [http://www.geobase.ca/geobase/en/] or the Geoconnections Discovery Portal online [http://geoconnections.nrcan.gc.ca/home]
 
   
  +
Before beginning to acquire the data necessary for this exercise, it is best to create a folder to organize all of your project elements into. Somewhere on your computer that is easy to access (preferably in your C: drive on windows, or HOME directory on Linux), create a folder named ''Georeferencing Exercise'''. This will be the location where we store all our data, as well as the QGIS project files. [[File:GeoreferencingRasterImageryinQGISusingVectorData(figure2 edit dylan).png|400px|thumb|right|Figure 2: Location of 1933 air photos used in this tutorial]]
<i>The files used for this example include the following and can be found here [https://library.carleton.ca/find/gis/geospatial-data/carleton-campus-gis-datasets], while the Satellite Imagery of Carleton can be found here [https://library.carleton.ca/find/gis/geospatial-data/carleton-campus-aerial-images]: </i>
 
   
  +
The 6 air photos used for this example can be found here: [https://library.carleton.ca/find/gis/geospatial-data/carleton-campus-aerial-images]. At this link, scroll about a third of the way down to the section labelled '''Available Themes'''. Select the bottom-most link '''1930s - 1945 air photos from uOttawa'''. Refer to ''Figure 2'' to visualize the locations of the desired photos. Click the dot, then the link that appears. Once on a screen with the photo as per figure 2, right click the photo and select ''Save Image As...''. Save it to the folder made earlier. Repeat this step for all 6 of the photos circled in red in figure 2.
{| border="1" cellpadding="5" cellspacing="0" align="center"
 
|+'''Table 1. Data Used in Geo-referencing Aerial Photography and Satellite Imagery'''
 
|-
 
! style="color:#000000; background:#C2D5FF;" | Data Used
 
! style="color:#000000; background:#C2D5FF;" | Data Format
 
! style="color:#000000; background:#C2D5FF;" | 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)
 
|-
 
|}
 
   
  +
In terms of reference vector data, study the image selected and locate as much reference vector data as possible. This includes roads [https://open.ottawa.ca/datasets/ottawa::road-centrelines/explore?location=45.245509%2C-75.794650%2C2.14](select the ''shapefile'' option), the rail lines [https://open.ottawa.ca/datasets/ottawa::railway-lines/explore?location=45.289053%2C-75.650256%2C1.87] (again, select the ''shapefile'' option), the Rideau river [https://library.carleton.ca/find/gis/base-layers], the Rideau Canal [https://library.carleton.ca/find/gis/base-layers], and city sidewalks [https://open.ottawa.ca/datasets/ottawa::sidewalks/explore?location=45.383904%2C-75.695046%2C7.14] (once again select ''shapefile''). Download these vector datasets, and extract them into your project folder made earlier.
<br>
 
   
  +
Since these particular photos were taken in 1933, there will be sections of the vector data that do not exist in the image, but do not let this discourage you, as the sections that do will still be accurate, though created over 80 years later.
[[File:Data_Set.PNG‎|thumb|centre|alt=Figure 1.| Figure 1. Data Set.]]
 
* 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 of QGIS==
  +
You can download QGIS from the following link [http://www.qgis.org/en/site/index.html] using the green '''Download Now''' button. Choose your platform: Windows, Mac OS X, Linux, BSD, or Android from the various drop-down menus on the download page (Windows will be used for this tutorial). If you have Windows, check your specifications, as either you will use 32 bit or 64 bit. Select the latest standalone version and download the .exe installer. Once downloaded, go to the location the .exe installer downloaded to, run it, and use the Setup Wizard that appears to configure the program.
   
  +
Once QGIS is fully installed onto your computer, run it either via the desktop icon, or the start-menu launcher. Once opened, a program window like figure should appear. To create a project file for our project, click ''Project'' in the upper left corner, and ''Save As''. Browse to the folder created in the earlier step, give the project a name, like '''Georeferencing Tutorial''', and hit ''Save''.
   
  +
==Adding Reference Vector Data into QGIS==
<br>
 
  +
[[File:addVector.png|200px|thumb|right|Figure 3: The file browser in QGIS]] The easiest way to add our reference vector data into the QGIS is by using the '''Browser'''. On the middle-left, as per ''Figure 3'' is a window containing various programs data can be added from. We are most concerned with the '''Project Home''' link near the top of this section. Click the drop down arrow to the left of this label. You should notice all of the vector files downloaded earlier listed here. Double-click the ''canal.shp'', ''Railway_Lines.shp'', ''rideau_river.shp'', ''Road_Centerlines.shp'', and ''Sidewalks.shp'' files to add them to our QGIS session. If by happenstance your vector files are not in '''Project Home''', simply browse to where you unzipped your vector data via the drop-downs from your main hard drive, in the case of Windows: ''C:/''. You may also find it helpful to add a base map image to the project, if you have any of these pre installed, they will be located in the browser under the ''XYZ Tiles'' menu. If there is nothing under this menu, find out how to add these in by following the instructions here: [https://opensourceoptions.com/blog/how-to-add-google-satellite-imagery-and-google-maps-to-qgis/]
   
  +
==Accessing the Georeferencing Plugin==
==Installation==
 
  +
The georeferencing tool in QGIS comes installed with the program, but is not visible by default. To use it, we must activate the plugin.[[File:Plugins1.png|thumb|left|160px|alt=Figure 4.| Figure 4: Available Plugins.]]<br>
[[File:QGIS_Link.PNG‎|thumb|left|alt=Figure 2.| Figure 2. Download ''[[http://www.qgis.org]]''.]]
 
  +
*To access the plugins manager, select <b>Manage Plugins</b> under the '''Plugins''' drop-down menu on the main tool bar.
You can download QGIS from the following link [http://www.qgis.org/en/site/index.html]. 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.
 
  +
*A window will open providing you with several options for plugins, navigate to the '''Installed''' subsection as per ''Figure 4''
  +
*Toggle the Georeferencer GDAL plugin, and close this menu.
   
  +
==Using Georeferencer GDAL==
  +
Now that the Georeferencer plugin is active and our vector data is loaded in QGIS, we can begin to add GCPs to our non-georeferenced .jpg file.
  +
===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... [[File:GeoreferencerMenu.PNG|thumb|right|250px|alt=Figure 5.| Figure 5:. Georeferencer Window.]]
   
  +
The Georeferencer window will appear separate from the main GUI, and will look like ''Figure 5''. It is recommended that both windows be viewed at the same time, so split them across your desktop as best as possible.
   
  +
===Adding a Raster===
   
  +
Navigate to the main toolbar in the Georeferencer window and select the Add Raster Layer icon. [[File:RasterLayerIcon.PNG ]] Navigate to the location of our non-georeferenced .jpg file and add it to the window.
   
  +
===Zooming In and Out===
 
  +
*To zoom in on the image in the georeferencer window select the <i> Zoom In </i> icon. [[File:Zoomin1.png]]
 
  +
*To zoom out on the image in the georeferencer window select the <i> Zoom Out </i> icon. [[File:Zoomout1.png‎]]
 
  +
*To move around the image, select the <i> Pan </i> icon [[File:Pan1.png‎]]
 
<br>
 
 
 
 
 
 
==Starting QGIS==
 
*Open QGIS from your start menu in order to run the software. Make sure to select the Desktop version.
 
[[File:StartingQGIS.png‎|thumb|center|alt=Figure 3.| Figure 3. ''Opening QGIS''.]]
 
[[File:QGIS Interface.PNG‎|thumb|left|alt=Figure 4.| Figure 4. ''QGIS Interface''.]]<br>
 
*Once the software is initiated, the QGIS window will appear.
 
 
 
 
 
 
 
 
 
 
 
 
<br>
 
 
==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. [[File:QGIS Toolbar.PNG|thumb|right|alt=Figure 5.| Figure 5. ''Toolbar'']]
 
*Select the Add Vector Layer icon. [[File:Add Vector Layer.PNG| Figure 5. ''Adding Vector Layer Files]]
 
<br>
 
*A window will appear that prompts you to choose your file. <br>
 
*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.
 
[[File:Vector File Window.PNG|thumb|center|alt=Figure 6.| Figure 6. ''Vector File Window''.]]<br>
 
<p>*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.</p><br>
 
[[File:Browsing Files.PNG‎|thumb|left|alt=Figure 7.| Figure 7. ''Browsing Files''.]]<br>
 
 
<p>
 
*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.</p>
 
 
<br>
 
[[File:Vector Layers.PNG‎|thumb|center|alt=Figure 8.| Figure 8. ''Vector Layers''.]]<br>
 
<p>
 
*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.
 
‎ <br>
 
[[File:Properties2.PNG|thumb|left|alt=Figure 9.| Figure 9. ''Properties''.]]<br>
 
*To view data associated with your vector layer, select <i>Open Attribute Table</i>.
 
[[File:Attribute Table Properties.PNG|thumb|center|alt=Figure 10.| Figure 10. ''Attribute Table Values'.]]
 
 
<br>
 
 
 
 
 
 
 
*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 <i>General, Labels, Fields, Rendering, Display, Action, Joins</i>, and so on which allow users to manipulate their data to their liking.
 
 
[[File:LayerProperties.PNG|thumb|center|alt=Figure 11.| Figure 11. ''Properties and Symbology'.]]
 
<br>
 
 
<br>
 
*Select the General tab in order to view the layers coordinate system and file name. <br> This is particularly useful whenever you need to georeference a raster file to match the projection of your vector layers.
 
[[File:LayerPropertiesGeneral.PNG|thumb|left|alt=Figure 12.| Figure 12. ''General Tab Under Properties''.]]
 
 
 
 
 
 
 
 
 
<br>
 
 
===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. [[File:RasterLayerIcon.PNG]]
 
*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<b> Plugins</b> select <b>Manage Plugins</b>.
 
[[File:Pluggins.png|thumb|left|alt=Figure 13.| Figure 13. ''Plugins Toolbar''.]]
 
*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.
 
[[File:Plugins1.png|thumb|center|alt=Figure 14.| Figure 14. ''Available Plugins''.]]<br>
 
 
==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.
 
[[File:Georeferencer.png|thumb|left|alt=Figure 15.| Figure 15. ''Georeferencer Plugin''.]]
 
<br>
 
 
===Adding a Raster===
 
*To georeference your image, you must first add it into the georeferencing window.
 
<br>
 
[[File:GeoreferencerMenu.PNG|thumb|left|alt=Figure 16.| Figure 16. ''Georeferencer Toolbar''.]]
 
*Navigate to the main toolbar of the Georeferencer and select the Add Raster Layer icon. [[File:RasterLayerIcon.PNG ]]
 
*Follow the steps provided for adding a vector file to navigate to and add the appropriate raster file.
 
[[File:GeoreferencerToolbar.PNG‎|thumb|center|alt=Figure 17.| Figure 17. ''Georeferencer Toolbar''.]]
 
*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.
 
[[File:GeorefCarleton.PNG‎|thumb|center|alt=Figure 18.| Figure 18. ''Raster Image'.]]<br>
 
   
 
=== Adding Control Points===
 
=== Adding Control Points===
<b> If you already have control points saved, you can load the file by selecting the <i>Load Points</i> icon</b> [[File:Loadpts1.png]] Otherwise…
+
[[File:Adding a point.PNG|thumb|right|alt=Figure 6.| Figure 6: Adding GCP window.]] <b> If you already have control points saved, you can load the file by selecting the <i>Load Points</i> icon</b> [[File:Loadpts1.png]] Otherwise…
 
Select the add control point icon [[File:AddIcon.PNG]].
 
Select the add control point icon [[File:AddIcon.PNG]].
* 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.
+
* A window will appear as per ''Figure 6'' 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 <i>From Map Canvas</i>
+
*If you know the coordinates, enter them. Otherwise select <i>From Map Canvas</i>. This will minimize the georeferencer window, leaving the main QGIS window with the vector data opened earlier. Click the location on the vector data that corresponds to the same location in our image. This will save the point as a GCP.
[[File:Adding a point.PNG|thumb|left|alt=Figure 19.| Figure 19. ''Adding a Point''.]]
 
 
*To delete a point, select the <i>Delete Point</i> icon [[File:Deletept1.png‎]]
 
*To delete a point, select the <i>Delete Point</i> icon [[File:Deletept1.png‎]]
*You can move points by selecting the <i>Move Points</i> icon on the toolbar. [[File:Movept1.png]]
+
*You can move points by selecting the <i>Move Points</i> icon on the toolbar. [[File:Movept1.png]] <br>
   
  +
Add the first 4-5 GCPs across the entirety of the image, as per ''Figure 7''. [[File:SomeGCPs.png|thumb|right|alt=Figure 7. | Figure 7: Initial GCPs]] This is to prevent the image from being warped more to one side. Continue to the next steps will these GCPs, as we can come back later to add more if needed.
 
 
 
 
<br>
 
 
===Zooming In and Out===
 
*To zoom in on the image in the georeferencer window select the <i> Zoom In </i> icon. [[File:Zoomin1.png]]
 
*To zoom out on the image in the georeferencer window select the <i> Zoom Out </i> icon. [[File:Zoomout1.png‎]]
 
*To move around the image, select the <i> Pan </i> icon [[File:Pan1.png‎]]
 
   
 
===Points Table===
 
===Points Table===
Line 205: Line 64:
 
* To save your points select the <i>Save Points </i> icon on the toolbar.[[File:Savegcppts.png‎]]
 
* To save your points select the <i>Save Points </i> icon on the toolbar.[[File:Savegcppts.png‎]]
 
*This will save your points to an <i>.aux.xml </i> file for later viewing, or to add back into the Georeferencer.
 
*This will save your points to an <i>.aux.xml </i> 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.
+
*If the residuals are high for some of your points, you should go back and move the point to be more accurate. <br>
 
<br>
 
   
 
===Transformation Settings===
 
===Transformation Settings===
Line 213: Line 70:
 
After adding the <i>Geographic Control Points</i> (GCPs) you will need to define the settings for the georeferencing procedure.
 
After adding the <i>Geographic Control Points</i> (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.
 
*Depending on how many points you have added to your image you may want to choose different transformation algorithms for your image.
[[File:Transformation Settings.PNG|thumb|left|alt=Figure 21. Figure 21. "Transformation Settings"]]
+
[[File:TransSettings2.png|thumb|right|200px|alt=Figure 8. | Figure 8: Transformation Settings]] <br>
<br>
 
 
====Transformation Type====
 
====Transformation Type====
 
<i>Choose an appropriate transformation type.</i>
 
<i>Choose an appropriate transformation type.</i>
Line 240: Line 96:
   
 
====Output Raster====
 
====Output Raster====
*Select the location for the output file by selecting the <i>Output Raster</i> icon and navigating to the appropriate folder.<br>
+
*Select the name and location for the output file by selecting the <i>Output Raster</i> icon, navigating to the appropriate folder and providing a name.<br>
   
 
====Target Spatial Reference System (SRS)====
 
====Target Spatial Reference System (SRS)====
*Choose the target coordinate system for your raster image by clicking the <i> SRS</i> icon [[http://gis.stackexchange.com/questions/12864/georeferencing-with-quantum-gis-and-reprojecting-to-epsg900913]]<br>
+
*Choose the target coordinate system for your raster image by clicking the <i> Target SRS</i> icon <br>
*A window will appear prompting you to choose a coordinate system for your image.
+
*A window will appear prompting you to choose a coordinate system for your image, choose the same as the current project, so the image is projected the same as the reference vector data.
[[File:Quant_Raster_Georef_xy.png|thumb|left|alt=Figure 22. Figure 22. "Choosing a Reference System"]]
 
   
 
====Generating a pdf map and report====
 
====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 <i> Generate pdf map</i> and/or <i> Generate pdf report</i>.
 
*To save a map or report to disk as a .pdf file, select the .pdf document icon next to <i> Generate pdf map</i> and/or <i> Generate pdf report</i>.
 
*Navigate to the appropriate directory to save your files.
 
*Navigate to the appropriate directory to save your files.
[[File: Pdfrep.png|thumb|center| alt=Figure 23.| Figure 23. "pdf Output from Georeferencing"]]
 
   
 
====Set Target Resolution====
 
====Set Target Resolution====
Toggle on <i> Set Target Resolution</i> to set the pixel resolution for your output raster.<br>
+
Toggle on <i> Set Target Resolution</i> to set a custom pixel resolution for your output raster.
   
 
====Additional Options====
 
====Additional Options====
Line 260: Line 114:
 
*Toggle on <i> Create world file</i> for linear transformations.
 
*Toggle on <i> Create world file</i> for linear transformations.
   
  +
For this example, the settings used can be found in ''Figure 8'', the output filename can be whatever you like.
Select <b>OK</b> when complete.
 
  +
Once all the settings are selected, select <b>OK</b> when complete.
   
 
===Running the Georeferencer===
 
===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.
+
Once all of the GCPs have been added and the Transformation Settings have been selected you can now georeference your raster image. [[File:FinishedProduct.png|thumb|right|alt=Figure 9. | Figure 9. The final georeferenced product]]
 
*Select the <i>Start Georeferencing </i>icon on the main toolbar. [[File:Savegeo1.png‎]]
 
*Select the <i>Start Georeferencing </i>icon on the main toolbar. [[File:Savegeo1.png‎]]
  +
*Make sure to check the box to add the image to your project.
 
*This will create a new georeferenced image.
 
*This will create a new georeferenced image.
  +
  +
Your end resultant should look something like ''Figure 9''. If you want to add more GCPs to make your georeferenced image even more accurate, just go back to the Georeferencer window, reference more GCPs, and run the georeferencer again!
   
===Georeferenced Raster===
+
===Conclusion===
  +
Thank you for giving this tutorial a look, and I hope you have gained something from it. Have a look around the rest of this site for excellent open-source related GIS tutorials.
QGIS will prompt you to add the new georeferenced raster into your map document. The file will appear in the <i>Table of Contents</i>. Move your layers so that the vector polygon layers appear on top of the raster image.
 
[[File:Quant Raster georef layer.png|thumb|left|alt=Figure 24.| Figure 24. "Georeferenced Raster with Vector File Overlay"]]
 
 
 
 
 
 
 
<br>
 
 
 
 
<br>
 
 
<br>
 
==Map Design==
 
To produce a map layout additional features can be added to your map document.
 
===Adding a Scale bar===
 
*To add a scale bar navigate to the main toolbar in QGIS and select <i>Plugins</i>
 
[[File:Quant Toolbar.png|thumb|left|alt=Figure 25.| Figure 25. "Toolbar in QGIS"]]
 
* Select <i> Manage Plugins</i>
 
*A window will appear prompting you to choose a plugin. Toggle on <i>Scale Bar</i>.
 
[[File:Quantum_Scale.png|thumb|center|alt=Figure 26.| Figure 26. "Scale Bar Plugin"]]<br>
 
*Now navigate to the main toolbar in QGIS and select <i>Plugins</i>, a list of options will appear in a drop down menu.
 
*Select <i> Decorations</i> and then Scale Bar.
 
[[File:Northscale.png|thumb|left|alt=Figure 27.| Figure 27. "Scale Bar Tool"]]
 
 
*A window will appear with options for the toolbar.
 
*Choose the desirable options and then click <b> OK</b>
 
[[File:Quantum Scale properties.png|thumb|center|alt=Figure 28.| Figure 28. "Scale Bar Options"]]
 
<br>
 
 
<br>
 
 
 
 
 
<br>
 
 
 
 
<br>
 
 
===Adding a North Arrow===
 
*Navigate to the main toolbar in QGIS by following the instructions above.
 
*Toggle on the NorthArrow plugin.<br>
 
[[File:Quantum north.png|thumb|center|alt=Figure 29.| Figure 29. "North Arrow Plugin"]]<br>
 
*Select <b> OK</b> and then navigate to the main toolbar, select <i>Plugins</i> and use the drop down menu to navigate to <i>Decorations</i>.
 
*Select <i>North Arrow</i>
 
*A north arrow will be added to your map document.
 
 
==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. [https://gnu.org/licenses/gpl.html]
 
 
===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. [http://www.cplusplus.com/info/]
 
 
===Python===
 
Python programming language runs on a variety of platforms and is free to use since it is an OSI-approved open source license. [http://www.python.org]
 
 
===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. [http://support.esri.com/en/knowledgebase/GISDictionary/term/vector].
 
   
===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 [http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=What_is_raster_data%3F]
 
 
==References==
 
==References==
  +
<small>
<small>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<br>
 
cplusplus.com. (2013). Information on the C++ language. Retrieved December 10, 2013, from cplusplus: http://www.cplusplus.com/info/ <br>
+
QGIS. (2019) QGIS general information. Retrieved October 2nd, 2019, from: https://qgis.org/en/site/<br>
 
esri. (2013). GIS Dictionary. Retrieved December 10, 2013, from esri support: http://support.esri.com/en/knowledgebase/GISDictionary/term/vector<br>
 
esri. (2013). GIS Dictionary. Retrieved December 10, 2013, from esri support: http://support.esri.com/en/knowledgebase/GISDictionary/term/vector<br>
 
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 <br>
 
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 <br>

Latest revision as of 21:09, 7 October 2022

Purpose

The purpose of this tutorial is to learn how to conduct a georeferencing process on a non-georeferenced air photo in QGIS. In doing so, you will also gain knowledge on navigating through, and working with, the QGIS environment. For the purpose of this tutorial, a basic understanding of GIS is assumed.

Introduction

QGIS: An Introduction

QGIS
Figure 1: QGIS Logo

QGIS is an open-source GIS Software initially created in 2007 as Quantum GIS by the Open Source Geospatial Foundation under GNU license. Open-source means the program is free to use, and the code used to make it is freely accessible. The software GUI contains many of the same geoprocessing and cartographic tools as well-known ArcGIS, along with an extensive Python library that can be used to automate processing. Other open-source software packages are also integrated into the QGIS environment, such as: SQLite, GDAL, PostGIS and PostgreSQL, while others such as GRASS and MapServer work directing in conjunction with QGIS. The programs runs on Mac OS, Linux, UNIX, Android, and Microsoft Windows.

Georeferencing

When data is collected via a remote sensing platform, whether that be a camera in a plane, or a thermal sensor in a satellite, the data collected must be aligned to real-world locations in order to be useful. Geo-referencing in GIS allows the user to do just this, using a known coordinate system and known points on the ground to align remotely sensed data so that it may be viewed, queried or analyzed with other geospatial data. These reference points are known as ground control points, or GCPs, and are stored in the metadata of .tif raster files once created. Creating GCP's allows GIS software to transform the data into different geographic referencing systems by shifting, scaling, rotating or skewing the imagery.

Acquiring Data

Before beginning to acquire the data necessary for this exercise, it is best to create a folder to organize all of your project elements into. Somewhere on your computer that is easy to access (preferably in your C: drive on windows, or HOME directory on Linux), create a folder named Georeferencing Exercise'. This will be the location where we store all our data, as well as the QGIS project files.

Figure 2: Location of 1933 air photos used in this tutorial

The 6 air photos used for this example can be found here: [1]. At this link, scroll about a third of the way down to the section labelled Available Themes. Select the bottom-most link 1930s - 1945 air photos from uOttawa. Refer to Figure 2 to visualize the locations of the desired photos. Click the dot, then the link that appears. Once on a screen with the photo as per figure 2, right click the photo and select Save Image As.... Save it to the folder made earlier. Repeat this step for all 6 of the photos circled in red in figure 2.

In terms of reference vector data, study the image selected and locate as much reference vector data as possible. This includes roads [2](select the shapefile option), the rail lines [3] (again, select the shapefile option), the Rideau river [4], the Rideau Canal [5], and city sidewalks [6] (once again select shapefile). Download these vector datasets, and extract them into your project folder made earlier.

Since these particular photos were taken in 1933, there will be sections of the vector data that do not exist in the image, but do not let this discourage you, as the sections that do will still be accurate, though created over 80 years later.

Installation of QGIS

You can download QGIS from the following link [7] using the green Download Now button. Choose your platform: Windows, Mac OS X, Linux, BSD, or Android from the various drop-down menus on the download page (Windows will be used for this tutorial). If you have Windows, check your specifications, as either you will use 32 bit or 64 bit. Select the latest standalone version and download the .exe installer. Once downloaded, go to the location the .exe installer downloaded to, run it, and use the Setup Wizard that appears to configure the program.

Once QGIS is fully installed onto your computer, run it either via the desktop icon, or the start-menu launcher. Once opened, a program window like figure should appear. To create a project file for our project, click Project in the upper left corner, and Save As. Browse to the folder created in the earlier step, give the project a name, like Georeferencing Tutorial, and hit Save.

Adding Reference Vector Data into QGIS

Figure 3: The file browser in QGIS

The easiest way to add our reference vector data into the QGIS is by using the Browser. On the middle-left, as per Figure 3 is a window containing various programs data can be added from. We are most concerned with the Project Home link near the top of this section. Click the drop down arrow to the left of this label. You should notice all of the vector files downloaded earlier listed here. Double-click the canal.shp, Railway_Lines.shp, rideau_river.shp, Road_Centerlines.shp, and Sidewalks.shp files to add them to our QGIS session. If by happenstance your vector files are not in Project Home, simply browse to where you unzipped your vector data via the drop-downs from your main hard drive, in the case of Windows: C:/. You may also find it helpful to add a base map image to the project, if you have any of these pre installed, they will be located in the browser under the XYZ Tiles menu. If there is nothing under this menu, find out how to add these in by following the instructions here: [8]

Accessing the Georeferencing Plugin

The georeferencing tool in QGIS comes installed with the program, but is not visible by default. To use it, we must activate the plugin.

Figure 4.
Figure 4: Available Plugins.


  • To access the plugins manager, select Manage Plugins under the Plugins drop-down menu on the main tool bar.
  • A window will open providing you with several options for plugins, navigate to the Installed subsection as per Figure 4
  • Toggle the Georeferencer GDAL plugin, and close this menu.

Using Georeferencer GDAL

Now that the Georeferencer plugin is active and our vector data is loaded in QGIS, we can begin to add GCPs to our non-georeferenced .jpg file.

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...

Figure 5.
Figure 5:. Georeferencer Window.

The Georeferencer window will appear separate from the main GUI, and will look like Figure 5. It is recommended that both windows be viewed at the same time, so split them across your desktop as best as possible.

Adding a Raster

Navigate to the main toolbar in the Georeferencer window and select the Add Raster Layer icon. RasterLayerIcon.PNG Navigate to the location of our non-georeferenced .jpg file and add it to the window.

Zooming In and Out

  • To zoom in on the image in the georeferencer window select the Zoom In icon. Zoomin1.png
  • To zoom out on the image in the georeferencer window select the Zoom Out icon. Zoomout1.png
  • To move around the image, select the Pan icon Pan1.png

Adding Control Points

Figure 6.
Figure 6: Adding GCP window.

If you already have control points saved, you can load the file by selecting the Load Points icon Loadpts1.png Otherwise…

Select the add control point icon AddIcon.PNG.

  • A window will appear as per Figure 6 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. This will minimize the georeferencer window, leaving the main QGIS window with the vector data opened earlier. Click the location on the vector data that corresponds to the same location in our image. This will save the point as a GCP.
  • To delete a point, select the Delete Point icon Deletept1.png
  • You can move points by selecting the Move Points icon on the toolbar. Movept1.png

Add the first 4-5 GCPs across the entirety of the image, as per Figure 7.

Figure 7.
Figure 7: Initial GCPs

This is to prevent the image from being warped more to one side. Continue to the next steps will these GCPs, as we can come back later to add more if needed.

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.Savegcppts.png
  • 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. Trans1.png
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.
Figure 8.
Figure 8: Transformation Settings


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 name and location for the output file by selecting the Output Raster icon, navigating to the appropriate folder and providing a name.

Target Spatial Reference System (SRS)

  • Choose the target coordinate system for your raster image by clicking the Target SRS icon
  • A window will appear prompting you to choose a coordinate system for your image, choose the same as the current project, so the image is projected the same as the reference vector data.

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 a custom 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.

For this example, the settings used can be found in Figure 8, the output filename can be whatever you like. Once all the settings are selected, 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.

Figure 9.
Figure 9. The final georeferenced product
  • Select the Start Georeferencing icon on the main toolbar. Savegeo1.png
  • Make sure to check the box to add the image to your project.
  • This will create a new georeferenced image.

Your end resultant should look something like Figure 9. If you want to add more GCPs to make your georeferenced image even more accurate, just go back to the Georeferencer window, reference more GCPs, and run the georeferencer again!

Conclusion

Thank you for giving this tutorial a look, and I hope you have gained something from it. Have a look around the rest of this site for excellent open-source related GIS tutorials.

References

QGIS. (2019) QGIS general information. Retrieved October 2nd, 2019, from: https://qgis.org/en/site/
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