Web::GPX::Parser
GPX parser
SYNOPSIS
use Web::GPX::Parser;
my $parser = Web::GPX::Parser->new;
$parsed = $parser->parse_document ($document);
DESCRIPTION
The Web::GPX::Parser module is an implementation of the GPX parser. It accept a DOM document, which is expected to contain a GPX document, as the input, and returns a data structure that represents feed properties and entries extracted from the input document.
The module supports GPX 1.1 and a few extensions.
METHODS
$parser = Web::GPX::Parser-
Create a GPX parser object.
$parsed = $parser->parse_document ($document)-
Parse the input document and return the result object, if the document contains a GPX, or the
undefvalue otherwise.
DOCUMENT
The input document must be an object implementing the DOM Document interface using the DOM Perl Binding <https://wiki.suikawiki.org/n/DOM%20Perl%20Binding>, such as the Web::DOM::Document module <https://manakai.github.io/pod/Web/DOM/Document>.
PARSED DATA STRUCTURE
A GPX document, after parsing, is represented as a Perl hash reference $parsed, which has zero or more of following key/value pairs:
-
A person data structure, representing the author of the GPX document, if any.
$string = $parsed->{desc}-
The description of the GPX document, if any.
$string = $parsed->{generator}-
The description of the generating agent of the GPX document, if any.
$string = $parsed->{keywords}-
The keywords of the GPX document, if any.
$license = $parsed->{license}-
A licenes data structure, representing the license of the GPX document, if any.
($link, ...) = @{$parsed->{links}}-
Zero or more links associated with the GPX document.
$number = $parsed->{max_lat}-
The maximum latitude of the target area of the GPX document, if any. Note that it might be less than
$parsed->{min_lat}. $number = $parsed->{min_lat}-
The minimum latitude of the target area of the GPX document, if any.
$number = $parsed->{max_lon}-
The maximum longitude of the target area of the GPX document, if any. Note that it might be less than
$parsed->{min_lon}. $number = $parsed->{min_lon}-
The minimum longitude of the target area of the GPX document, if any.
($route, ...) = @{$parsed->{routes}}-
Zero or more route data structures, representing routes in the GPX document. There is always a
routesmember in the data strucuture. $timestamp = $parsed->{timestamp}-
The timestamp of the GPX document, if any. The value, if any, is a Web::DateTime object representing the time.
$tz = $parsed->{time_zone_offset}-
The time-zone offset of the GPX document, if any. The value, if any, is a Web::DateTime::TimeZone object representing the time-zone offset.
($track, ...) = @{$parsed->{tracks}}-
Zero or more track data structures, representing tracks in the GPX document. There is always a
tracksmember in the data strucuture. $timestamp = $parsed->{updated}-
The modified time of the GPX document, if any. The value, if any, is a Web::DateTime object representing the time.
($point, ...) = @{$parsed->{waypoints}}-
Zero or more point data structures, representing waypoints in the GPX document. There is always a
waypointsmember in the data strucuture.
A point is represented as a Perl hash reference $point, which has zero or more of following key/value pairs:
$number = $point->{accuracy}-
The accuracy value for the point, if any.
$number = $point->{age_of_dgps_data}-
The age of the DGPS data for the point, if any.
$number = $point->{cadence}-
The cadence value for the point, if any.
$string = $point->{comment}-
The comment of the point, if any.
$number = $point->{depth}-
The depth value for the point, if any.
$string = $point->{desc}-
The description of the point, if any.
$integer = $point->{dgps_id}-
The DGPS ID for the point, if any.
$number = $point->{distance}-
The distance value for the point, if any.
$number = $point->{to_distance}-
The to-distance value for the point, if any.
$number = $point->{elevation}-
The elevation of the point, if any.
$string = $point->{fix}-
The "fix" data of the point, if any.
$number = $point->{geoid_height}-
The geoid height of the point, if any.
$number = $point->{hdop}-
The "hdop" value of the point, if any.
$number = $point->{heartrate}-
The heartrate value for the point, if any.
$number = $point->{lat}-
The latitude of the point, if any.
$number = $point->{lon}-
The longitude of the point, if any.
($link, ...) = @{$point->{links}}-
Zero or more links associated with the point.
$number = $point->{magnetic_variation}-
The magnetic variation of the point, if any.
$string = $point->{name}-
The name of the point, if any.
$number = $point->{pdop}-
The "pdop" value of the point, if any.
$string = $point->{point_role}-
The point role of the point, if any. Note that the value might not be a valid point role string.
$number = $point->{power}-
The power value for the point, if any.
$string = $point->{road_type}-
The road type of the point, if any. Note that the value might not be a valid road type string.
$integer = $point->{satelite_count}-
The number of satelites for the point, if any.
$string = $point->{source}-
The source of the point, if any.
$number = $point->{speed}-
The speed value for the point, if any.
$string = $point->{symbol_name}-
The symbol name of the point, if any.
$number = $point->{temperature}-
The temperature for the point, if any.
$timestamp = $point->{timestamp}-
The timestamp of the point, if any. The value, if any, is a Web::DateTime object representing the time.
$string = $point->{type}-
The type of the point, if any.
$number = $point->{vdop}-
The "vdop" value of the point, if any.
$number = $point->{water_temperature}-
The water temperature for the point, if any.
A route is represented as a Perl hash reference $route, which has zero or more of following key/value pairs:
$string = $route->{comment}-
The comment of the route, if any.
$string = $route->{desc}-
The desc of the route, if any.
($links, ...) = @{$route->{links}}-
The links associated with the route.
$string = $route->{name}-
The name of the route, if any.
$number = $route->{number}-
The number of the route, if any.
($point, ...) = @{$route->{points}}-
Zero or more point data structures, representing the points in the route. There is always a
pointsmember in the data strucuture. $string = $route->{source}-
The source of the route, if any.
$string = $route->{type}-
The type of the route, if any.
A track is represented as a Perl hash reference $track, which has zero or more of following key/value pairs:
$string = $track->{comment}-
The comment of the route, if any.
$string = $track->{desc}-
The desc of the route, if any.
($link, ...) = @{$track->{links}}-
Zero or more links associated with the track.
$string = $track->{name}-
The name of the route, if any.
$number = $track->{number}-
The number of the route, if any.
($segment, ...) = @{$track->{segments}]-
Zero or more track segment data structures, representing the segments in the track. There is always a
segmentsmember in the data strucuture. $string = $track->{source}-
The source of the route, if any.
$string = $track->{type}-
The type of the route, if any.
A track segment is represented as a Perl hash reference $segment, which has zero or more of following key/value pair:
($point, ...) = @{$segment->{points}}-
Zero or more point data structures, representing the points in the route. There is always a
pointsmember in the data strucuture.
A person is represented as a Perl hash reference $person, which has zero or more of following key/value pairs:
$string = $person->{email}-
The email address of the person, if any. Note that the value might or might not be a valid email address.
$string = $person->{name}-
The name of the person, if any.
$url = $person->{url}-
The canonicalized absolute URL of the Web page of the person, if any.
A link is represented as a Perl hash reference $link, which has one or more of following key/value pairs:
$string = $person->{text}-
The link label text of the link, if any.
$string = $person->{mime_type}-
The advisory MIME type string of the link, if any.
$url = $person->{url}-
The canonicalized absolute URL of the link destination.
A license is represented as a Perl hash reference $licenes, which has zero or more of following key/value pairs:
$string = $license->{holder}-
The license holder, if any.
$url = $license->{url}-
The canonicalized absolute URL of the Web page of the license, if any.
$integer = $license->{year}-
The year of the license in AD, if any.
SPECIFICATION
GPX Parsing <https://wiki.suikawiki.org/n/GPX%20Parsing>.
AUTHOR
Wakaba <wakaba@suikawiki.org>.
LICENSE
Copyright 2016-2021 Wakaba <wakaba@suikawiki.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.