Datums and ellipsoidsUsing GPSMan in graphical modeMapMap background images

Map background images

A map background image can be loaded by selecting either a file or a map background image name. In the case of a file it can be either a file containing an image in a recognized graphics format, in which case it must be geo-referenced, or an image information file that contains geo-referencing information together with the path of the files containing images. Preparing an image information file can be done by using GPSMan in command-line mode: see the description of the georef command.

A map background image name is a user-selected identifier for an image information file. These names are defined or edited from the Definitions menu, and can also be defined when saving a new image information file. Along with the name and the path to the file, a remark can also be saved. The path to the file is only checked when trying to use the name.

GPSMan will automatically detect the kind of file it has to load from when one selects either the entry Map->Background->Load->from file from the Map menu-button (if the main window is the map window), or the entry Load->from file of the Background menu-button (if the main window is the lists window). If the file is an image information file, loading the image and setting up the map window is done without user intervention. It only makes sense to have as background images maps in one of the projections that GPSMan implements.

Tcl/Tk accepts both the GIF and PNM graphics formats. GPSMan tries to load the Img Tcl/Tk library that provides support also for JPEG, TIFF and other formats. This library has two problems when saving an image:

Geo-referencing an image

In order to use a background image GPSMan needs to know how to convert from Earth coordinates (latitude and longitude or grid coordinates) to map image coordinates (in screen pixels). This conversion is done in two steps corresponding to the application of

  1. a projection, that from geodetic coordinates computes Cartesian plane coordinates, and
  2. a coordinates transformation, that from Cartesian plane coordinates computes pixel coordinates. This is needed because the image can be rotated or distorted.
Going from map image coordinates to geodetic coordinates is done by inverting this process.

As most projections and transformations have parameters, they cannot be used before the values of these parameters are known. The usual way to provide them is to place control waypoints on the image, so that the parameters can be computed from the geodetic coordinates and pixel coordinates of the control waypoints. An alternative for some transformations is to have a transformation file either with the parameters values, or with pairs of geodetic/pixel coordinates.

When geo-referencing an image to be loaded from a file in one of the accepted graphics formats, the following information must be known:

If the image is that of a map, the projection and the datum will hopefully be described in it. The corresponding options should be selected from the two menu-buttons at the left on the bottom of the map window, if the map window is the main window, or the Datum and Projection menu-buttons of the map window, if the lists window is the main window. If a transformation file is used, the projection and the datum are selected from a dialog after the file is read.

As to the datum, it must be emphasised that some maps have a cartographic datum (the one used for projecting the map elements) and then one or more sets of grid lines projected using other different datums. The datum to be selected in GPSMan is the cartographic one, not any of those for the grids. On the other hand, if the intersection points of a grid are to be used as control points for geo-referencing the image, the datum for the grid should be used when creating the corresponding waypoints. More information on datums can be found below.

After having selected the projection and datum as described above, geo-referencing proceeds by choosing the coordinates transformation and by giving information from which the parameters of the transformation and possibly of the projection can be computed.

Coordinates transformations

The transformations presently available in GPSman are

The Least Squares fit method can be used to compute the parameters of any of these transformations. Normally this is the method of choice for large scale maps when the projection is not known and there are several (at least 3) control points with known coordinates whose geodetic coordinates and placement in the image are known. If the number of control points is large it may be preferable to create and use a GPSMan Least Squares file instead of placing the points in the image by hand.

This method will change the placement of the control points in the image in order to minimise the deviations for the whole set of points. The following information on the resulting deviations is shown (as an option when a GPSMan Least Squares file is used):

  1. for each control point: name (if it is a waypoint), terrain coordinates, horizontal and vertical deviations, total deviation
  2. root-mean-square deviation: sqrt(s/(2*n)), where s is the sum of the squared deviations (also known as residuals or errors)
  3. standard residual error (a statistical measure of how good is the fit): sqrt(s/f), where f is the number of degrees of freedom, given by twice the number of points minus the number of parameters.
It is suggested that this data is taken into account in trying to increase the quality of the fit by eliminating control points whose deviation is too large.

Geo-referencing can also be done with a certain number of control waypoints that will be placed at fixed positions in the image. These waypoints can either be selected from the ones already defined, or be defined when geo-referencing the image; in the latter case only the name and position will be asked for, and if no name is given one is automatically generated. If they are defined beforehand it is a good idea to use either no symbol, or to use the Mark, x symbol so that later on they can be placed exactly where they should be on the image. If the transformation is the affine conformal one 2 waypoints will be needed, and the other transformations 3. In the latter case, the waypoints should be chosen so as to form an almost equilateral triangle, in order to minimise positioning errors.

After defining any control waypoints, either the entry Map->Background->Load from the Map menu-button (if the main window is the map window), or the entry Load of the Background menu-button (if the main window is the lists window) should be selected. The image file to be loaded is then chosen.

Dialog windows will allow for the selection of the transformation to be used and the waypoints that will serve as control points. The image is then presented in the map window.

In the case of the "affine" and "affine conformal" transformations, or the Least Squares method, each waypoint is placed by the user over the image where it should be and its name and position entered if it did not exist.

If the "affine conformal no rotation" transformation was selected, the user is asked for the names and positions of the control waypoints to be defined if there are any. One of the waypoints is placed first and 2 lines will de drawn. Each of the other 2 waypoints must be on each of these lines. When the mouse is moved, the 2 wayponts will move on these lines until the user clicks the left-button to place them both at the same time.

The operation is finished by clicking on the Ok or Cancel buttons of the dialog window.

It is a fact that for the "affine conformal no rotation" transformation, 2 waypoints would be sufficient. However GPSMan asks for 3 to be placed so that the user may place 2 of them at the same time, in this way having more control on positioning errors. The 3 waypoints should form an almost equilateral triangle that can be shown in the map window. The order of the 3 waypoints is important, as the first one cannot be moved after being placed. This waypoint, then, should be such that there are no doubts on where it should go. It will be shown together with lines that will contain the other two, and will be placed by clicking the left-button. The other two will be placed as a pair in the same way, scale changes being displayed.

The "affine conformal" and "affine conformal no rotation" transformations are particular cases of the "affine" transformation. If possible the latter should be used as it is more accurate.

Using a transformation file is an alternative way of fixing the coordinates transformation and its parameters. At present there is support for the following formats:

Files of the first two formats contain parameters for the affine transformation. The support for TFW files follows the description available from the ESRI ArcGIS 9.2 Desktop Help pages. Unfortunately, there is no publicly available description of the Ozi map file, so that the implementation is based on a popular guess of the meaning of the values in it and on observing sample files.

A GPSMan Least Squares file contains either waypoint names or the geodetic coordinates of control points, as well as their pixel coordinates to be used in computing the parameters of any kind of transformation.

When using a transformation file, the only thing to be done is to select either the entry Map->Background->Load from the Map menu-button (if the main window is the map window), or the entry Load of the Background menu-button (if the main window is the lists window), select the appropriate file method and choose the file. In the case of a TFW or a OziExplorer map file, GPSMan checks if there is a file with the same base name as the image file and the extension .TFW/.tfw, or .MAP/.map, and uses it if there is.

After this, the projection and the datum are selected/changed and a dialog window may appear if there are projection parameters that can be changed.

With a OziExplorer map file only part of the information in the file is used, namely: the datum, and the geodetic and pixel coordinates of control points. Three control points are chosen by finding the triangle whose side with minimum length is maximum. Information on the projection as found in the file is displayed in a window to help in selecting the projection and in setting the projection parameters.

After geo-referencing an image

The map scale cannot be changed if there is a background image, and an image can only be loaded to an empty map.

After geo-referencing an image, the information on it can (should) be saved through the entry Save geo-ref info (under either Map->Background, or Background menus) so that the next time it can be loaded with no need for geo-referencing. A TFW file can also be produced with the parameters for the current coordinates transformation.

Other background images can be loaded after having one image geo-referenced by using the Change option of the map Background menu.

All images must have the same datum, projection and coordinates transformation as the first image. Each image will be described by the path of its file.

In order to load different sheets of a map to the background, images assumed to have exactly the same size as the first image can be loaded to a slot in a grid. This is done by selecting the grid slot in the diagram that is shown and using the Load button. Selecting a non-empty slot will show the file path of the corresponding image.

For loading images that cannot be taken as being in a grid (overlapping other images or having different sizes) the Load button in the right panel of the dialog should be used. A single control waypoint is needed to be placed over the new image and can be either selected from the data-base or defined before being placed. The list of file paths for the images loaded in this way is shown in a list. Selecting one of them will create a representation of the image in the diagram of the left panel. It will appear only when the cursor is on the right panel, and it may be too far away to be seen.

The Clear buttons in the dialog will remove the selected images in either panel. The first image cannot be removed.

GPSMan User Manual
Copyright 1998-2013 Miguel Filgueiras,

Creative Commons License
GPSMan User Manual and the GPSMan logo images by Miguel Filgueiras are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Get gpsman at SourceForge.net. Fast,
secure and Free Open Source software downloads

Datums and ellipsoidsUsing GPSMan in graphical modeMapMap background images