Fork me on GitHub

GPXRead

Signatures

GPXRead(VARCHAR path);
GPXRead(VARCHAR path, VARCHAR tableName);
GPXRead(VARCHAR path, VARCHAR tableName, BOOLEAN deleteTables);

Description

Reads a GPX file from path and creates several tables prefixed by tableName representing the file’s contents. If deleteTables is equal to true, existing tables (with the same prefix) are removed.

Tables are produced depending on the content of the GPX file, and may include:

  • TABLENAME_WAYPOINT
  • TABLENAME_ROUTE
  • TABLENAME_ROUTEPOINT
  • TABLENAME_TRACK
  • TABLENAME_TRACKPOINT
  • TABLENAME_TRACKSEGMENT

By default, the tableName is the filename given in path without the extension.

Examples

-- Takes the table name from the filename, producing
-- * ROUTE_TRACK
-- * ROUTE_TRACKPOINT
-- * ROUTE_TRACKSEGMENT
CALL GPXRead('/home/user/route.gpx');

-- Uses the given table name, producing
-- * GPXDATA_TRACK
-- * GPXDATA_TRACKPOINT
-- * GPXDATA_TRACKSEGMENT
CALL GPXRead('/home/user/route.gpx', 'GPXDATA');

-- Existing tables starting with 'GPXDATA' will be removed
CALL GPXRead('/home/user/route.gpx', 'GPXDATA', true);

-- Produces STATION_WAYPOINT.
CALL GPXRead('/home/user/station.gpx');
See also