Georeferencing Raster Imagery in SAGA GIS

From CUOSGwiki
Jump to navigationJump to search

Introduction

Geo-referencing

Figure 1: Geo-referencing


Much of the raster data in the world can be geo-referenced, which indicates the importance of geospatial big data handling. Source These datasets are traditionally collected using ground surveying, photogrammetry, and remote sensing, and more recently through laser scanning, mobile mapping, geo-located sensors, geo-tagged web contents, volunteer geographic information (VGI), global navigation satellite system (GNSS) tracking and so on. Raster data produced by scanning aerial photographs, toposheets, or print maps normally do not contain any spatial reference information as they are made up of pixels. In addition, satellite images may inherit some un-systematic errors making its location shifted to the original XY-location. Source Georeferencing rasters is a common and important task in the field of geospatial analysis, especially when working with historical imagery or maps. The process usually consists of aligning geographic data to a known coordinate system so it can be viewed, queried and analyzed with other geographic data. For instance, geo-referencing is useful to calculate the exact area or extent of a raster dataset. Georeferencing may involve shifting, rotating, scaling, skewing, and in some cases warping, rubber sheeting, or ortho-rectifying the data. Source The most visible effect of georeferencing is that display software can show ground coordinates (such as latitude/longitude or UTM coordinates) and also measure ground distances and areas.


This tutorial contains an introduction to the process of georeferencing imagery in the SAGA GIS software, as well as information on the fundamentals of the georeferencing process. It evaluates the interest and scope of document georeferencing with an example using absolute geo-referencing (image to map rectification) of google earth, topo-sheets and grown control point.

Coordinate Systems
Figure 2: Geographic Coordinate System


Locations on the earth’s surface are measured in terms of coordinates, a set of two or more numbers that specifies a location in relation to a reference system, the graticule grid. The graticule specifies positions on the globe with latitude and longitude coordinates. The graticule refers to longitude and latitude on a three-dimensional globe. The graticule is based on an east-west scale called longitude and a north-south scale called latitude. When we use longitude and latitude on a two-dimensional map, we refer to these as geographic coordinates. Source

Projections
Figure 3: Datum


The term “map projection” refers to both the process and product of transforming spatial coordinates on a three-dimensional sphere into a two-dimensional plane. Most projections use mathematical functions that take as inputs locations on the sphere and translate them into locations on a two-dimensional surface. Source Since the earth is not a perfect sphere, it is not a straightforward process to project a map onto the earth’s surface or transfer an object onto the surface. Projections are designed such that one or more of these properties suffer little to no distortion. Four properties that can be distorted in the process include area, shape, distance and/or direction. It is helpful to think about projections in physical terms. Simply put, the globe is far more accurate than a map to represent the features on the surface of the world. Projections can be envisioned as a large piece of ‘photographic’ paper wrapped around a globe. A light inside the globe is turned on and features on the surface of the globe are projected onto the photographic paper. The photographic paper generally takes 3 shapes: cylinder, cone or just left flat. These three shapes are known as developable surfaces because they can be (unwrapped) laid flat without tearing or distortion. Deciding which projection is best requires that you consider which property is to be preserved and the location (primarily latitude) of the area of interest. Cylindrical and conic projections are most common. Source A cylinder will touch (be tangent) along the equator and is thus best suited to equatorial regions of the world. A cone will rest on the globe at mid-latitude. Thus it is well suited to countries in the mid-latitudes and especially those with a wide east-west dimension (i.e. Canada, China). Two important projection types are conformal and equal-area. Each of these two projection types is suited to particular uses. Conformal maintains shape and direction and is well suited to navigation. Equal-area is obviously well suited to uses where area calculations (i.e. the absolute size of polygons) or density values (i.e. the number of trees per hectare) are being analyzed Source

Figure 4: Planar, conical, and cylindrical projections

Datum

Datum is a reference surface used to generate coordinates (i.e. latitude and longitude). Latitudes and longitude are angular measures, given in degrees. Although latitudes/longitudes are really determined from the surface of the earth, it is easier to imagine yourself in the centre of the world looking out at the earth’s surface. Source As mentioned, the world is not a perfect sphere: It’s more of an ellipsoid. It is easy to determine the latitudes and longitudes (the graticule) for a sphere. Figuring out the graticule on an ellipsoid is a manageable task, but determining the graticule on the irregular geoid is very complicated. Each part of the world uses its own ellipse. The ellipse used and how it is anchored to the earth is what is known as datum. Datum is the choice of ellipsoid to use. As the graticule (latitude/longitude) varies from ellipsoid to ellipsoid, changing datums will change the coordinates of a feature on the earth’s surface Source Therefore, when features from different maps are combined onto one map (i.e. for an analysis in GIS) it is essential that the maps be of the same datum.

SAGA GIS

Figure 5: SAGA GIS Logo

For the following tutorial, System for Automated Geoscientific Analyses, or SAGA GIS software will be used. SAGA GIS is a free, open-source geographic information system program, originally developed by a small team of researchers from the Department of Physical Geography in the University of Gottingen, Germany. When the SAGA GIS team began development in 2001, the purpose of the software was aligned with the needs of the development team, such as the analysis of raster imagery, with a focus on digital elevation models (DEM). SAGA has also been designed for an easy and effective implementation of spatial algorithms. Over the years, however, the software has broadened in scope, as it has seen many feature contributions from its world-wide user community. Interestingly, the users have freedom of improving the program, modifying it and releasing the improvements to the public. This resulted in a comprehensive, growing set of geo-scientific methods combined an easily approachable user interface with many visualization options. The software is available for Windows, Linux, and FreeBSD operating systems. Source


Features

  • Object oriented system design (C++)
  • Modular structure allows framework independent function development
  • SAGA API with immense support for geodata handling
  • GUI for intuitive data management, analysis and visualization
  • Runs on Linux as well as on Windows operating systems
  • Portable software running without installation even from memory sticks (MSW)
  • Free and Open Source Software (FOSS)
  • Scripting via command line, Python, Java, R
  • Far more than 450 freely available functions for geodata analysis
  • Georeferencing and cartographic projections
  • Grid interpolation of scattered point data, triangulation, IDW, splines, ...
  • Vector tools: clipping, buffer zones, raster to vector conversion, ...
  • Image analysis: filters, supervised classification, PCA, FFT, OBIA, ...
  • Geostatistics: GWR, variograms, ordinary & universal Kriging, ...
  • Terrain analysis: morphometry, hydrology, illumination, classification, ...
  • and many more ...


Figure 6: Capablities of SAGA GIS


Installation Instructions

The latest version of SAGA GIS can be downloaded on the SAGA GIS Sourceforge page. At the time of writing, the latest version of SAGA GIS is 6.4.0. Documentation for the SAGA GIS tool library can be found in the SAGA-GIS Tool Library Documentation

Data Acquisition

For the following tutorials, you will need to acquire raster data from two sources: Satelite imagery from Google Earth, and a PDF topo-sheet/scanned print map.


Figure 7: Google Earth logo


For the first example, we will be using imagery from Google Earth.Google Earth is a popular software to view world satellite image. It allows you to save and print higher resolution images and it is available for free download here: https://www.google.com/earth/download/gep/agree.html. Use your email address and the key GEPFREE to login to obtain this imagery.

For more imagery

If you do need to purchase imagery, you can try contacting some of the data providers. Here are a few address to start with, but there are others, try doing an internet search for satellite and aerial imagery:


Perform the following steps:

  1. Ensure that you have downloaded and installed Google Earth on your computer
  2. Open Google Earth, and zoom to the area of interest of your choice. For this tutorial, we used the area around the Smithsonian Museum of Natural History in Washington, DC, USA, but you may also pick the location of your choice.
  3. In the Layers menu in the bottom left corner of your screen, uncheck all layers. Google Earth renders terrain in 3D, and the perspective this creates can distort your exported imagery (See Figure 8).

    Figure 8: Layers Menu of Google Earth


  4. Ensure that your imagery is north-facing and vertically-angled by selecting View -> Reset -> Tilt and Compass in the menu bar at the top of the screen (See Figure 9)

    Figure 9: Resetting the Angle and Rotation of Google Earth


  5. Under Tools -> Options, ensure that under Show Lat/Long, Universal Transverse Mercator is selected.
  6. Using the Add Placemark tool (See Figure 10), add four or more placemarks to your screen. make note of their coordinates and label them numerically. change their icon to one that is more precise, location-wise.

    Figure 10: Adding Placemarks in Google Earth


  7. At any moment, you may change a placemark. To move or edit a placemark: In the left panel under My Places, right-click the placemark you want to move.
  8. Click Properties. A yellow, blinking placemark box will appear.
  9. Drag the placemark to a new location.
  10. In the Edit Placemark dialog, you can edit other placemark info like description, style, and color.
  11. Click OK.

    Figure 11: Editing Placemarks in Google Earth


  12. Once you're ready, save your image by selecting File -> Save -> Save Image in the menu bar at the top of the screen. then, press the Save Image Button (See Figure 12).

    Figure 12: Saving Your Image

Print Map

For the second example, we will be using a scan of a historical watershed boundary map of Alberta, made available through the Open Government License. the following pre-tutorial steps must be performed:

  1. Download the file from the following link. you can use any other PDF or raster map as long as it contains some sort of absolute location information.
  2. If necessary, convert the PDF to a raster TIF file. many free websites exist to perform this conversion, such as PDFaid.com. Ensure that the conversion is performed at a high enough DPI that all text is legible. for this tutorial, we chose 150 DPI.
  3. Save the converted file in a working directory of your choice.
Figure 13: Sample map

Tutorial

Georeferencing a Historical Map

In the following tutorial, the process of georeferencing a historical map in SAGA GIS will be explained. To begin, we will import the image into SAGA GIS.

  1. In the Tools tab, select Import/Export -> Images -> Import Image. Another way to find any geoprocessing tools in SAGA GIS is to go to Geoprocessing -> Find and Run Tool -> Type Import Image.
  2. In the Image File field, select the historical map you downloaded earlier
  3. In the Options field. select Enforce True Colour
  4. Double click your imported file in the Data Tab in order to view the file.

    Figure 14: Importing Imagery into SAGA GIS


Creating Ground Control Points

Figure 15: Ground Control Points


In order to georeference an image, we use Ground Control Points (GCPs). These are points that establish a relationship between the pixel coordinate system of the raster to a coordinate system of the earth. The connection between these points is said to be a Link: the complexity of the image will define how many numbers of links are needed to rectify the image. To get the best results, one must georeference the image to the highest resolution. It will facilitate the process of shifting the raster datasets from its original location to spatially corrected location. Also, Adding more control points can increase the overall accuracy of a geo-referenced image transformation. Source GCPs are typically placed at sharp features such as intersections or easily visible landmarks, but for this map, we will use sections of the map graticule with known coordinates.

  1. To start creating the GCPs, we will run the Create Reference Points module. in the Tools tab, select Projection -> Georeferencing -> Create Reference Points [Interactive]'.
  2. Click the Okay button in the pop-up menu. this module creates a shapefile with two attribute fields, used to store the latitude and longitude of a point.
  3. Zoom to an area of the imported file with known coordinates, such as the intersection of two known graticules (See Figure 16)

    Figure 16: Initial GCP Location


  4. Select the Action button (See Figure 17), and click the location of your first GCP. in the pop-up window, enter the x and y (in Decimal Degrees) coordinates of that point.

  • Note the coordinates of this intersection is in DDMMSS (116 °00’, 54°30’). You can convert degrees, minutes, seconds for both latitude and longitude to decimal degrees. To calculate decimal degrees, we use the DMS to decimal degree formula below:
First of all let's take a look at the symbols: 
° : degree 
' : minute 
" : second 
1 minute is equal to 60 seconds. 
1 degree is equal to 1 hour, that is equal to 60 minutes or 3600 seconds. 
DDlat = 116 °00’
DDlong = 54°30’ 
Decimal Degrees = degrees + (minutes/60) + (seconds/3600) 
DDlat = 116 + (0/60) + (0/3600) 
DDlong = 54 + (30/60) + (0/3600)
(X,Y) = (116.0, 54.5)



Figure 17: Action Button



  1. Repeat this process at least four more times, each with a different point. Once you have completed this, end the module by selecting Geoprocessing -> Create Reference Points [Interactive] in the menu bar at the top of the screen (See Figure 18).

    Figure 18: Ending a Module


  2. After adding the GCPs to the image, you can have a look at the added GCPs and the pixel coordinates associated with them. Go to the data tab -> Right click on the Reference Point (Origin) layer -> Attributes -> Show

    Figure 19: GCPs attribute table


  3. If at any time you need to edit, save or delete any Control Points collected, this can be done by accessing the View Link Table button on the Georeferencing taskbar (highlighted in red below). This table displays the Control Point(s) information as well as the Transformation and Auto-Adjust options which control how the raster image responds to the addition of control points. Each line represents a Control Point, a link between the raster image and the digital map data. Both the Source and Map Points can be edited by double-clicking on the values in the table. Clicking on the Save button allows the points table to be saved as a text file while the Load button allows for a set of control points stored in a text file to be loaded and edited. Saving a text file of your control points is strongly recommended. For images requiring many control points to georeference, periodically saving your control points to a text file allows you to come back to your work in case you are not able to finish it in one session.

Defining Projection

We must now add projection information to the image.

Use the Zoom Tool to find the coordinate system of the map on the image. It is usually found near the scale bar on the left bottom of a map or in the right margin. According to our map, the projection used is NAD 1927 UTM.

  1. Open the Set Coordinate Reference System module. in the Tools tab, select Projection -> Proj.4 -> Set Coordinate Reference System. Select the User Defined field, and in the popup menu, change the Projection Type field to Universal Transverse Mercator (UTM). in the Predefined Datum Field, select North_American_Datum_1927. In the popup menu, press Okay. (See Figure 20)

    Figure 20: Setting a Coordinate System


  2. In the module menu, under the Data Objects section, select the Grids Field. A popup menu will open up. Select your image file and click the > button to transfer it to the right side of the popup menu. Click Okay to finish. (see Figure 21)

    Figure 21: Selecting a grid in the Data Objects Menu


Georeferencing the Grid

We now possess all the necessary components to Georeference the map.

  1. Open the Rectify Grid module. in the Tools tab, select Projection -> Georeferencing -> Rectify Grid.

  2. In the Reference Points (origin) Field, select your generated GCP shapefile. in the Grid System Field, select the grid system of your imported map. In the Grid field, select your imported image (make sure it is the one that you defined a projection for). In the Method field, select Automatic (these choices will be explained in the following tutorial). in the Resampling field, select Nearest Neighbour.

  3. A popup menu will open up. set the Cell Size field to 1 (or whatever resolution you desire).

  4. In the popup menu, press Okay

  5. To save your georeferenced image, in the Data tab, right click the image and press Save As.
  6. Select the toposheet under the data list. Go to the description and look for the entry next to Projection. You’ll see that the projection system is now assigned.

  7. Once completed, a new toposheet will appear in the data list. To open it, double-click on it. As you move your cursor on the map you should see that the Lat/Long values have changed to real-world values.

Congratulations, you have just georeferenced a map in SAGA GIS!

Then you can load this image and use it to determining the precise situation occupied by a given object in space, according to its latitude, longitude, and height coordinates. Now that georeferencing is enabled in your map, you may digitize features into layers and it will store information that describes their mapping onto a geographic coordinate system of latitude and longitude. Since all design layers will have the same georeferencing information, you may edit each design layer, if needed and perform a geospatial analysis.

Georeferencing Google Earth Imagery

The process for georeferencing google earth imagery is very similar to georeferencing a historical map or topo sheet. The main differences are as follows:

  • Instead of using graticles for the GCP locations, use the points you created in google earth when collecting the image
  • Google earth uses the WGS84 Datum and the Equidistant Cylindrical (Plate Caree) Projection. Make sure to use these when defining a projection.
  • Google Earth imagery is NOT orthorectified. If you have any points of known location you can use as GCPs, you may want to, as well as a comparison with LANDSAT imagery if possible.


  1. Open your saved image into SAGA software, for that go to File> Open. Change the file type to All files, then select your Google Earth image. In our case file name is “Georefrence.jpg”.

  2. Now select the Thumbnail image and click on Add to Map'. The image will be displayed on the Map window.

  3. The image is missing the projection coordinate system, if you click on the description tab you will notice that. Google Earth is on WGS 84 projection.

  4. Click on the Geoprocessing > Projection > Georeferencing > Create Reference Points'. Then Create Reference Points window Opens, click Okay to edit the GCP (Ground Control Points).

  5. Select the Action button and click on a reference point that is on the image. Create Reference point window opens, fill X and Y value using the list for the 4 placemarks you added in Google Earth. Note, X is the longitude and Y is the latitude and then Press Okay to register the point. If you notice on the description tab, you will see registered coordinates. Do this for your 3 other points.

  6. To assign the coordinate system, first of all, check off the “Create Reference Points” and then press Okay. Now, go to the Projection > Set Coordinate Reference System. As we have already taken the WGS 84 coordinate system, you just need to assign the GRID object. Select the Georeference file that we are working on this tutorial, then press Okay.

  7. Now we need to rectify the image.Go to Geoprocessing > Georeferencing > Rectify Grid. Select the “reference points” under Reference Points (original) and under the Grids assign both the column. You can select the sampling technique. Then press Okay, which will add the new rectified image on the manager window.

You will notice the new image is added on the Manager window, right-click the image and click Add to Map. This is your rectified georeferenced image.

Transformations and Interpolation

Transformations

Because images obtained from aerial photography may be distorted, often it is necessary to apply a Transformation during the georeferencing process. The relevant coordinate transforms are typically stored within the image file (GeoPDF and GeoTIFF are examples), though there are many possible mechanisms for implementing georeferencing. Different transformations are available at the following transformations are available in SAGA GIS.

Figure 22: Transformations
Triangulation

There is no documentation as to which transformation this represents located anywhere online or otherwise

Spline

Spline transformations are optimized for local accuracy at the expense of global accuracy. In a spline transformation, source and target control points are mapped to each other exactly, while pixels that are further away have greater chance of inaccuracy.

This transformation, known as a "rubber sheet" transformation, is of greatest use when the exact location of certain points is of high importance.

Spline transformations require a minimum of 10 GCPs, and adding more points increases the accuracy of a spline transformation

Affine

Affine is a linear transformation that can scale, translate, rotate, and skew an image. An affine transformation generally maintains straight lines, with squares and rectangles becoming parallelograms.

An affine transformation requires at least 3 GCPs, with each additional GCP introducing additional error. However, inaccurate positioning of GCPs has a greater impact on inaccuracy than additional GCPs, therefore more than 3 GCPs should be used.

First Order Polynomial

This option represents similarity transformations, which are similar to affine transformations in that they are linear, 1st order transformations. however, unlike affine translations, similarity transformations are unable to either independently scale the axis or apply any skew. This is useful for the digitization of "as built" schematics.

A similarity transformation requires 2 GCPs. Additional GCPs will produce RMS error

Second Order Polynomial

Second order polynomial transformations, or quadratic transformations, begin to introduce curvature into the shape of the transformed image a 2nd order polynomial transformation applies a simple global curvature to the raster. Source

A second order polynomial requires 6 GCPs

Third Order Polynomial

Third order polynomial transformations, or cubic transformations, introduce more complex curvature into the shape of a transformed rasterm citation.

A third-order polynomial transformation requires 10 GCPs.

Polynomial, Order

This setting allows you to input a custom order for your polynomial transformation, increasing the complexity of the curve produced

Resampling

When a geometric transformation is applied to a raster, the cells of the input and output rasters rarely line up. To assign values to each output cell, an interpolative algorithm is applied to the input raster, which then assigns values to the initially-empty cells of the output raster. There are 4 methods of interpolation available for resampling in SAGA GIS.

Nearest Neighbour

Nearest Neighbour assigns to the cell of the output raster the closest cell on the input raster to the corresponding output raster cell.

Values in the input raster directly correspond to values in the output raster. there are no changes made to any input raster values.

This method is suitable for nominal and ordinal data, as if the input raster is entirely integer, so too will the output raster. As such, catergories and classes are maintained

Bilinear Interpolation

Bilinear interpolation assigns to the output raster the average of the 4 nearest cells on the input raster to the corresponding output raster call. the average value is weighted to account for distance, with closer cells having relatively more influence than more distant cells.

Bilinear interpolation is valuable for continuous data as it produces a much smoother surface than Nearest Neighbour or Bicubic Spline interpolation.


Bicubic Spline Interpolation

Bicubic Spline interpolation, also known as cubic convolution, assigns to the output raster the distance-weighted average of the nearest 16 cells of the input raster to the corresponding output raster cell.

As more cells are included in the weighted average, the results are sharper and therefore more suited to satelite and aerial photography.

For the same reasons as Bilinear Interpolation, Bicubic Spline interpolation should not be used for categorical data.

Source.

B-Spline Interpolation

B-spline interpolation makes use of a sequence of increasingly fine-scale bicubic functions to approximate the function of a single B-spline function. This functions similarly to B-spline interpolation, but is more computationally efficient. Source

Summary

In this exercise, you applied many well-distributed control points of previously known locations to georeference an image that did not have geospatial information embedded in it. It allowed you to define the existence of a raster image in relation to physical geographic space, making it eligible for geospatial analysis. You also learned how rectification, also known as geo-referencing, works and how the alignment of an image is made using location coordinates in a spatial referencing system. Sometimes, the when an image does not properly align with other data and requires a transformation in order to be used in conjunction with existing data. Now that you are familiar with this technique, you should study the effects of various transformations available in SAGA GIS and learn how to save georeferencing information with the raster or as control points in a text file for reuse. We hope that this practical case taught you the importance and relevance of this geoprocessing technique to contemporary applications in cartographic and photographic management.