MAPS


The onliest maps supplied with the program are demonstration maps, and are not very usefull. So you will have to make your own maps, or use the Openstreet map, see Openstreets.

A map consists of an image (bitmap) of a map, and the data needed to convert GPS position data to image coordinates.

Since a pocket pc is quite limited in memory and speed, it is not possible to load large images. Images of about 1000*1000 pixels seem to be about the maximum size that can be loaded in mapwelt on a pocketpc. Therefore large images are split into small tiles which only get loaded if needed for display. The program to split an image into tiles is supplied with the program (image2maps.etk) . This program would typically be run on a normal desktop/laptop computer, not the pocketpc (although that is possible). Since having large numbers of small images is not very convenient, they are stored in a (sqlite) database together with the mapcalibration data.

When running image2maps on a pocketpc, it should be possible to convert a 3 megapixel image (approximately 2000*1600), ofcourse dependant on your pocketpc/memory/loaded programs etc. The image2maps program can convert larger images than mapwelt can load under etcl, since the image2maps program does not load the images into tk, but uses pixane (a etcl extension of tcl) for the conversion. If the conversion is done in windows on a normal pc, an enhanced scaling will be used for the zoomed out images, on other systems the standard tk scaling (nearest neighbour) will be used.

Most images of maps can be manually calibrated for use in MapWelt, but images made with Google Earth can be converted without manual calibration if a kml file is also saved, see below.

Calibrating of scanned or downloaded image

So you first need to obtain an image of a map (either by scanning or downloading). The supported image formats are jpg, gif and tif. Then start image2maps.etk. At the start this will show 5 empty listboxes. In the entry field on the top, type the name of the map you want to create, and add .mdp as extension, (for instance mymap.mdp) and press NewMap. This will create an empty database which will hold your maps. Next click the load button under the maps listbox (leftmost). This will popup a file requester. Select the image name you want to import into the map. After pressing open, the image will be loaded into the map. Depending on the file size, this might take some time, some rudimentary form of progress is shown in the console. When finished, the image2maps program can be closed. The other part of the image2maps gui which were now not used, can be used to incorporate waypoint/texts/images and sounds in the map.

Next, start mapwelt, and load the created map, and calibrate the map. First select the appropriate projection type (this might be printed on the map), next fill in the parameters required for this projection (the entry's which are enabled). Note that the false easting and northing parameters must be filled in, but have no effect on the calibration, so you can just as well enter 0. There are two projections that have no parameters: NLRD and simple. The NLRD is only usefull in the netherlands, and should not be used outside of the netherlands. The simple is intended to be used if nothing is known about the projection. This should be fairly similar to a mercator projection with the lattitude and longitude origin set to the first calibration point. This should work reasonably well if the map does not cover too large an area (tens of kilometers)

The next action is to connect image coordinates to latitude and longitude coordinates. Basically, there are three way's of doing this:

  1. If latitude and longitude are shown on the map, press left mouse button over a pixel where you know the latitude and longitude and select SetRef1. This will paste the XY position in the image and the (wrong) latitude and longitude in the mapcalibration window. Fill in the correct latitude and longitude values (from the map). Repeat this for the other two reference points.
  2. Search a point on your map (the image) and press left mouse button and select SetRef1 which will paste the XY position and the latitude and longitude in the mapcalibration window. Next locate the same point on for instance google earth or http://mapper.acme.com/ , and use the lat/lon values found with google earth in mapwelt. These sites also use the WGS84 projection system, so this should be the same as the GPS device. Repeat this procedure for the other two reference points.
  3. Whilst you are moving around:Go to the map pane, and if you are in the area described by the map, and you have a valid gps position, then tap&hold (or right mouse button) the place where you are on the map (this is most likely not the place indicated by the arrow since the calibration is incorrect). A popup is shown, and select SetRef1. The selected image coordinates and the present gps coordinates will be set in the map settings table. press Ref1&Dist. This process should be repeated for the second (press Ref1&2) and third calibration point (Ref1&2&3)

With 2 or 3  calibration points, the program calculates the rotation and scale of the image (with 3 calibration points two scales in X and Y direction).

Alternatively, if you know the scale of the map, it is also possible to use only one calibration point. To use this, fill in the Dist Pixels and meters in the mapsettings. To aid this, there is a measure function in the map pane (tap&hold or right button on the map and select measure). In measure state, the map cannot be moved. Press the stylus (left mouse button) at the start of the scale, and release it at the end, and the distance will be measured and automatically filled in in the Dist Pixels and meters fields. You will need the correct the distance in the meters field. Then press the Ref1&Dist button. In this method, north is assumed to be up in the image.

One of the most critical aspect of calibration is that you should enter the calibration points in the same coordinate system as the GPS system (which to my knowledge is always WGS84). Mapwelt doesn't do any datum conversion (conversion between coordinate systems). The correct coordinate system is especially important for maps of a small area (tens of kilometers or below).

For maps of larger areas, the projection type becomes very important.

Note that Map X and Y coordinates should be entered in the 'computer standard' form where the top left pixel is 0,0 (if you use the right mouse button and SetRef, it automatically in this coordinate system).

After having calibrated the map, you should save it.


Google Earth maps.


A possible source of maps can be Google Earth. For convienience, the image2maps program can take images made with google earth and automatically calibrate them if you have saved a .kml file along with the image (they must have the same filename). Below is a step by step guide on how to create a map from Google Earth data:

First of course, is to start google earth. Then create a new placemark which will hold the mapview:

Create placemark

This pops up a new window:

placemark dialog

If the name is make blank, no name will be shown on the map. By pressing the pushpin icon, one can select an icon, or no icon.

Next, put the region you want mapped in view, and align the map to north, and reset the tilt (so the camera looks straight down):

North and tilt

Pressing the N button rotates the image so that North is up:

Aligned

Next make a snapshot of the view. Press the right mouse button on the placemark we made earlier:

Snapshot

Now save the placemark by pressing the right mouse button on the placemark:

placemark save

Make sure to save it as a .kml file, not as a .kmz file

Next save the image, do not change the view between the snapshot view and the save of the image.If you want the maximum size of image, you should do a "fullscreen" (F11) before saving the image. Make sure that the kml and image both have the same name (eg test.kml and test.jpg), and end up in the same directory.

save image

Next, start image2maps.etk. At the start this will show 5 empty listboxes. In the entry field on the top, type the name of the map you want to create, and add .mdp as extension, (for instance mymap.mdp) and press NewMap. This will create an empty database which will hold your maps. Next click the load button under the maps listbox (leftmost). This will popup a file requester. Select the image name you want to import into the map. After pressing open, the image will be loaded into the map. Finally,the etcl console should look like this:

console

At this stage, you should have a test.mdp, which is a calibrated map of the Google Earth image. This map can be opened in MapWelt, and is ready for use without any further actions.

Maps made from Google Earth work quite well for maps of a small regions. Large regions (hundreds or thousands of kilometers) have errors. I have made a projection for google maps (called google), but thats derived for a sferical earth (should be elliptical, but I am not that good at maths), and does show some deviations (although I am not sure wether that's due to the difference between a sfere and an ellipse).
In the preferences file (mapwelt_prefs.tcl) there is a correction factor for google maps called settings(googlefactor). This corrects the range (which seems to be the heigth of the viewpoint) described in the kml file to the width of the map. I'm not sure why this is needed, but a factor of 0.870 gives reasonable results.

Description of the Map database format

Maps are stored in a Sqlite database. Each database can hold multiple maps and can also hold waypoints/textfiles/images and sounds. This allows creation of one file which can hold a complete guided tour with multiple maps, and texts/sounds being played at waypoints. The following is a brief description of the file format.

The database structure starts with the metadata table, this holds some data for the complete database (especially Version). Each data base can hold multiple maps.

The second table is maps, this lists the individual maps in the database, and points at the locations (tablenames) where each map metadata, map images and map calibration are located.

Each map is described in the metadata#n (#n= map number starting at 1 (this is given in the maps table)) table. Most entries in this table should be fairly obvious. A number of essential entries are:

The map tile images are stored in the images#n (#n= mapnr) table and are retrieved by imagename. This composed of filename (from the metadata#n table) zoomout factor X tile number Y tilenumber and fileextension (again from the metadata#n table). The filename,zoomoutfactor,x tilenumber and y tilenumber are joined by underscores, and the file extension is appended. Zoomout factors are always 1,2,4,8...2^n...maxmagnification. The images are stored as jpg to reduce the filesize of the database.

A map must also have a calibrationdata#n table, which holds the number of nrcalibrationpoints from the metadata#n table (the latitude and longitude values are in degrees)..

The mapextents table lists all the maps in the maps table, and lists the part of the earth covered by the map (the latitude and longitude values are in radians, not degrees).

The other tables are used for extensions to the map like waypoints/sounds/images (images for display on the map)