Geo::Gpx::Point(3pm) | User Contributed Perl Documentation | Geo::Gpx::Point(3pm) |
Geo::Gpx::Point - Class to store and edit GPX Waypoints
use Geo::Gpx::Point;
Geo::Gpx::Point provides a data structure for GPX points and provides accessor methods to read and edit point data.
"lat" and "lon" 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' },
$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 = $ggp->clone;
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.
%options may be any of the following key/value pairs (all optional):
"dec =>
$decimals":
how many digits to return after the decimal point. Defaults to 6 but
this will change to 1 or 2 in the future.
"km =>
boole":
scale the return value to kilometers rather than meters (default is
false).
"rad =>
$radius":
the earth's radius in kilometers (see below).
$radius should rarely be specified unless the user knows what they are doing. The default is the global average of 6371 kilometers and any value outside the 6357 to 6378 range will be ignored. This implies that a given value would affect the returned distance by at most 0.16 percent versus the global average.
"as_string()" is called when using a "Geo::Gpx::Point" instance as a string.
Coming soon.
Patrick Joly "<patjol@cpan.org>".
1.10
perl(1).
2023-11-25 | perl v5.36.0 |