logo separator

[mkgmap-dev] MDR success and a couple of questions

From Alexander Atanasov aatanasov at gmail.com on Thu Oct 8 18:45:05 BST 2009

Hi,

A bit of mdr > 15 or on the device format.
Looks like it's the same except references to mdr15 are stripped in
the sections < 15.
They are moved in mdr17 in each section there.

MDR17 format is like this:
Section:
read one byte and check first bits, section lenght is encoded there.
if (b&1) -> len=b>>1
if (b&2) -> read one more and strip first two bits from the first byte
if (b&4) -> read two more and strip first three bits from the first byte
if (b&8) -> ... read three more
This coding is used a lot in the nt maps.

(Next in the nt maps there is 80 00 flag, skip this if found. only in
the first section)
read 1 byte index len
read 1 byte text len
find first set bit in index len which give the lenght of the index, like this
if first bit, len is 1, if second bit 2, etc, strip this bits to get unknown1.
mask text len with 0x0f and add 1 to get how much is the lenght of the
text, label prefix
0xf0 mask gives unknown2.
Start to read text len + index len bytes and get the results, until
you read section lenght bytes.
Repeat for the next section.

this should give you several sections in mdr17 that correspond to the
street, city,  street,poi
sections. (streets in my maps are present two times - one for mdr7,
one for mdr21,22,23? )
garmin_mdr.c:1381:1|mdr17: 1362452 101163 0
garmin_mdr.c:350:1|header dlen:42EF/17135 u1=323/803 i1=08/8(sect=9)
i2=03/3 tlen=4 ilen=2 slen=3 :64 17 02 23 03 2F
garmin_mdr.c:476:1|0005:STR:[/ 57] idx:01/1
garmin_mdr.c:476:1|000B:STR:[/15] idx:02/2
garmin_mdr.c:476:1|0011:STR:[/21] idx:03/3
... [ cut]
garmin_mdr.c:489:1|Section done:2855
garmin_mdr.c:350:1|header dlen:00F7/247 u1=323/803 i1=04/4(sect=5)
i2=01/1 tlen=2 ilen=1 slen=2 :D6 03 09 01 41 48
garmin_mdr.c:476:1|42F3:STR:[AH] idx:4D01/19713
garmin_mdr.c:476:1|42F6:STR:[AS] idx:4D02/19714
garmin_mdr.c:476:1|42F9:STR:[AY] idx:4D03/19715
garmin_mdr.c:476:1|42FC:STR:[BA] idx:4D04/19716

and so on. The question here is how to map this section to the
corresponding mdrXX.
I think it's with i1 in the log(or what left when you get the index lenght)

The index is an index into the section, when it's not sequential, the
prefix of the street,city,poi is repeated.
For example:
garmin_mdr.c:476:1|0072:STR:[ГЕНЕ] idx:19/25
garmin_mdr.c:476:1|0077:STR:[ГЕОР] idx:1A/26
garmin_mdr.c:476:1|007C:STR:[ГРАФ] idx:1D/29

garmin_mdr.c:350:1|26[00C8] IMG:[12345678] roadptr: 80202C
lbl[0146]:[ГЕОРГ ВАШИНГТОН] left=1 :01 2C 20 80 46 01 00 01
garmin_mdr.c:350:1|27[00D0] IMG:[12345678] roadptr: 801E24
lbl[0156]:[ГЕОРГИ БЕНКОВСКИ] left=1 :01 24 1E 80 56 01 00 01
garmin_mdr.c:350:1|28[00D8] IMG:[12345678] roadptr: 8021F5
lbl[0167]:[ГЕОРГИ С. РАКОВСКИ] left=1 :01 F5 21 80 67 01 00 01
You see that the 'ГЕОР' prefix is same for 26, 27, 28 indexes in MDR7.

idx 29 is with different prefix.

MDR18 is mistery yet. contains fixed size records. may be it is sorting.

MDR20 - contains pois sorted by something. may be by name.
2/3 bytes records, POI idx in mdr11
if flagged with 0x8000/0x800000 it's a new name, otherwise the
previous is repeated.

MDR21,22,23 are streets sorted in different ways, format is the same
as MDR7 without the label.
Still one byte at the end is unclear.

MDR24 - regions
garmin_mdr.c:350:1|1[0000] img:12345678 rid:1 cid:1 imglbl:[800087]
left:0 :01 01 00 01 00 87 00 80
1/2 img id,  2 region id, 2 country id, 3 label in the img file

MDR25 and MDR30 have only one record, i guess its country testing with
small maps.

MDR28 - city sorted
contains 1/2 bytes city record index in mdr5.

MDR29 - regions again, needs more work.

No time to get to the details, but that should help to get started with  them.

-- 
have fun,
alex



More information about the mkgmap-dev mailing list