Tcl Library Source Code

Documentation
Login
EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

gpx - Extracts waypoints, tracks and routes from GPX files

Table Of Contents

SYNOPSIS

package require Tcl 8.5 9
package require gpx ?1.1?

::gpx::Create gpxFilename ?rawXML?
::gpx::Cleanup token
::gpx::GetGPXMetadata token
::gpx::GetWaypointCount token
::gpx::GetAllWaypoints token
::gpx::GetTrackCount token
::gpx::GetTrackMetadata token whichTrack
::gpx::GetTrackPoints token whichTrack
::gpx::GetRouteCount token
::gpx::GetRouteMetadata token whichRoute
::gpx::GetRoutePoints token whichRoute

DESCRIPTION

This module parses and extracts waypoints, tracks, routes and metadata from a GPX (GPS eXchange) file. Both GPX version 1.0 and 1.1 are supported.

COMMANDS

DATA STRUCTURES

EXAMPLE

% set token [::gpx::Create myGpxFile.gpx]
% set version [dict get [::gpx::GetGPXMetadata $token] version]
% set trackCnt [::gpx::GetTrackCount $token]
% set firstPoint [lindex [::gpx::GetTrackPoints $token 1] 0]
% lassign $firstPoint lat lon ptMetadata
% puts "first point in the first track is at $lat, $lon"
% if {[dict exists $ptMetadata ele]} {
     puts "at elevation [dict get $ptMetadata ele] meters"
  }
% ::gpx::Cleanup $token

REFERENCES

  1. GPX: the GPS Exchange Format (http://www.topografix.com/gpx.asp)

  2. GPX 1.1 Schema Documentation (http://www.topografix.com/GPX/1/1/)

  3. GPX 1.0 Developer's Manual (http://www.topografix.com/gpx_manual.asp)

AUTHOR

Keith Vetter

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category gpx of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

KEYWORDS

gps, gpx

CATEGORY

File formats

COPYRIGHT

Copyright © 2010, Keith Vetter