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

Geo-referencing a background image consists in selecting a projection and a coordinates transformation and in placing control waypoints in the image in order to fix the values of the parameters of the projection and the transformation. An alternative is to indicate that there is a TFW file or a OziExplorer map file associated to the image.

Only then is it possible to compute map coordinates from geodetic coordinates or the inverse. In fact, to convert from geodetic coordinates (i.e., coordinates in the spheroid, typically as latitude and longitude) into pixel coordinates in the screen there are two operations:

  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.

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 TFW or OziExplorer map 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 for the transformation and possibly for the projection can be computed.

Coordinates transformations

The transformations presently available in GPSman are

Geo-referencing using control points needs 2 or 3 control waypoints with known coordinates. They are placed over the image so that both their geodetic coordinates and their pixel coordinates are known. These waypoints can either be selected from the existing ones, 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 in the image. If the transformation is the "affine conformal" one 2 waypoints will be needed, otherwise 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 then allow for the selection of the transformation to be used and the 2 or 3 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 each waypoint is then 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 first 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 over each of these lines. When the mouse is moved, the 2 wayponts will move over 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.

Using a TFW or OziExplorer map file is an alternative way of fixing the parameters of the affine transformation. Unfortunately, there is no publicly available descriptions of the formats of these files and the implementation is based on a popular guess of the meaning of the values in TFW files and on observing sample files.

With a TFW file (Tiff World 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 TFW file method and choose the file, unless there is a file with the same base name as the image file and the extension .TFW or .tfw. 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 the method is selected in a similar way and a file must be selected if there is not a file with the same base name as the image file and the extension .MAP or .map. 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. They are used in computing the affine transformation parameters. 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 menu-buttons) so that the next time it can be loaded with no need for geo-referencing.

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
©1998-2006 Miguel Filgueiras, mig_at_ncc.up.pt, DCC-FC & LIACC, Universidade do Porto

Datums and ellipsoidsUsing GPSMan in graphical modeMapMap background images