Garmin to Magellan
Some MapSends has built-in topo database. The database is stored in the \MAP\BLX folder in the *.blx files. Format of the *.blx files is very complex (to my opinion this is the most complex of Mapsend's formats). Topographic data composed in the series of data chunks, each chunk represents 128x128 matrix of heights. Chunks in turn, composed from 15 smaller matrices to build 128x128 matrix. Moreover, chunks are compressed with Magellan's custom compression algorithm.
All this was discovered by Henrik Johansson (see his messages #203 and #797 in Mapsend_Format yahoo group). He created Python program to extract/create BLX files (available at MapSend_Format yahoo group). Many thanks to Henrik for his outstanding work! In my program I'm using his algorithms for compression/decompression of chunks and algorithms to create matrices.
I choose the most explicit format of the input files: Terrain Matrix model compatible with free 3DEM viewer. In this format Height matrix is represented by matrix of signed integers, all georefference information is stored as a plain text in a separate file (*.hdr). Terrain Matrix can be created with 3DEM viewer from may other 3D formats. 3DEM viewer available for free at http://www.visualizationsoftware.com/3dem.html.
TOPO file structure
Not all MapSends has topo database. As far as I know, almost all Mapsends can show topo information on PC screen. Some of them can export topo to GPSR.
Some examples (MapSends/MMO that initially do not have TOPO):
a) MMO1.00, MMO1.10, MMO2.00: can show TOPO on PC screen and export TOPO to GPSR
To make MapSend/MMO compatible with TOPO the following is needed:
1) Create \MAP\BLX folder containing *.blx files with TOPO database. The *.blx files can be created with TOPO_creator from available 3D data.
For convenience I add the feature to do all above mentioned automatically with TOPO_creator, ("Do Topo") button.
Some Mapsends (Streets Europe, S&D Canada, S&D Australia) needs some more modifications to show TOPO on PC screen:
1) the following section must be inserted to the map.ini file (say, at the end)
2) Show_Topo=0 should be replaced with Show_Topo=1 in the [OPTIONS] section of the mapsend.ini file (this also needed for S&D USA).
TOPO map will be shown if the map is in the range covered with your MapSend.
To have an idea what mean parameters in the topo3d.ini and topo3d.cfg please have a look at Ryan Walsh's Msg#1070 in the MapSend_format yahoo group.
3D data must follow the following rules:
1). The must not contain abrupt changes of height (usually at the borders)
Example of data preparation
Many different utilities can be used for data preparation, in the example I will use the following free software:
1) 3DEM viewer : available at http://www.visualizationsoftware.com/3dem.html (viewer - format converter)
1660095.DEM.SDTS.TAR ( 10m UTM DEM) data set was downloaded from the Internet and converted to hunter.dem with sdts2dem.exe utility. File size is ~9Mb
Observe the hunter.dem with 3DEM viewer:
We see that the map contains zeros at border area, they must be removed. Select (write on a piece of paper) area we can trust (to be sure that zero borders are out of this area), say: -74.2496, -74.1273, 42.2491, 42.1259. Then, this map is 10 m UTM, so it must be converted to WGS84 Lat/Long and number of columns and rows must be N*128.
Let us do some calculations:
Longitude increment: -74.1273 - -74.2496 = 0.1223. With minimal allowed step of 0.0002 it gives: 0.1223/0.0002=611.5. We are allowed of N*128: 611.5/128=4.78. Minimal integer close to 4.78 is 4, so we must use 128*4=512 cols.
Latitude increment: 42.2491 - 42.1259 = 0.1232. With minimal allowed step of 0.0002 it gives: 0.1232/0.0002=616. We are allowed of N*128: 616/128=4.81. Minimal integer close to 4.81 is 4, so we must use 128*4=512 rows.
(Note: this calculations can be done automatically with TOPO_creator, but will take more steps to prepare the dataset, see below)
Summary of our task:
We must cut edges of our hunter.dem to selected area (-74.2496, -74.1273, 42.2491, 42.1259), convert data to WGS84 Lat/Long, resample to have 512 rows and 512 columns.
This is one step operation with gdalwarp utility (!):
gdalwarp.exe -t_srs WGS84 -rcs -ts 512 512 -te -74.2494 42.1263 -74.1259 42.2493 hunter.dem hunter.tif
see description of gdalwarp.exe for all set of parameters. Here we use:
-t_srs WGS84 (WGS84 Lat/Long projection)
Conversion takes several seconds. Here is the result, image is stretched horizontally compared to original data, this is due to UTM-Lat/Long conversion.
Convert this GeoTiff hunter.gif file to Terrain Matrix (Save Terrain Matrix-Binary (Signed integer). This will be hunter.bin file ready to *.blx creation.
Here is an example:
For comparison below is the same area taken from MapSend TOPO US. We can see that our custom map is more accurate and detailed than MapSend Topo US map.
Apendix A. Format of Terrain Matrix (used by 3DEM)
There are 2 files, name is the same, but extesions are different:
1. Header file with georefference information (*.hdr). This is plain ASCII text. The following fields are used by TOPO_creator:
a) It checks data_format and map_projection (they must be int16 and Lat/Lon) and elev_m_unit (must be meters).
All the others have no meaning for TOPO_creator, but must exists (with any value after =)
file_title = hunter
2. Elevation data (2 bytes integers), meters (*.bin). Columns and rows as indicated: (MaxX, Min X: Longitude, MinY, MaxY:Latitude)
Note: From Min to Max for both directions, so for Northern hemisphere North is at the botom row, and South is at the top.
Also you can create elevation matrix as a plain ASCII text of heights (following the above mentioned rules), then this text data can be converted to binary data with 3DEM. Every point will be a real number with 2 digits after decimal separator:
Here is a part from the beginning of the file:
693.00 686.00 666.00 655.00 648.00 633.00 612.00 609.00 618.00 615.00 603.00 596.00 591.00 584.00.....