NAME
GPS::Track - Perl extension for parsing GPS Tracks
SYNOPSIS
use GPS::Track;
my $track = GPS::Track->new;
my @trackPoints = $track->parse($filename);
# Parse-Callback
my $track = GPS::Track->new(onPoint => sub { my $trackPoint = shift; });
my @trackPoints = $track->parse($filename);
DESCRIPTION
GPS::Track tries to parse common GPS Tracks recorded by diffrent GPS/Sports trackers.
Under the hood the conversion is done by calling gpsbabel on your system.
WARNING: This is a early Alpha! Use at your own risk!
ATTRIBUTES
onPoint
Callback which gets called for every parsed GPS::Track::Point. Gets the parsed GPX::Track::Point passed as argument.
$track->onPoint(sub { my $trackPoint = shift; $trackPoint->lon; });
Usefull for "in place statistics" to prevent useless looping over all points more than once.
METHODS
parse($filename)
Tries to parse the given filename and returning all the parsed GPX::Track::Points as an array.
Additionally if the 'onPoint' attribute is defined, it will be called for every parsed point.
convert($filename)
Converts the file from the identified format to the internaly used XML format.
my $xml = $track->convert($filename);
identify($filename)
Tries to identify the type of file by looking at the suffix.
TODO: Interpret file magic bytes.
my $format = $track->identify($filename);
INTERNAL METHODS
_convertFIT
Convert a .FIT file to TCX
_convertGPX
Convert .GPX file to TCX
_convertTCX
Convert .TCX fit to TCX
This may seem "useless". But in reality GPSBabel does a lot of cleanup for us when converting TCX 2 TCX.
gpsbabel_convert
Calls the gpsbabel binary and fetches the result vom STDOUT and returns a string as TCX.
my $tcx = $track->gpsbabel_convert($sourceFormat, $sourceFile)
SEE ALSO
To be done.
AUTHOR
Sven Eppler, <cpan@sveneppler.de>
COPYRIGHT AND LICENSE
Copyright (C) 2017 by Sven Eppler
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.0 or, at your option, any later version of Perl 5 you may have available.