Skip to main content
`Ctrl`+`K`

# TrackReader

TrackReader class offers static methods to load track or track collection from GPX, CSV or NMEA files. Geometry can be structured in coordinates or in a wkt.

See examples in Read/Write track(s) section.

## CSV files

static TrackReader.readFromCsv(path, id_E=-1, id_N=-1, id_U=-1, id_T=-1, separator=',', DateIni=-1, timeUnit=1, h=0, com='#', no_data_value=-999999, srid='ENUCoords', read_all=False, selector=None, verbose=False)

  Read track(s) from CSV file(s) with geometry structured in coordinates.

  The method assumes a single track in file.

  If only path is provided as input parameters: file format is infered from extension according to file track_file_format

  If only path and a string s parameters are provied, the name of file format is set equal to s.

  ### Parameters

  param str path

    file or directory

  param int id_E

    index (starts from 0) of column containing coordinate X (for ECEF), longitude (GEO) or E (ENU) -1 if file format is used

  param int id_N

    index (starts from 0) of column containing coordinate Y (for ECEF), latitude (GEO) or N (ENU) -1 if file format is used

  param int id_U

    index (starts from 0) of column containing Z (for ECEF), height or altitude (GEO/ENU) -1 if file format is used

  param int id_T

    index (starts from 0) of column containing timestamp (in seconds x timeUnit or in time_fmt format) -1 if file format is used

  param str separator

    separating characters (can be multiple characters). Can be c (comma), b (blankspace), s (semi-column)

  param GPSTime DateIni

    initial date (in time_fmt format) if timestamps are provided in seconds (-1 if not used)

  param float timeUnit

    number of seconds per unit of time in id_T column

  param int h

    number of heading line

  param str com

    comment character (lines starting with cmt on the top left are skipped)

  param int no_data_value

    a special float or integer indicating that record is non-valid and should be skipped

  param str srid

    coordinate system of points (“ENU”, “Geo” or “ECEF”)

  param bool read_all

    if flag read_all is True, read AF in the tag extension

  param Selector selector

    to select track with a Selection which combine different constraint

  return

    a track or a collection of tracks contains in wkt files.

## GPX files

static TrackReader.readFromGpx(path, srid='GEO', type='trk', read_all=False)

  Reads (multiple) tracks or routes from gpx file(s).

  ### Parameters

  param str path

    file or directory

  param str srid

    coordinate system of points (“ENU”, “Geo” or “ECEF”)

  param str type

    may be “trk” to load track points or “rte” to load vertex from the route

  param bool read_all

    if flag read_all is True, read AF in the tag extension

  rtype

    `TrackCollection`

  return

    collection of tracks contains in Gpx files.

## WKT files

API documentation:

static TrackReader.readFromWkt(path, id_geom, id_user=-1, id_track=-1, separator=';', h=0, srid='ENUCoords', bboxFilter=None, doublequote=False, verbose=False)

  Read track(s) (one per line) from a CSV file, with geometry provided in wkt.

  ### Parameters

  param str path

    csv file

  param int id_geom

    index of the column that contains the geometry

  param int id_user

    index of the column that contains the id of the user of the track

  param int id_track

    index of the column that contains the id of the track

  param str separator

    separating characters (can be multiple characters). Can be c (comma), b (blankspace), s (semi-column)

  param int h

    number of heading line

  param str srid

    coordinate system of points (“ENU”, “Geo” or “ECEF”)

  param ?? bboxFilter

  param bool doublequote

    when True, quotechar is doubled. When False, the escapechar is used as a prefix to the quotechar

  rtype

    `TrackCollection`

  return

    collection of tracks contains in wkt files.

## NMA files

API documentation:

static TrackReader.readFromNMEA(path, frame='GGA')

  The method assumes a single track in file.