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, ... )

Creates and returns a new GPX Point as per the fields provided. These can be any of lat lon ele time magvar geoidheight name cmt desc src link sym type fix sat hdop vdop pdop ageofdgpsdata dgpsid.

%point_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( %point_fields );
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' );
clone()

Returns a deep copy of the Geo::Gpx::Point.

$clone = $ggp->clone;

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 than if ($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.

summ()

For debugging purposes mostly. Summarizes the fields of point by printing to screen. Returns nothing.

as_string()

Returns a string with the coordinates e.g. lat="47.0871" lon="-70.9318".

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

$VERSION = '1.01'

SEE ALSO

perl(1).