Geo::Point is a Geo::Shape
use Geo::Point;
my $p = Geo::Point->latlong(1,2);
my $p = Geo::Point->longlat(2,1);
my $w = Geo::Proj->new(wgs84 => ...);
my $p = Geo::Point->latlong(1,2, 'wgs84');
my ($lat, $long) = $p->latlong;
my ($x, $y) = $p->xy;
my ($x, $y) = $p->in('utm31-wgs84');
my $p = Geo::Point->xy(1,2);
One location on the globe, in any coordinate system. This package tries to hide the maths and the coordinate system in which the point is represented.
One of the most confusing things when handling geometrical data, is that sometimes latlong, sometimes xy are used: horizontal and vertical organization reversed. This package tries to hide this from your program by providing abstract accessors latlong(), longlat(), xy(), and yx().
Extends "DESCRIPTION" in Geo::Shape.
Extends "METHODS" in Geo::Shape.
Extends "Constructors" in Geo::Shape.
This routine is very smart. It understands:
PROJLABEL VALUE VALUE
PROJLABEL: VALUE VALUE
PROJLABEL, VALUE, VALUE
PROJLABEL: VALUE, VALUE
VALUE VALUE
VALUE, VALUE
utm: ZONE, VALUE, VALUE # also without commas and ':'
utm: VALUE, VALUE, ZONE # also without commas and ':'
utm: VALUE, VALUE # also without commas and ':'
ZONE, VALUE, VALUE # also without commas and ':'
VALUE, VALUE, ZONE # also without commas and ':'
The VALUE must be suitable for projection. If only two values are provided, a "d", single or double quote, or trailing/leading "e", "w", "n", "s" (either lower or upper-case) will force a latlong projection. Those coordinates must follow the rules of dms2deg().
example: point from string
my $x = 'utm 31n 12311.123 34242.12'; # utm zone 31N
my $x = '12311.123 34242.12 31'; # utm zone 31
my $x = '123.123E 12.34'; # wgs84 latlong
my $x = 'clrk66 123.123 12.34'; # clrk66 latlong
my $x = '12d34'123.1W 11.1123'; # wgs84 longlat
my $p = Geo::Point->fromString($x);
# When parsing user applications, you probably want:
my $p = eval { Geo::Point->fromString($x) };
warn $@ if $@;
As instance method, the latitude and longitude are reported. You can ask it to be translated into the $proj coordinate system first.
When $proj is undefined, none is presumed. The project must be specified as string, which referse to a projection defined by Geo::Proj. See also longlat(), xy(), and yx().
example: latlong as class method
my $wgs84 = Geo::Proj->new(wgs84 => ...);
my $gp = Geo::Point->latlong(52.3213, 5.53, 'wgs84');
example: latlong as instance method
my ($lat, $long) = $gp->latlong('wgs84');
-Option --Defined in --Default
lat undef
latitude undef
long undef
longitude undef
proj Geo::Shape see Geo::Proj::defaultProjection()
x undef
y undef
Extends "Attributes" in Geo::Shape.
The accessors only work correctly when you are sure that the point is in the right coordinate systems.
Extends "Projections" in Geo::Shape.
Extends "Geometry" in Geo::Shape.
Extends "Display" in Geo::Shape.
Be warned, that the returned string may contain single and double quote characters, which may confuse HTML (see dmsHTML()).
example: moving West
my $point = Geo::Point->latlong(24, 179);
$point->moveWest;
print $point->long; # -181;
example:
print "Point: ",$gp->toString, "\n";
print "Point: $gp\n"; # same
print "Point: ",$gp->toString('clrk66'), "\n";
Extends "OVERLOAD" in Geo::Shape.
This module is part of Geo-Point distribution version 0.96, built on January 21, 2014. Website: http://perl.overmeer.net/geo/ All modules in this suite: "Geo::Point", "Geo::Proj4", "Geo::WKT", "Math::Polygon", "Geo::GML", "Geo::ISO19139", "Geo::EOP", "Geo::Format::Envisat", and "Geo::Format::Landsat".
Please post questions or ideas to the mailinglist at http://geo-perl@list.hut.fi
Copyrights 2005-2014 by [Mark Overmeer]. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html