Create a square from the STRING. The coordinates can be separated by a comma (preferrably), or blanks. When the coordinates end on NSEW, the order does not matter, otherwise lat-long or xy order is presumed.
This routine is very smart. It understands
PROJLABEL: <4 coordinates in any order, but with NSEW> ...
my $x = '5n 2n 3e e12'; # coordinates in any order my $x = '5e , 2n, 3n, e12'; # coordinates in any order my $x = '2.12-23.1E, N1-4'; # stretches my $x = 'wgs84: 2-5e, 1-8n'; # starts with projection my $x = 'wgs84: e2d12' -3d, n1, n7d12'34"'; my ($xmin, $ymin, $xmax, $ymax, $proj) = Geo::Line->bboxFromString($x); my $p = Geo::Line->ringFromString($x); # When parsing user applications, you probably want: my $p = eval { Geo::Line->bboxFromString($x) }; warn $@ if $@;
construct a line, which will probably not have the same begin and end point. The POINTS are passed as new(points), and the other OPTIONS are passed to new() as well.
When called as instance method, the projection, ring, and filled attributes are taken from the initiator.
Option | Defined in | Default |
---|---|---|
bbox | Math::Polygon | undef |
clockwise | Math::Polygon | undef |
filled | <false> | |
points | <data> | |
proj | Geo::Shape | |
ring | <false> |
my $point = Geo::Point->xy(1, 2); my $line = Geo::Line->new ( points => [$point, [3,4], [5,6], $point] , ring => 1 )'
Calls bboxFromString() and then produces a ring object from than.
Don't forget the eval
when you call this method.
Returns the Geo::Point for the point with the specified INDEX or indices.
In LIST context, this returns all points as separate scalars: each is a Geo::Point with projection information. In SCALAR context, a reference to the coordinates is returned.
With points(), you get arrays with XY coordinates returned, but without the projection information. That will be much faster, but not sufficient for some uses.
Returns a true value is the internals of the ring of points are declared to belong to the shape.
Returns a true value if the sequence of points are a ring or filled: the first point is the last.
Returns the area enclosed by the polygon. Only useful when the points are in some orthogonal projection.
If you think you have a ring of points (a polygon), than do specify that when that object is instantiated (ring() or new(ring)).
The bounding box coordinates. These are more useful for rings than for open line pieces.
Clip the shape to the bounding box of OBJECT, or the boxing parameters specified. A list of Geo::Line objects is returned if anything is inside the object.
On the moment Math::Polygon::lineClip() and Math::Polygon::fillClip1() are used to do the job. In the future, that may change.
The length of the line, only useful in a orthogonal coordinate system (projection). See also perimeter().
The length of the line on the ring. A check is performed that the ring is closed, but further this returns the result of length()
See Transformations in Math::Polygon