Geo::Gpx::Point(3pm)
π NAME π
okay so bestie, welcome to the Geo::Gpx::Point(3pm) page β¨ this is the class that stores and edits GPX Waypoints β like, the little dots on a map, but make it code π
πΈ SYNOPSIS πΈ
use Geo::Gpx::Point;
that's it. that's the whole vibe. go off π
π¦ DESCRIPTION π¦
Geo::Gpx::Point hands you a data structure for GPX points, plus a whole lil squad of accessor methods so you can read and edit the point data. no cap π
β¨ Constructor Method β¨
new( lat => $lat, lon => $lon [, ele => $ele, desc => $desc, β¦ ] )β makes a brand new point and returns it, using whatever fields you gave it. the fields can be any oflat lon ele time magvar geoidheight name cmt desc src link sym type fix sat hdop vdop pdop ageofdgpsdata dgpsid. most of them want number-y values, EXCEPTname,cmt,desc,src,sym,type,fixwhich are allowed to be strings π«Ά
lat and lon are required, every other key is optional, so don't stress.
%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 needs to be structured like this, iykyk:
link => { href => 'http://hexten.net/', text => 'Hexten', type => 'Blah' },
flex_coordinates( $lat, $lon, %fields )β takes latitude and longitude as decimal values or strings and returns aGeo::Gpx::Pointobject. latitude always comes before longitude, no exceptions bestie. both can be in formatted form (aka Degrees, Minutes, Seconds, akadms) and the constructor will try to convert them to decimals. any other%fieldsare optional β¨
$pt = Geo::Gpx::Point->flex_coordinates( '47.0871', '-70.9318', desc => 'Mont Ste-Anne' );
now if you pass a string reference as the first argument (instead of $lat and $lon), the constructor will try to parse it as coordinates β decimal-form only tho, don't get cute. so you can literally just call flex_coordinates( '47.0871 -70.9318' ) with or without a comma, plus 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 theGeo::Gpx::Point. yes, a deep copy. it's giving main character energy, not shared references π
$clone = $ggp->clone;
π AUTOLOAD Methods π
field( $value )β methods relating to the object's fields can be autoloaded. iconic behaviour tbh.
the possible fields are the ones 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 can hold a value of0, so it is safer to check if a field is defined withif (defined $point->ele)rather thanif ($point->ele). because0is falsy and that's a trap, bestie π
β οΈ also, caution should be used if setting a $value β no checks are performed to make sure the value is appropriate or in the proper format. so it's your world, but you could absolutely shoot your own foot π
π Object Methods π
distance_to( $pt or lat => $lat, lon => $lon, [ %options ] )β returns the distance in meters from theGeo::Gpx::Point$pt, or from the coordinates given by$latand$lon. it's calculated as the straight-line distance, ignoring any topography β so like, it does not care about the mountain in your way ποΈ.$ptmust be the first argument if you specify it.
%options can be any of these key/value pairs (all optional, all slay):
"dec => $decimals"β how many digits to return after the decimal point. defaults to6but this will change to1or2in 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. so yeah, leave it alone fr fr π
to_geocalc()β returns a point as aGeo::Calcobject. (requires that theGeo::Calcmodule be installed.) π§to_tcx()β returns a point as a basicGeo::TCX::Trackpointobject, i.e. a point with only Position information. (requires that theGeo::TCXmodule be installed.) π¦time_datetime ()β returns aDateTimeobject corresponding to the time of the point. thetime_zoneof the object will be'UTC'. specifytime_zone => $tzto set a different one πsumm()β for debugging purposes mostly. summarizes the fields of the point by printing to screen. returns nothing. it's giving "just vibes, no return value" πas_string()β returns a string with the coordinates, e.g.lat="47.0871" lon="-70.9318"β¨
π Overloaded Methods π
as_string() is called when you use a Geo::Gpx::Point instance as a string. so it just... becomes a string when you need it to. main character behaviour honestly π
π EXAMPLES π
Coming soon. (not me leaving you on read, i promise more is coming π)
π AUTHOR π
Patrick Joly <patjol@cpan.org>.
β VERSION β
1.11
π«Ά SEE ALSO π«Ά
and that's a wrap bestie πΈ this lil page came to you from perl v5.38.2, dated 2024-06-26, and it's the Geo::Gpx::Point(3pm) manual β go plot some waypoints, you absolute icon π
β¨π
π¦ where this page comes from
- debian trixie: libgeo-gpx-perl 1.11-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgeo-gpx-perl 1.11-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgeo-gpx-perl 1.11-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms