Thursday 9 June 2022

Add GPX Tracks to PredictWind Track Page

Hi everyone,

This is another technical post.

For about 8 years we've been customers and fans of PredictWind.  We started off with PredictWind's own Satellite Communicator for email and downloading GRIB files.  In 2015 we replaced it with an Iridium Go! for our cruise from Australia to the UK.  On arrival in 2016 we sold the Go! and in 2021 bought another.  While using the Go! we used PredictWind's tracking service to make our track and location visible to friends and family.  It is a great feature and position reports can be uploaded by various means.  A Standard or Professional PredictWind package is necessary to have a tracking page.

Zen Again Track 2015-Today

The tracking page was great, but we lost our old tracks when the page was re-established after we bought the second Go!.  Recently we've stopped the Go! tracking since we're not crossing oceans.  I asked PredictWind Support how I could keep the page updated while sailing in coastal waters.  They suggested their new DataHub product.

The DataHub looks good but I also wanted a way to add historic tracks we'd already 'missed'.  PredictWind Support pointed me to this page in their Help Centre.  The page describes how to send emails to them with track updates.  The format is very simple with each line containing username, laitude, longitude and UTC time.  Multiple lines can be sent in a single email.

We always record and keep our tracks as GPX files.  GPX is the standard format for chartplotters, including software chartplotters such as OpenCPN.  GPX files can contain tracks, routes and waypoints but we're only interested in tracks here.

Here's the start of an OpenCPN GPX file.

Start of typical OpenCPN track GPX file

There were two problems to address.  Firstly, GPX format is very different to the PW manual email format.  Secondly by default GPX tracks contain one fix per second versus the one per hour which is normal for PW GPS tracking.  So there were reformatting and filtering to be done.

I wrote a Python script to process individual GPX files.  It is probably not very robust.  Nevertheless it has done the job nicely, processing 300 files without apparent error.  It outputs a fix from the track start, a fix per hour thereafter, and a fix from the track end.  It is written primarily for our OpenCPN track files but also worked on our old Garmin GPSmap GPX tracks.

Here is the Python file header (for the geeks)...

gpx2pw.py comment header

And here's an example of running the script (in a Terminal window on MacOS)...

gps2pw.py example run

The script produces a .txt file from a .gpx file.  One then simply copies the text into the body of an email to tracking@predictwind.com.  Here's an example...

Tracking Update email to PredictWind

Within a few minutes a response email is returned to you summarising the fixes and any errors.  Here's an example...

Response email from PredictWind

After sending some single tracks I started concatenating multiple tracks into a single email.  This worked too, including one covering our cruise from South Africa to the UK via the Caribbean.  The response took about 15 minutes.  You can actually see the processing happening if you watch your tracking web page during the processing - refresh the page occasionally.

The tracks sent to PW can append to your existing PW tracks, fill in gaps, and add historic tracks.  The processing done by PW seems very robust which is actually quite impressive.  Gaps in your tracks are shown as direct (actually great circle) between those around it.  It's easy to find these and then upload the missing track - if you've got it!

Our tracking page (link at top-right of this page) now includes our tracks from here in Grenada back to our purchase of Zen Again in 2010 in Brisbane.  Pretty cool.  Spot the gaps!

If you'd like your tracks translated add a comment below.  It'll cost you a few beers!

Zen Again Track 2010-2015

Trust all's well where you are!


No comments:

Post a Comment