OSM Map On Garmin/TDB File Format

From OpenStreetMap Wiki
Jump to: navigation, search

OSM Map On Garmin

A reverse-engineering of Garmin's TDB file format

Here are only some differences and additions to the document "Garmin TDB File Format. Rev 1.0, 7/2/2005" by John Mechalas.

The source document you can easily find by yourself.

v.4.07 File Overview

Block structure

Byte offset Length (bytes) Description
0x00 1 Block ID
0x01 2 Block length = BL
0x03 BL Block data

Header block

Block ID = 0x50

Relative offset Length (bytes) Description
0x00 2 Product ID
0x02 2 Family ID
0x04 2 TDB version * 100
0x06 LS Map series name (0x00 terminated)
0x06+LS 2 Product version * 100
0x08+LS LF Map family name (0x00 terminated)

Other data following Map family name relates to routing levels,whether a map is locked,can be printed,viewed or contains dem,routing or elevation.Preview Map offsets are also declared. For more information see TDB Editor http://www.pinns.co.uk/osm/tdbeditor.html.

Copyright block

Block ID = 0x44

Relative offset Length (bytes) Description
0x00 Varies Array of copyright segments
Copyright segment
Relative offset Length (bytes) Description
0x00 1 Copyright code (0x00 = sources, used to create this map; 0x06 = copyright information from the map manufacturer)
0x01 1 Where code (0x01 = show this copyright info in MapSource; 0x02 = print this copyright info on maps, printed with MapSource; 0x03 = both show and print)
0x02 2 Extra properties
0x04 CS Copyright string (0x00 terminated)

Overview map block

Block ID = 0x42

Relative offset Length (bytes) Description
0x00 4 Map number
0x04 4 Parent map number = 0x00000000
0x08 4 North limit
0x0C 4 East limit
0x10 4 South limit
0x14 4 West limit
0x18 LS Description string (0x00 terminated)

Map limits are in TDB units. 1 TDB unit = 360/2^32 degrees.

Detail map block

Block ID = 0x4C

Relative offset Length (bytes) Description
0x00 4 Map number
0x04 4 Parent map number
0x08 4 North limit
0x0C 4 East limit
0x10 4 South limit
0x14 4 West limit
0x18 LS Description string (0x00 terminated)
0x18+LS 2 Unknown (always 0x0004 or 0x0005?)(new edit:relates to number of subfiles + 1)
0x1A+LS 2 Number of subfiles in IMG-file = N
0x1C+LS 4 * N Array of subfiles sizes
0x1C+LS+4*N 7 byte:0 has copyright text,byte 1: has 0x53 text : byte 2:if 1 then bytes 3_7: an unknown total (density)
0x23+LS+4*N varies (typicaly = 13) * N Array of subfiles names (each 0x00 terminated)
2 Unknown (always 0x0000?)

Map limits are in TDB units. 1 TDB unit = 360/2^32 degrees.

Checksum block

Block ID = 0x54

This is always the last block in TDB file

CRC32 checksum is calculated for the entire TDB-file except checksum block

Relative offset Length (bytes) Description
0x02 1 1-st byte of CRC32
0x09 1 2-nd byte of CRC32
0x0C 1 3-rd byte of CRC32
0x11 1 4-th byte of CRC32

All other data in this block seems to be random. Typical block lenght = 20 bytes.