I know I am coming to this a couple of weeks late, but I have been doing this for several years and thought I would add my 2 cents worth. Probably too late for OP, but may be useful for someone else later.

I used gpsbabel like this initially (in a JPSoft 4nt/tcmd script),

   gpsbabel -i gpx ^
            -f %fname ^
            -x nuketypes,tracks,routes ^
            -o xcsv,style=G7W-xcsv.style ^
            -F "%@name[%fname].csv"

%fname - variable containing source file name
%@name[ ... ] - function to extract basename from full filename

with this style sheet to generate .csv files in my desired format.

# gpsbabel XCSV style file
#
# Format:   G7toWin csv format
# Author:   John McMahon
#   Date:   2005may24
# Update:   2006jun02jmcm
#

DESCRIPTION G7toWin csv file format
#
# FILE LAYOUT DEFINITIONS
#

FIELD_DELIMITER   COMMA
RECORD_DELIMITER  NEWLINE
BADCHARS          COMMA
SHORTLEN          10

PROLOGUE Version 2:CSV
PROLOGUE Datum:,WGS-84
PROLOGUE ZoneOffset:,0.000000
PROLOGUE "Type","Name","Lat","Long","Month\#","Day#","Year","Hour","Min","Sec","Comment","Symbol#","SymbolColor","SymbolDisplay","Altitude (Meters)","Depth (Meters)","Ref Dist","Ref units"

#
# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE
#

IFIELD   CONSTANT,     "W", "%s"    # "Type",
IFIELD   SHORTNAME,     "", "%s"    # "Name",
IFIELD   LAT_DECIMAL,   "", "%f"    # "Lat",
IFIELD   LON_DECIMAL,   "", "%f"    # "Long",
IFIELD   IGNORE,        "", "%s"    # "Month#",
IFIELD   IGNORE,        "", "%s"    # "Day#",
IFIELD   IGNORE,        "", "%s"    # "Year",
IFIELD   IGNORE,        "", "%s"    # "Hour",
IFIELD   IGNORE,        "", "%s"    # "Min",
IFIELD   IGNORE,        "", "%s"    # "Sec",
IFIELD   IGNORE,    ,   "", "%s"    # "Comment",
IFIELD   IGNORE,        "", "%s"    # "Symbol#",
IFIELD   IGNORE,        "", "%s"    # "SymbolColor",
IFIELD   IGNORE,        "", "%s"    # "SymbolDisplay",
IFIELD   IGNORE,        "", "%s"    # "Altitude (Meters)",
IFIELD   IGNORE,        "", "%s"    # "Depth (Meters)",
IFIELD   IGNORE,        "", "%s"    # "Ref Dist",
IFIELD   IGNORE,        "", "%s"    # "Ref units"

However, I have recently replaced that with a perl script using the Geo::GPX module.

John


On 10/12/2018 10:17, no...@null.net wrote:
On Sun Dec 09, 2018 at 03:16:15PM -0700, Winfried wrote:
Good call, thank you.

For others' benefit:

1. Copy the file, open the copy in a text editor, use a regex to turn the
data into tab-separated columns

If you are running some kind of unix-like environment this is something
Perl can be quite useful for:

     grep '^<wpt' source.gpx | perl -p -E \
        's!<wpt lat="(.*)" lon="(.*)"><name>(.*)</name></wpt>!$1\t$2\t$3!' \
        > waypoints.tsv

2. Create a new file, and create the table:
sqlite3 waypoints.sqlite

sqlite> CREATE TABLE waypoints (name text, latitude text, longitude text, id
INTEGER PRIMARY KEY);

3. Import data:
sqlite> .separator "\t"
sqlite> .import waypoints.tsv waypoints
select * from waypoints where id=1;


--
Regards
   John McMahon
        j...@jspect.fastmail.com.au
        04 2933 4203

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to