Decoding Magellan map files (Part 1)
The .imi file is a rather simple archive, but there are still few things I haven't figured out yet. The archive has basic table of contents (TOC) at the beginning with the files following it. The file uses low-byte order.
A snippet of the file with all the data files and most of the TOC removed:
line/byte: 4 8 12 16 20 24 28 32
00000000: 80 00 00 00 80 00 00 00 30 30 62 72 65 6B 77 74 00 63 6C 74 00 00 00 00 28 0C 00 00 84 00 00 00 ........00brekwt.clt....(.......
0030: 30 30 62 72 65 6B 77 74 00 6C 61 79 00 00 00 00 AC 0C 00 00 34 05 00 00 00brekwt.lay........4...
...
0C00: 6E 7F E8 0C BB 00 00 00 9C C2 4D 41 47 45 4C 4C 41 4E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 n.........MAGELLAN..............
0C20: 00 00 00 00 00 00 00 00 ........
...
0CE88020: 30 74 30 2E 62 6C 78 0D 0A 00 4D 41 47 45 4C 4C 41 4E 42 3C 0t0.blx...MAGELLANB<
I haven't found out what the first 8 bytes are for, but one of the 4 byte values may be number of files in the archive (this particular archive has 128 files).
The TOC starts at byte 9. Each file in the archive is represented by 24 bytes consisting of 12 byte filename and 12 byte addressing. 8 byte filename with 0x00 fill (bytes 9-16) + 1 byte separator 0x00 (byte 17) + 3 byte file extension (byte 18-20) + 4 unknown bytes (byte 21-24) + 4 byte file offset (byte 25-28) + 4 byte file size (byte 29-32)
Following the file TOC there is 32 byte string (line 0x0C00 offset 8). This may be padding, checksum, or some sort of end of TOC marker. Following this are the files. After the last file, there is a 11 byte string (line 0x0CE88020 offset 9), with unknown purpose. Again, this may be fill or some sort of EOF marker.
Having exported the files from the archive, there is bunch of .ini files, some graphics/icon files, and bunch of database files. It seems like add_maps.cfg is the main file, pointing to other .ini files that contain further data on each map bundled in the archive. Magellan is using embedded Raima Database Manager (RDM) 4.5 for the databases for the GIS data. Raima doesn't exist anymore and it seems they were bought out by Birdstep Technology who offer new version of embedded RDM as free download for developers, however the new version (7.x) seems to have problems parsing the old database files.
More on reading the data from the RDM databases in part 2 (coming soon).
Note: I only have an Explorist unit, which uses .imi files, but from what I read the .img files that the other Magellan units use are compatible.
Comments
This sheds a bit of light on those imi files. be nice if you could release a file or something to extract the files from the archive, or at least the method you used.
Posted by PCChazter on December 28, 2007
Thanks, your guess about number of files seems correct. My .imi archive contains 87 files, and the header starts with:
57 00 00 00 57 00 00 00
Posted by Chris on January 03, 2008
Hey, I just did the same thing, with an .mgi file from an Explorist 500. I found mostly the same thing you did... the first two words do seem to be the directory length (195 in my case)... the 32 bytes after the TOC start with what looks like a two-byte checksum followed by the string MAGELLAN and then some zeros. There are then 10 bytes at the end of the file that again read MAGELLAN followed by two more checksum-looking bytes.
The directory structure seems similar, except the .cfg file (meta.cfg) is only two bytes long, and there is only one .ini file (lay_info.ini). Otherwise most of the other files are pretty impenetrable, although many do mention "Raima Database Manager 4.5 [build 17]". I'll let you know if I'm able to make any progress on them!
Posted by Chris King on January 17, 2008
I was trying to find a way to scan regular maps and turn them into .imi files to use on my magellan explorist 500 le gps. I found this post and thought maybe you had some ideas. It seems if the file structure was followed this could be accomplished easily, without the need to buy $140.00 software from mapsend.
ed
Posted by Ed Normile on February 09, 2008
Seems like my comment notification is broken, so I didn't even notice for a while that there was a whole lot of comments, sorry about that.
@PCChazter: I'm working on releasing some code tha'll be more usable than what I got right now. Should have it ready in a few days.
@Chris (both of you): Thanks for confirming this. The more data points we know about how this stuff, the better. :)
@Ed: it should be possible, but I don't think I know enough about the file format to be able to do that just yet. The map image files Magellan uses (at least in some units) are actually created in layers, so when you are zoomed out you load less data (no smaller roads, etc) making things faster. At this point, I wouldn't know how to create the layers, etc, but eventually will find out.
Posted by Mayo on May 26, 2008