: out = gpxread (fname)
: out = gpxread (fname, …)

Read data from a gpx file.

Input argument fname (a character string) can be a valid file name or a valid URL (the latter experimental).

If no other input arguments are given gpxread will read all data in fname into one output struct out. The data to be read can be selected and/or limited by specifying one or more of the following optional property/value pairs (all case-insensitive):

  • "FeatureType’ This option (a mere "f" suffices) can be one of:

    "WayPoint or simply "w": Read waypoints.

    "Track" or "t": read tracks.

    "Route" or "t": read routes.

    "Auto" or "a" (default value): read all data.

    Multiple FeatureType property/value pairs can be specified.

  • "Index" The ensuing Index value should be a numeric value, or numeric vector, of indices of the features to be read. Works currently only for waypoints.

Output argument out is a struct array with field names Name, Lat, Lon, Ele, Time, and -in case of routes- Names. "Name" refers to the name of the waypoints, tracks or routes that have been read. "Lat", "Lon" and "Ele" refer to the latitude, longitude and (if present in the file) elevation of the various features, in case of tracks field "Time" refers to the time of the trackpoint (again, if present in the file). In case of tracks and routes these are vectors, each element corresponding to one track point. For each individual track multiple track segments are separated by NaNs. For routes the field "Names" contains a cell array holding the names of the individual route points. "Time" fields for waypoints are ignored.

Examples:

  A = gpxread ("trip2.gpx", "feature", "track", "index", 2);
  (which returns data from the second track in file "trip1.gpx")
  B = gpxread ("trip2.gpx", "f", "t", "f", "r");
  (which returns track and route data from file "trip2.gpx")

Package: mapping