binPPK
Description
binPPK is a utility designed to convert ASCII PPK (Post-Processed Kinematic) data, typically exported from software like TGO (Trimble Geomatics Office), into a custom binary format. This binarization streamlines the data for subsequent processing, such as merging with other datasets using tools like merge_PPK.
The tool reads date, time, latitude, longitude, and height from an ASCII input file and writes it to a binary file, performing byte-swapping for portability.
Usage
binPPK <asciiPPKfile> <binaryPPKfile> [-v]
Arguments
| Option | Description |
|---|---|
<asciiPPKfile> | Required. The path to the input ASCII PPK data file. |
<binaryPPKfile> | Required. The path for the output binary PPK file. |
-v | Enable verbose output. |
How It Works
- File Opening: Opens the input ASCII file for reading and the output binary file for writing (
wb+). - Data Structure: Defines a
PPK_structureto hold time (Unix timestamp), latitude, longitude, and height. - Line-by-Line Processing: Iterates through each line of the ASCII input file:
- Parsing: Reads
hour,min,sec,day,mon,year,lat,lon, andheightfrom the current line usingfscanf. - Timestamp Conversion: Converts the date and time components into a Unix timestamp (seconds since 1970) using
stdtime_from_dmy. - Data Validation: Performs basic checks:
- If the absolute time difference between the current and previous record is greater than 20 seconds, it prints a warning.
- If the absolute height difference is greater than 1.0, it prints a warning.
- Note: These checks are for warnings only and do not stop processing the record.
- Binary Writing (
ppk_write): If the data is deemed acceptable (not strictly filtered by the warnings), it writes thePPK_structuredata to the binary output file at an offset determined byrecordnum * PPK_RECLEN. Theppk_writefunction usesput_swapped_intandput_swapped_floatto handle byte-swapping, ensuring platform compatibility.
- Parsing: Reads
- Cleanup: Closes both input and output files.
Output Files
<binaryPPKfile>: A custom binary file containing PPK data.
Helper Functions
interp_ppk(): (Currently commented out inmainbut present) This function is designed to interpolate height values between two PPK records over a time gap, if a significant time gap and height difference exist.ppk_write(): Writes aPPK_structureto the binary file at a specified record number, handling byte-swapping.show_date_calc(): A debugging function to display date conversions.
Dependencies
support.h: For utility functions.stdtime.h: For time conversion.jb_endian.h: For byte swapping.
Notes
The binary PPK format created by this tool is optimized for fast reading and processing by other internal tools within the OMG ecosystem. The explicit byte-swapping ensures portability across different system architectures. The data validation checks provide basic quality control during conversion.