... the user friendly GPS tool


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bushnell Backtrack D-Tour
#21
Yep. It's a binary file. It uses little-endian encoding (least significant byte in the smallest address). The coordinates are 64-bit floats (i.e. double-precision) The three least-significant bytes of them are always null.

Here's a short python script that would modify the Waypoint.gtk file with new coordinates. I haven't been able to write over the other Waypoint.gtk file, but I don't know if it's the GPSr or my computer preventing it.

Code:
import struct
# 0x18 0x30 0x48 0x60 0x78
coords = {
    0x18: (31.49685, 65.8421), # some geocache in afghanistan
    0x30: (42.86268, 0.60267), # some geocache in france
    0x48: (-23.12289, 43.62993), # some geocache in madagascar
    0x60: (-33.81278, 24.89653), # some geocache in south africa
    0x78: (45.27842, -74.0926) # some geocache in canada
}
with open('Waypoint.gtk', 'r+b') as file:
    for addr in coords:
        lat, lng = coords[addr]
        file.seek(addr)
        file.write('\0\0\0' + struct.pack('<d', lat)[3:])
        file.write('\0\0\0' + struct.pack('<d', lng)[3:])

(27.04.2014, 12:52)Oluffen Wrote: Sorry for my limited knowledge in this area, but what does this mean? Does it gives us a clue of how to interpreat the file to get us the waypoints in a standard format?

Regards,

(26.04.2014, 18:21)throwaway Wrote: I don't know about the file you specified, but I have been trying to figure out how I could edit Waypoint.gtk to use this thing for geocaching. Made a breakthrough today, and decided I didn't want my top Google result for trying to figure this out to not to have any good info. It uses a 64 bit floating point format for latitude and longitude.

Lat-Lng pairs are (relative addresses in that file):

* 0x18, 0x20
* 0x30, 0x38
* 0x48, 0x50
* 0x60, 0x68
* 0x78, 0x80

The four bytes (out of eight) that immediately follow each pair look like they could be a 32-bit UNIX timestamp, but for some reason they're all the same for me, at least in the Waypoint.btk file.
Reply
#22
Slightly cleaned up from the example provided:
Code:
02 f7 00 00 ba 00 00 00 - 00 00 00 a0 94 82 46 40 - 00 00 00 20 4b 36 50 c0
02 f7 01 00 bb 00 00 00 - 00 00 00 c0 94 82 46 40 - 00 00 00 20 4b 36 50 c0
02 f7 02 00 bc 00 00 00 - 00 00 00 c0 94 82 46 40 - 00 00 00 20 4b 36 50 c0
02 f7 03 00 bc 00 00 00 - 00 00 00 c0 94 82 46 40 - 00 00 00 20 4b 36 50 c0
02 f7 04 00 bc 00 00 00 - 00 00 00 c0 94 82 46 40 - 00 00 00 20 4b 36 50 c0
02 f7 05 00 bb 00 00 00 - 00 00 00 a0 94 82 46 40 - 00 00 00 00 4b 36 50 c0

Note that I haven't analyzed the header.

What this data looks like to me (taken from first line):

* First 8 bytes, don't know yet - 02 f7 00 00 ba 00 00 00
* 64-bit latitude (45.02016067504883) - 00 00 00 a0 94 82 46 40
* 64-bit longitude (-64.84833526611328) - 00 00 00 20 4b 36 50 c0

These coordinates would put OP in Nova Scotia, Canada.
Reply
#23
Hi all... I'm Adam Schneider, the owner of GPS Visualizer (http://www.gpsvisualizer.com/). I found this forum because someone sent me a .btk track file yesterday... and it was the first I'd heard of the format. For someone who has some experience reverse-engineering GPS data files, it was a pretty easy one: as some of y'all have figured out, the file is full of 24-byte records where the last 16 are the latitude and longitude. The first eight bytes are — I think — the record type (1 byte: "02" for normal points, "04" for end-of-track), temperature (1 byte; divide by 2 and add 20 for the actual temp), point number within the track (2 bytes), and altitude (4 bytes; divide by 10).

Oh, and the 24-byte header line above each track is the record type (1 byte: "03"), then a mystery byte, then the time stamp (7 bytes: 2 for the year, 1 each for m/d/h/m/s), then the rest is blank. The 24-byte header at the very top of the file (which begins with 8 blank bytes) remains a mystery.


GPS Visualizer can already read the basic data from .btk files and convert them to plain text or GPX (http://www.gpsvisualizer.com/convert_input)... but I'd love it if people could send me some additional sample files so that I'm sure I've got it exactly right, and so that I can try to solve the mystery of the time stamps. It'd be really helpful if you could send me a .btk file and a link to a corresponding map page on backtrackdtour.com.

Also, from the discussion above, it looks like this device creates waypoint files too? If so, someone please send me one (or many)!
Reply
#24
Hi Adam, thank you for sharing information about the file format. I guess you're not sharing your code and using Java but please forward me the test files so I can implement this for RouteConverter, too.
--
Christian
Reply
#25
No, I'm not using Java, so my actual code wouldn't be useful. But I have no secrets; I posted everything I know so far about the .btk format.

The only sample file I have is the one that someone sent me. (I also took the raw binary bits and pieces that someone posted earlier in this thread and made them into a faux .btk file, but that hardly counts.) I'm hoping people will send or post more.
Reply
#26
Here's an abridged/simplified version of GPS Visualizer's perl code anyway, in case it's useful for someone:

Code:
open(BTK,$file_path);
seek(BTK,24,0); # skip mysterious file header
while (!eof(BTK)) {
    read(BTK,my $type,1); $type = unpack("C",$type);
    if ($type == 3) { # track header
        read(BTK,my $trk_info,8); my ($unknown,$y,$mo,$d,$h,$m,$s) = unpack("c SCC CCC",$trk_info);
        seek(BTK,15,1);
        
        # [do something here with the time info from the header and start a new track]
        
    } else { # type 4 = end of track; type 2 = normal point
        read(BTK,my $temp,1); $temp = unpack("c",$temp)/2 + 20;
        read(BTK,my $number,2); $number = unpack("S",$number);
        read(BTK,my $alt,4); $alt = unpack("l",$alt)/10;
        read(BTK,my $lat,8); $lat = unpack("d",$lat);
        read(BTK,my $lon,8); $lon = unpack("d",$lon);
        
        # [do something here with the point data]
        
    }
}
close(BTK);
Reply
#27
I got a few more sample .btk files from the guy who originally sent me one, and I'm happy to say that it looks like I've got it right.

The only potential issue is with the time stamps: It seems that these devices record a point every 2 seconds... so as it stands now, I'm taking the "number" field from each trackpoint, multiplying it by 2, and adding the result to the track's initial time stamp. The question is whether these devices ALWAYS use a 2-second interval; it does seem to be the case (and here's a Bushnell FAQ that sort of confirms it), but if they don't, that'll foul up my calculations.
Reply
#28
(05.05.2014, 22:57)GPSVisualizer Wrote: Here's an abridged/simplified version of GPS Visualizer's perl code anyway, in case it's useful for someone:

Code:
open(BTK,$file_path);
seek(BTK,24,0); # skip mysterious file header
while (!eof(BTK)) {
    read(BTK,my $type,1); $type = unpack("C",$type);
    if ($type == 3) { # track header
        read(BTK,my $trk_info,8); my ($unknown,$y,$mo,$d,$h,$m,$s) = unpack("c SCC CCC",$trk_info);
        seek(BTK,15,1);
        
        # [do something here with the time info from the header and start a new track]
        
    } else { # type 4 = end of track; type 2 = normal point
        read(BTK,my $temp,1); $temp = unpack("c",$temp)/2 + 20;
        read(BTK,my $number,2); $number = unpack("S",$number);
        read(BTK,my $alt,4); $alt = unpack("l",$alt)/10;
        read(BTK,my $lat,8); $lat = unpack("d",$lat);
        read(BTK,my $lon,8); $lon = unpack("d",$lon);
        
        # [do something here with the point data]
        
    }
}
close(BTK);


chapeau and what wonderful pictures http://adamschneider.net/photos/

Grüße,
Ilmari
Reply
#29
Hey Lorry and others, I have a Bushnell Bactrack that wont upload the files from the handheld unit. The unit has an autorun that runs "[autorun]
shellexecute=Upload files.btk" but I dont see an "Upload Files.btk' on the the device. I'm thinking my antivirus software ripped it out. Can some kind stranger help a guy out & post a copy here?

please advise,
Stan

Sorry i didn't intend to hijack the tread, I didn't know what else to do. seemed to have all the right people in the right place.
Reply
#30
I have found this thread and I am trying to modify the waypoint information in the Waypoint.gtk with no luck.
I guess the Waypoint information is not stored in the gtk file.
It is only for the software come with to read.
But actually there are some internal memory inside the BackTrack that store the Waypoints.

Firstly I guess it is not store based on the file but somewhere in the block device.
So I dd the whole thing. Search for the HEX of the Waypoints and modify it.
That dd it back to the block device.
However, the Waypoint.gtk seems over written everytime I start the Backtrack.

If anyone success to modify the Waypoints. Please tell us in the thread. It would be useful if this small GPS tracker+Digital Compass can be more useful to point the direct you are going but not only for you to going back to some waypoints you have passed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)