User:MPC/GMP Subfile Format

From OpenStreetMap Wiki
Jump to navigation Jump to search

User:MPC

A reverse-engineering of Garmin's GMP Subfile format

GMP Header

Common Header

The structure of the common header is the same in all subfiles.

Byte Offset Length (bytes) Description
0x000 2 Header length. So far only '0x31' and '0x35' has been seen.
0x002 10 Type GARMIN GMP
0x00C 1 0x01 ?
0x00D 1 0x00
0x00E 2 Creation year
0x010 1 Creation month
0x011 1 Creation day
0x012 1 Creation hour
0x013 1 Creation minute
0x014 1 Creation second

Specific GMP Header

Byte Offset Length (bytes) Description
0x015 4 Offset?? Only seen 0x0000 in here so far
0x019 4 Absolute offset of start of .TRE header
0x01D 4 Absolute offset of start of .RGN header
0x021 4 Absolute offset of start of .LBL header
0x025 4 Absolute offset of start of .NET header
0x029 4 Absolute offset of start of .NOD header
0x02D 4 Absolute offset of start of .DEM header
0x031 4 Absolute offset of start of .MAR header (Bluechart G2)

Copyright Message Section

Byte Offset Length (bytes) Description
after GMP header ?? Copyright messages. This is a section of ASCII text, null-terminated. There may be several null-terminated sentences present here. The copyright messages fill the .GMP file up to the start of the first subfile present.

The offsets

Each offset present in the GMP Header is the absolute position in the .GMP file where you'd expect to find the first byte of the Common Garmin Header for that subfile. The Common Header of each subfile tells you exactly what type of file it is part of, though the offsets in the GMP Header seem always to be in the same order.

No idea what the offset at 0x0015 might indicate.

Presumably, any of the offsets could be zero if the .GMP file doesn't have that sort of subfile amongst its contents?