### CSV to GPX Converter ###
#####################
❖ DOWNLOAD:
— Latest version: CSV to GPX to KML Converter v2.0 — 2023-06-26 (publishing date)
— See below for installation and other instructions.
———————————————————————————
❖ DESCRIPTION:
You’ve traveled and made a logbook, and now…
You want to see your trip on a map in Google Earth (or in OpenCPN and other chart plotters), with info for each waypoint?
Then this is for you.
This script converts Excel-like CSV file with dates and coordinates (and optionally other fields) to a GPS route in GPX format (compatible with OpenCPN and various online plotters), and to KML format (compatible with Google Earth).
This is a "niche" script indeed… But it might attract newcomers to XYplorer: there aren’t many alternatives, and the online converters are less than satisfying (when they work at all).
———————————————————————————
❖ USAGE:
— Select your CSV file, then run the script
A GPX file and a KML file with the same base name will be created
— (opt.) You can also select an already generated GPX file, then run the script
A KML file with the same base name will be created
———————————————————————————
❖ SCREENSHOT:
☛ From CSV source to: ⭢ GPX opened in OpenCPN, and ⭢ KML opened in Google Earth (both with first waypoint details)
———————————————————————————
❖ CSV REQUIREMENTS:
• First row:
— must contain the header name of each column
including at least (but in any order/position): Date, Latitude, Longitude
eg |Date|Latitude|Longitude| , |Date|Time|Latitude|Longitude|Description|...|
• Columns:
— must NOT contain " or ; (except in (opt.) column named "description" or "info")
• Coordinates:
— must be fraction of degrees, or degrees and fraction of minutes, but can NOT include seconds
eg valid: 32.0323 valid: 32°01.94' invalid: 32°01'56"
———————————————————————————
❖ NOTES:
• Waypoints data:
— Each row containing data for Date, Latitude, and Longitude will be converted into a waypoint
— Data (if any) in all other columns will be assigned to waypoint description
— Data (if any) in a column named "Description" or "Info" will be added last to waypoint description,
and can include line breaks (Alt+Enter), quotes, and semicolons
• Missing data:
— Rows with missing date will use date of previous row (i.e. treated as new hour/description of same day)
— Rows with missing or duplicate latitude/longitude will be considered as new description,
and appended (after a separator) to the description of the previous waypoint
(e.g. departure from the same waypoint but on a following day)
• Coordinates:
— can use suffix S / W or prefix - (dash sign) for South / West negative coordinates
— can use ° or * as the degree separator
— can use . or , as the minute decimal separator
— may contain ' or ’ or nothing as the minute sign
eg (all valid and equal) 22°16,65' S or -22*16.653 or -22.27750555
>> Latitudes and longitudes will be converted (if necessary) from regular
13° 31.88' S | 167° 20.6900' E
to GPX/KML compatible format (fraction of degrees)
-13.53134396 | 167.34484023
• Date:
— Dates can use - or / as the separator
— Date data with only 6 digits will be considered yy-mm-dd (e.g. 21-03-16)
If year is supposed to be at the end, use 4 digits dd-mm-yyyy (e.g. 16/03/2021)
— Date will be used for waypoint name (format customizable at start of script)
— Date will also be used as first entry of waypoint description (format customizable)
— Header name of the (optional) time/hour column, if present, must be "Time"
— Time data can use h or : as the separator (e.g. 12h00)
• Other:
— CSV file name will be used as route name
• KML:
— GPX to KML: Only GPX files generated by this script are supported
☛ Anomalies or bugs ?
There are already several safety belts, but definitely not for everything.
So if your GPX output isn’t working as expected, please comment with enough details on your source file and intended output.
———————————————————————————
And don't hesitate to post your questions, suggestions, comments...
Hoping some of you might find it useful !
Have a nice day,
Flux
##########################################################
##########################################################
###############
### Installation ###
###############
☛ Download the script (link above) and copy it into XYplorer scripts folder: <xyscripts>
☛ To run it, simply paste the following into the address bar then press ENTER:
::load "CSVtoGPXtoKML.xys";
—————————————————————————
v————————— OPTIONAL —————————v
☛ To make it more accessible, it’s advised to add it to your User Defined Commands (UDC), a catalog entry, a button...:
— User Defined Command
Open the UDC Manage Commands interface (Menu "User > Manage Commands…" or Ctrl+Alt+F9) and select the "Load Script File" category
Click the "New…" button and select "Add New Command" (or press INS), then fill in the two fields:
Caption: CSV to GPX to KML Converter
Script file: CSVtoGPXtoKML.xys
The script can now be run by clicking on Menu "User > Load Script File > CSV to GPX to KML Converter"
— Catalog
Right-click in your catalog and click on "Add New Item Here…", then fill in the two fields:
Caption: CSV to GPX to KML Converter
Location: ::load "CSVtoGPXtoKML.xys";
The script can now be run by clicking on the catalog entry "CSV to GPX to KML Converter"
— Button, method 1. Either add load "CSVtoGPXtoKML.xys"; to "On left click:" of a custom button, or
— Button, method 2. use the following snippet:
a) Paste ::snippet; into the address bar and press ENTER. A text box will open.
b) Paste the following and press OK. A new button will be created at the right end of your toolbar.
Code: Select all
Snip: CTB 1
XYplorer 11.60.0207, 05.10.2012 17:30:00
Action
NewUserButton
Name
CSV to GPX to KML
Icon
:hotlist
ScriptL
load "CSVtoGPXtoKML.xys";
ScriptR
FireClick
1
Version 1.6