Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
read gps_track.dat from recent track feature of MapsWithMe app
from collections import namedtuple
import struct
import sys
from enum import Enum
class PointSource(Enum):
EAppleNative=0
EWindowsNative=1
EAndroidNative=2
EGoogle=3
ETizen=4
EPredictor=5
Point = namedtuple("Point", "timestamp latitude longitude altitude speed bearing horizontalAccuracy verticalAccuracy source")
PointPattern = '<ddddddddB'
PointPackSize = struct.calcsize(PointPattern)
HeaderSize = 4
with open(sys.argv[1], 'rb') as f:
data_input = f.read()
print("PointPackSize",PointPackSize)
raw_points = data_input[HeaderSize:HeaderSize+PointPackSize*((len(data_input)-4)//PointPackSize)]
print("data len: ", len(data_input), len(data_input)%PointPackSize)
for rawPoint in struct.iter_unpack(PointPattern, raw_points):
point = Point(*rawPoint[:-1], PointSource(rawPoint[-1]))
print(point)
@bjmc

This comment has been minimized.

Copy link

commented May 24, 2017

Hi, would you mind if I adapted this to convert to a GPX file? Did you license it?

@lambdaupb

This comment has been minimized.

Copy link
Owner Author

commented Dec 18, 2017

@bjmc Please feel free! Consider it MIT licensed.
Sorry for answering so late, I did not get a Notification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.