16.3. Georreferenciador
The Georeferencer is a tool for generating world files for rasters. It allows you to reference rasters to geographic or projected coordinate systems by creating a new GeoTiff or by adding a world file to the existing image. The basic approach to georeferencing a raster is to locate points on the raster for which you can accurately determine coordinates.
Feições
Ícone |
Finalidade |
Ícone |
Finalidade |
---|---|---|---|
Abrir raster |
Iniciar georreferenciamento |
||
Generate GDAL Script |
Load GCP Points |
||
Save GCP Points As |
Configurações de transformação |
||
Adicionar Ponto |
Excluir Ponto |
||
Move GCP Point |
Pan |
||
Zoom In |
Zoom Out |
||
Aproximar para camada |
Zoom Last |
||
Zoom Next |
Link Georeferencer to QGIS |
||
Link QGIS to Georeferencer |
Full histogram stretch |
||
Local histogram stretch |
Table Georeferencer: Georeferencer Tools
16.3.1. Procedimento usual
As X and Y coordinates (DMS (dd mm ss.ss), DD (dd.dd) or projected coordinates (mmmm.mm)), which correspond with the selected point on the image, two alternative procedures can be used:
The raster itself sometimes provides crosses with coordinates “written” on the image. In this case, you can enter the coordinates manually.
Using already georeferenced layers. This can be either vector or raster data that contain the same objects/features that you have on the image that you want to georeference and with the projection that you want for your image. In this case, you can enter the coordinates by clicking on the reference dataset loaded in the QGIS map canvas.
The usual procedure for georeferencing an image involves selecting multiple points on the raster, specifying their coordinates, and choosing a relevant transformation type. Based on the input parameters and data, the Georeferencer will compute the world file parameters. The more coordinates you provide, the better the result will be.
The first step is to start QGIS and click on , which appears in the QGIS menu bar. The Georeferencer dialog appears as shown in Fig. 16.23.
For this example, we are using a topo sheet of South Dakota from SDGS. It can
later be visualized together with the data from the GRASS spearfish60
location. You can download the topo sheet here:
https://grass.osgeo.org/sampledata/spearfish_toposheet.tar.gz.
16.3.1.1. Entering ground control points (GCPs)
To start georeferencing an unreferenced raster, we must load it using the button. The raster will show up in the main working area of the dialog. Once the raster is loaded, we can start to enter reference points.
Using the Add Point button, add points to the main working area and enter their coordinates (see Figure Fig. 16.24). For this procedure you have the following options:
Click on a point in the raster image and enter the X and Y coordinates manually, along with the CRS of the point.
Click on a point in the raster image and choose the From map canvas button to add the X and Y coordinates with the help of a georeferenced map already loaded in the QGIS map canvas. The CRS will be set automatically.
Continue entering points. You should have at least four points, and the more coordinates you can provide, the better the result will be. There are additional tools for zooming and panning the working area in order to locate a relevant set of GCP points.
With the tool, you can move the GCPs in both the canvas and the georeferencing window, if you need to correct them.
The points that are added to the map will be stored in a separate text file
([filename].points
) usually together with the raster image. This allows
us to reopen the Georeferencer at a later date and add new points or delete
existing ones to optimize the result. The points file contains values of the
form: mapX, mapY, pixelX, pixelY
. You can use the
Load GCP points and Save GCP points as buttons to
manage the files.
16.3.1.2. Definindo as configurações de transformação
After you have added your GCPs to the raster image, you need to define the transformation settings for the georeferencing process.
Algoritmos de Transformação disponíveis
A number of transformation algorithms are available, dependent on the type and quality of input data, the nature and amount of geometric distortion that you are willing to introduce to the final result, and the number of ground control points (GCPs).
Currently, the following Transformation types are available:
The Linear algorithm is used to create a world file and is different from the other algorithms, as it does not actually transform the raster pixels. It allows positioning (translating) the image and uniform scaling, but no rotation or other transformations. It is the most suitable if your image is a good quality raster map, in a known CRS, but is just missing georeferencing information. At least 2 GCPs are needed.
The Helmert transformation also allows rotation. It is particularly useful if your raster is a good quality local map or orthorectified aerial image, but not aligned with the grid bearing in your CRS. At least 2 GCPs are needed.
The Polynomial 1 algorithm allows a more general affine transformation, in particular also a uniform shear. Straight lines remain straight (i.e., collinear points stay collinear) and parallel lines remain parallel. This is particularly useful for georeferencing data cartograms, which may have been plotted (or data collected) with different ground pixel sizes in different directions. At least 3 GCP’s are required.
The Polynomial algorithms 2-3 use more general 2nd or 3rd degree polynomials instead of just affine transformation. This allows them to account for curvature or other systematic warping of the image, for instance photographed maps with curving edges. At least 6 (respectively 10) GCP’s are required. Angles and local scale are not preserved or treated uniformly across the image. In particular, straight lines may become curved, and there may be significant distortion introduced at the edges or far from any GCPs arising from extrapolating the data-fitted polynomials too far.
The Projective algorithm generalizes Polynomial 1 in a different way, allowing transformations representing a central projection between 2 non-parallel planes, the image and the map canvas. Straight lines stay straight, but parallelism is not preserved and scale across the image varies consistently with the change in perspective. This transformation type is most useful for georeferencing angled photographs (rather than flat scans) of good quality maps, or oblique aerial images. A minimum of 4 GCPs is required.
Finally, the Thin Plate Spline (TPS) algorithm “rubber sheets” the raster using multiple local polynomials to match the GCPs specified, with overall surface curvature minimized. Areas away from GCPs will be moved around in the output to accommodate the GCP matching, but will otherwise be minimally locally deformed. TPS is most useful for georeferencing damaged, deformed, or otherwise slightly inaccurate maps, or poorly orthorectified aerials. It is also useful for approximately georeferencing and implicitly reprojecting maps with unknown projection type or parameters, but where a regular grid or dense set of ad-hoc GCPs can be matched with a reference map layer. It technically requires a minimum of 10 GCPs, but usually more to be successful.
In all of the algorithms except TPS, if more than the minimum GCPs are specified, parameters will be fitted so that the overall residual error is minimized. This is helpful to minimize the impact of registration errors, i.e. slight imprecisions in pointer clicks or typed coordinates, or other small local image deformations. Absent other GCPs to compensate, such errors or deformations could translate into significant distortions, especially near the edges of the georeferenced image. However, if more than the minimum GCPs are specified, they will match only approximately in the output. In contrast, TPS will precisely match all specified GCPs, but may introduce significant deformations between nearby GCPs with registration errors.
Definir o método de Reamostragem
The type of resampling you choose will likely depend on your input data and the ultimate objective of the exercise. If you don’t want to change statistics of the raster (other than as implied by nonuniform geometric scaling if using other than the Linear, Helmert, or Polynomial 1 transformations), you might want to choose ‘Nearest neighbour’. In contrast, ‘cubic resampling’, for instance, will usually generate a visually smoother result.
É possível escolher entre cinco métodos de reamostragem diferentes:
Vizinho mais próximo
Método Linear
Cúbico
Cubic Spline
Lanczos
Definir as configurações de transformação
Existem várias opções que precisam ser definidas para a matriz de saída georreferenciada.
The Create world file checkbox is only available if you decide to use the linear transformation type, because this means that the raster image actually won’t be transformed. In this case, the Output raster field is not activated, because only a new world file will be created.
For all other transformation types, you have to define an Output raster. As default, a new file ([filename]_modified) will be created in the same folder together with the original raster image.
As a next step, you have to define the Target SRS (Spatial Reference System) for the georeferenced raster (see Trabalhando com Projeções).
If you like, you can generate a pdf map and also a pdf report. The report includes information about the used transformation parameters, an image of the residuals and a list with all GCPs and their RMS errors.
Furthermore, you can activate the Set Target Resolution checkbox and define the pixel resolution of the output raster. Default horizontal and vertical resolution is 1.
The Use 0 for transparency when needed can be activated, if pixels with the value 0 shall be visualized transparent. In our example toposheet, all white areas would be transparent.
Finally, Load in QGIS when done loads the output raster automatically into the QGIS map canvas when the transformation is done.
16.3.1.3. Mostrar e adaptar propriedades matriciais
Clicking on the Raster properties option in the Settings menu opens the Layer properties dialog of the raster file that you want to georeference.
16.3.1.4. Configurar o georreferenciador
You can define whether you want to show GCP coordinates and/or IDs.
Como unidades residuais, pixels e unidades de mapa podem ser escolhidos.
Para o relatório PDF, uma margem esquerda e direita podem ser definidas e você também pode definir o tamanho do papel para o mapa PDF.
Finally, you can activate to Show Georeferencer window docked.
16.3.1.5. Executando a transformação
After all GCPs have been collected and all transformation settings are defined, just press the Start georeferencing button to create the new georeferenced raster.