Parse the yyyymmdd.dat files of a Vantrue N4 Pro and create an HTML view of the GPS track.
The .dat file appears to use this format:
YYYYMMDDHHMMSS,latitude,N,longitude,E,speed_in_knots,altitude_in_meters
The last two values took me quite some time to figure out, so I wanted to share that here in case that is all you were looking for.
- Reads one
.datfile or a directory of.datfiles - Parses GPS timestamps and coordinates
- Converts speed from knots to km/h
- Generates an interactive HTML map with:
- speed-colored track segments
- markers for segment start/end
- waypoints
- a time slider to inspect the track step by step
- total distance display
Run the parser on a file or directory:
python gps_data_parser.py /path/to/gps/filesIf no path is provided, the script uses the default GPS directory configured in the code.
To overwrite existing HTML output files:
python gps_data_parser.py /path/to/gps/files --overwriteFor each input file, the script creates an HTML file next to it with the suffix:
_map.html
Example:
20240101.dat -> 20240101_map.html
Install the Python dependencies listed in requirements.txt.
Two constants control how the track is simplified before it is drawn:
-
DISPLAY_STEP = 10
Keeps only every 10th GPS point for display (every 10 seconds). This was chosen to allow smooth rendering even for the maximum 24-hour tracking data generated by the dashcam, while still preserving the overall shape of the route. -
MIN_MOVEMENT_KM = 0.1
Ignores movement smaller than 0.1 km when computing distance. This helps suppress GPS noise when the car is stationary or barely moving, so the reported distance is closer to the actual driven distance.
- The parser is tailored to Vantrue N4 Pro GPS
.datfiles. - Latitude/longitude direction fields are respected for
N/SandE/W. - Speed values are shown in both knots and km/h.
- Altitude is displayed in meters.
I use it and haven't had any issues so far; your mileage (pun intended) may vary.