# \[ANN\] QstarzGPS.jl : A package to ease loading GPS logs produced by a Qstarz GPS module

**URL:** <https://discourse.julialang.org/t/ann-qstarzgps-jl-a-package-to-ease-loading-gps-logs-produced-by-a-qstarz-gps-module/105616>\
**Category:** Package Announcements\
**Tags:** package, announcement, geo\
**Created:** [October 31, 2023, 12:50pm UTC](https://discourse.julialang.org/t/ann-qstarzgps-jl-a-package-to-ease-loading-gps-logs-produced-by-a-qstarz-gps-module/105616 "2023-10-31T12:50:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lwabeke](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lwabeke/32/4005_2.png) [@lwabeke](https://discourse.julialang.org/u/lwabeke)\
**Post date:** [October 31, 2023, 12:50pm UTC](https://discourse.julialang.org/t/ann-qstarzgps-jl-a-package-to-ease-loading-gps-logs-produced-by-a-qstarz-gps-module/105616/1 "2023-10-31T12:50:17Z")

</div>

A few years ago a client suggested we look at using the [Qstarz](http://www.qstarz.com/) GPS modules to record location information as part of our experiments. This proved useful, however the workflow was typically something along the lines of:

- Capture the positions with the GPS logger
- Connect the GPS logger to a PC using USB
- Use their Windows application (running in a VM) to export the log into a CSV file
- Copy the CSV file to the Linux server where the rest of our data is captured and the analysis is performed
- Load the CSV file into Julia (using CSV.jl) and perform the analysis

Due to the hassle of having to fire up my Windows VM to run the extraction utility, I started wondering if it wouldn’t be possible to trim these steps and do it more directly. I reached out to Qstarz with the suggestion of making an open source implementation available to read their log files. They graciously  
provided me with some information which allowed me to implement the reader. Since my ultimate step was to get the data from the log format into Julia, I decided to skip intermediate steps and implement it to directly load the data into a Julia vector object.  
The data is stored as an array of structures, but I also implemented helper functions to be able to easily extract the individual fields of the structure into vectors (see the Extended Example on [https://github.com/lwabeke/QstarzGPS.jl/](https://github.com/lwabeke/QstarzGPS.jl/).

```julia
julia> using QstarzGPS

julia> filename = "230502_120613.BIN"

julia> gpsLog = readQstarzLog(filename)
5325-element Vector{GpsLogEntry}:
 GpsLogEntry(0x03, 0x54, 0x0258, -25.75720058333333, 28.27944851666667, 0x6450fcb5, 6.7598f0, 1423.27f0, 178.39f0, 0.26171875f0, -0.28515625f0, 0.87109375f0, 0x0031, 1.97f0, 1.0f0, 15, 5, 0x01, 90, 0x00000000, 0x00000000)
 GpsLogEntry(0x03, 0x54, 0x02bc, -25.75720188333333, 28.279449366666668, 0x6450fcb5, 7.5006f0, 1423.351f0, 179.87f0, 0.26171875f0, -0.546875f0, 1.2070312f0, 0x0031, 1.97f0, 1.0f0, 15, 5, 0x01, 90, 0x00000000, 0x00000000)
    ...

julia> using Dates

julia> unix2datetime.(gpsLog.time[1:3])
3-element Vector{DateTime}:
 2023-05-02T12:06:13.600
 2023-05-02T12:06:13.700
 2023-05-02T12:06:13.800

```

By using Leaflet this can be easily visualised (for details see the Extended Example on [https://github.com/lwabeke/QstarzGPS.jl/](https://github.com/lwabeke/QstarzGPS.jl/)):

 ![LeafletOutput](https://global.discourse-cdn.com/julialang/original/3X/6/d/6de6b9347e211e16e767006c4d38089ae69fe753.jpeg)

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [October 31, 2023, 1:03pm UTC](https://discourse.julialang.org/t/ann-qstarzgps-jl-a-package-to-ease-loading-gps-logs-produced-by-a-qstarz-gps-module/105616/2 "2023-10-31T13:03:26Z")

</div>

That is awesome @lwabeke , thanks for the contribution.

Are you aware of the [Tables.jl](https://github.com/JuliaData/Tables.jl) interface? Perhaps the output of your function could follow it to maximize integration with existing stacks.

If you want to go one step further, you could even load the data as a geotable as discussed in the [Geospatial Data Science with Julia](https://juliaearth.github.io/geospatial-data-science-with-julia) book.

Alternatively, we can add the backend to [GeoIO.jl](https://github.com/JuliaEarth/GeoIO.jl) so that users can automatically load the GPS data into the stack.

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [November 1, 2023, 1:08am UTC](https://discourse.julialang.org/t/ann-qstarzgps-jl-a-package-to-ease-loading-gps-logs-produced-by-a-qstarz-gps-module/105616/3 "2023-11-01T01:08:48Z")

</div>

> [@juliohm](#):
>
> Are you aware of the [Tables.jl](https://github.com/JuliaData/Tables.jl) interface? Perhaps the output of your function could follow it to maximize integration with existing stacks.

It sounds like it outputs a vector of structs, which satisfies the interface by default (as a row table).

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [November 1, 2023, 10:16am UTC](https://discourse.julialang.org/t/ann-qstarzgps-jl-a-package-to-ease-loading-gps-logs-produced-by-a-qstarz-gps-module/105616/4 "2023-11-01T10:16:17Z")

</div>

@lwabeke it is good practice to add tests to the package. In this case, it is also a good idea to add a small example file that people can load. Right now it is not possible to reproduce the example in the README, nor test the package properly.
