Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 17-06-2022, 14:34   #1
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 286
Converting tracks to .kml files

For many years I have published tracks of our cruising as .kml GooglMaps tracks. Until now, I had a process of exporting the latest few leg tracks as .gpx files, converting the file to .kml and then going through a series of grep edits to convert them to my chosen style (using BBEdit on a Mac). I then had to splice the latest tracks into the online .kml file and fix up the stopping places at the join. This has been tedious and error prone.

This season, I am using a new process, using a script for the JavaScript plugin, that does the whole task automatically with one click. It is a huge improvement and I share it here in case others find it useful.

The presentation of the resultant tracks is my own preference but can easily be modified according to taste. I show each stopping point as an icon of the appropriate mooring type (anchor, buoy or bollard). Clicking on it shows the arrival and departure date-time. Each leg is a different colour from the previous one and clicking on it reveals the leg name.

All tracks from previous cruises have a tag #A (for archived) in the track name and are ignored. At present, it is not possible for a plugin to identify that a track is in a layer. I have tracks from certain previous cruises in a layer. I tag these with 'Layer' in their name and these are also ignored.

I give each track a suitable name, e.g. 2022-05-27 Mevagissey to Marizion

I set the From and To track attributes accordingly, e.g.
  • In the From field: Mevagissey #buoy
  • In the To field: Marizion #anchor

What the script does
  1. Reads the tracks, ignoring any with a #A or Layer tag in its name
  2. Sorts the tracks by start time (deduced from the time-stamp of the first trackpoint)
  3. Checks that the position of the first trackpoint is close to (configurable) the last trackpoint of the previous leg and that the mooring types match. If the distance is greater than that configured, it is considered a break and separate end and start marks are created. The script copies in a .kml header section containing style definitions then inserts the .kml for the series of legs and the stopping marks and finally adds a .kml tail.

The resulting .kml file can be uploaded to my sailing blog site using any suitable FTP utility (I use Cyberduck on my Mac). This file is referenced from a minimal .html file which services the URL to display the track.

As the cruise develops, I rerun the script and it generates an updated file which includes the latest legs and which replaces the previous version.

Between cruises, I run a simple script that adds the #A tag into the track name of any tracks not already so tagged. Thus they will be excluded from the tracks of the next cruise.

As an example, here is a link to our present cruise track. It will develop as our cruise progresses.

Further details and the files can be found in the JavaScript plugin shared scripts library.
Antipole is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting PNG files to KAP files for usage in OpenCPN 58gschol OpenCPN 3 07-09-2019 06:46
oBabel plugin - Exporting KML/GPX to Chartplotters Rasbats OpenCPN 22 08-02-2016 08:03
KML Overlay Plugin SethDart OpenCPN 151 08-02-2015 06:55
OpenCPN / export KML COOGOR OpenCPN 4 25-09-2014 05:59
KML 2.2 super-overlays (pyramidical overlays) Rasbats OpenCPN 0 07-08-2012 11:07

Advertise Here


All times are GMT -7. The time now is 04:51.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.