NAME
Geo::Gpx::Point - Class to store and edit GPX Waypoints
SYNOPSIS
use Geo::Gpx::Point;
DESCRIPTION
Geo::Gpx::Point provides a data structure for GPX points and provides accessor methods to read and edit point data.
Constructor Method
- new( lat => $lat, lon => $lon [, ele => $ele, desc => $desc, … ] )
-
Create and return a new point as per the fields provided, which can be any of
lat lon ele time magvar geoidheight name cmt desc src link sym type fix sat hdop vdop pdop ageofdgpsdata dgpsid
. Most expect numberial values except:name
,cmt
,desc
,src
,sym
,type
,fix
that can contain strings.lat
andlon
are required, all others keys are optional.%fields = ( lat => 47.0871, lon => 70.9318, ele => 808.000, name => 'MSA', desc => 'A nice view of the River at the top'); $pt = Geo::Gpx::Point->new( %fields );
The
link
field is expected to be structured as:link => { href => 'http://hexten.net/', text => 'Hexten', type => 'Blah' },
- flex_coordinates( $lat, $lon, %fields )
-
Takes latitude and longitude decimal values or strings and returns a
Geo::Gpx::Point
object. The latitude should always appear before the longitude and both can be in formatted form (i.e Degrees, Minutes, Seconds or "dms") and the constructor will attempt to convert them to decimals. Any other %fields are optional.$pt = Geo::Gpx::Point->flex_coordinates( '47.0871', '-70.9318', desc => 'Mont Ste-Anne' );
If a string reference is passed as the first argument (instead of $lat and $lon), the constructor will attempt to parse it as coordinates (decimal-form only). For instance you can simply call
flex_coordinates( '47.0871 -70.9318' )
with or without a comma along with optional fields.$str_ref = \'47.0871 -70.9318'; $pt = Geo::Gpx::Point->flex_coordinates($str_ref, desc => 'Mont Ste-Anne' );
AUTOLOAD Methods
- field( $value )
-
Methods with respect to fields of the object can be autoloaded.
Possible fields consist of those listed and accepted by
new()
, specifically: lat, lon, ele, time, magvar, geoidheight, name, cmt, desc, src, link, sym, type, fix, sat, hdop, vdop, pdop, ageofdgpsdata, and dgpsid.Some fields may contain a value of 0. It is safer to check if a field is defined with
if (defined $point->ele)
rather thanif ($point->ele)
.Caution should be used if setting a $value as no checks are performed to ensure the value is appropriate or in the proper format.
Object Methods
- to_geocalc()
-
Returns a point as a Geo::Calc object.
- to_tcx()
-
Returns a point as a basic Geo::TCX::Trackpoint object, i.e. a point with only Position information. (Requires the Geo::TCX module.)
- summ()
-
For debugging purposes mostly. Summarizes the fields of point by printing to screen. Returns nothing.
Overloaded Methods
as_string()
is called when using a Geo::Gpx::Point
instance as a string.
EXAMPLES
Coming soon.
AUTHOR
Patrick Joly <patjol@cpan.org>
.
VERSION
1.04
SEE ALSO
perl(1).