Created
January 22, 2017 13:00
-
-
Save lambdaupb/21bfa917292d45c9b4fef4964799b3d4 to your computer and use it in GitHub Desktop.
read gps_track.dat from recent track feature of MapsWithMe app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Author
@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
Hi, would you mind if I adapted this to convert to a GPX file? Did you license it?