Thread
:
Wayfinder map format
View Single Post
tme
2008-01-29 , 11:26
Posts: 66 | Thanked: 145 times | Joined on Jan 2008
#
19
Originally Posted by
lardman
Cool. I've not had a chance to look at this any further but please keep us updated
I've basically followed the hints given in
http://wiki.navit-project.org/index.php/Map_driver
Each qt file has a block index near the top after some other
stuff. I haven't figured out any of the block formats yet - in theory
railroad (rr) or water (wa) should be easier than road (rd). Some
blocks have a int16 length field at the start, others don't so there's
more than one format to deal with (the block index may help here). I
suspect the (uk) pc data is still obfuscated as they look like
postcodes but I can't find any known postcode in there.
The following will dump out the uncompressed blocks from a qt file by
scanning for z headers (this should really use the block index):
#include <stdio.h>
#include <zlib.h>
#define BUFSIZE 0x100000
unsigned char inb[BUFSIZE]; char outb[BUFSIZE];
int main(int argc, char argv) {
unsigned char *pos;
char p1,p2,p3,c;
long ins,outs=0;
int ret;
int block=0;
char fname[128];
FILE *f;
ins=read(0, inb, BUFSIZE);
pos = inb+2;
do {
while ( *pos != 0x78 || *(pos+1) != 0xda ) pos++;
outs=BUFSIZE;
ret=uncompress(outb,&outs,pos,ins);
if ( ret==0 ) {
if ( outs, (*(pos-1))*256 + *(pos-2) ) {
fprintf(stderr,"block %03d @0x%x size=%d skip=%x\n", block,
pos-inb, outs, outb[0] + 256*outb[1]);
sprintf(fname,"block_%03d_%08x.dat",block,pos-inb);
if ( f=fopen(fname,"wb") ) {
fwrite(outb,outs,1,f);
fclose(f);
}
} else {
fprintf(stderr,"sizeerr %d @0x%x size=%d expected=%d\n", block,
pos-inb, outs, (*(pos-1))*256 + *(pos-2));
}
block++;
pos ++;
} else {
fprintf(stderr,"skip @0x%x size=%d\n", pos-inb);
pos++;
}
} while (pos<inb+BUFSIZE);
}
Quote & Reply
|
tme
View Public Profile
Send a private message to tme
Visit tme's homepage!
Find all posts by tme