GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  GEO::SHAPE (3)

.ds Aq ’

NAME

Geo::Shape - base class for 2-dimensional points on the earth surface

CONTENTS

INHERITANCE



 Geo::Shape is extended by
   Geo::Line
   Geo::Point
   Geo::Space
   Geo::Surface



SYNOPSIS



 use Geo::Shape;

 my $p1 = Geo::Point->new(lat => 2.17, ...);
 my $p2 = Geo::Point->latlong(2.17, 3.14);   # wgs84 is default

 my $p3 = $p1->in(wgs84);                  # conversion
 my $p4 = $p1->in(utm);                    # conversion



DESCRIPTION

Base class for the many geo-spatial objects defined by the GeoPoint distribution.

METHODS

    Constructors

Geo::Shape-><B>newB>(%options) Create a new object.



 -Option--Default
  proj    see Geo::Proj::defaultProjection()



proj => LABEL

    Attributes

$obj-><B>projB>() Returns the nickname of the projection used by the component. <B>Be warned:B> this is not a Geo::Point object, but just a label.
$obj-><B>proj4B>() Returns the proj4 object which handles the projection.

    Projections

$obj-><B>inB>(<$label|’utm’>) The coordinates of this point in a certain projection, refered to with the $label. The projection is defined with new(). When simply ’utm’ is provided, the best UTM zone is selected.

In LIST context, the coordinates are returned. In SCALAR context, a new object is returned.

example:



  my $gp       = Geo::Point->latlong(1,2);

  # implicit conversion to wgs84, if not already in latlong
  my ($lat, $long) = $pr->latlong;

  # will select an utm zone for you
  my $p_utm    = $gp->in(utm);
  my ($x, $y)  = $p_utm->xy;
  my $label    = $p_utm->proj;
  my ($datum, $zone) = $label =~ m/^utm-(\w+)-(\d+)$/;



$obj-><B>projectOnB>($nick, @points) The @points are ARRAYs with each an X and Y coordinate of a single point in space. A list of transformed points is returned, which is empty if no change is needed. The returned list is preceded by the projection nick of the result; usually the same as the provided $nick, but in some cases (for instance UTM) it may differ.

    Geometry

$obj-><B>areaB>() Returns the area covered by the geo structure. Points will return zero.
$obj-><B>bboxB>() Returns the bounding box of the object as four coordinates, respectively xmin, ymin, xmax, ymax. The values are expressed in the coordinate system of the object.
$obj-><B>bboxCenterB>() Returns a Geo::Point which represent the middle of the object. It is the center of the bounding box. The values is cached, once computed.

Be warned that the central point in one projection system may be quite different from the central point in some other projectionsystem .

$obj-><B>bboxRingB>([$xmin, $ymin, $xmax, $ymax, [$proj]])
Geo::Shape-><B>bboxRingB>([$xmin, $ymin, $xmax, $ymax, [$proj]]) Returns a Geo::Line which describes the outer bounds of the object called upon, counter-clockwise and left-bottom first. As class method, you need to specify the limits and the PROJection.
$obj-><B>distanceB>($object, [$unit]) Calculate the distance between this object and some other object. For many combinations of objects this is not supported or only partially supported.

This calculation is performed with Geo::Distance in accurate mode. The default $unit is kilometers. Other units are provided in the manual page of Geo::Distance. As extra unit, degrees and radians are added as well as the km alias for kilometer.

$obj-><B>perimeterB>() Returns the length of the outer border of the object’s components. For points, this returns zero.

    Display

$obj-><B>deg2dmB>($degrees, $pos, $neg)
Geo::Shape-><B>deg2dmB>($degrees, $pos, $neg) Like deg2dms() but without showing seconds.

example:



 print $point->deg2dm(0.12, e, w);
 print Geo::Shape->deg2dm(0.12, e, w);



$obj-><B>deg2dmsB>($degrees, $pos, $neg)
Geo::Shape-><B>deg2dmsB>($degrees, $pos, $neg) Translate floating point $degrees into a degrees minutes seconds notation. An attempt is made to handle rounding errors.

example:



 print $point->deg2dms(-12.34, E, W);     # --> 12d2024"W
 print Geo::Shape->deg2dms(52.1234, E, W); # --> 52d0724"E



$obj-><B>dms2degB>($dms)
Geo::Shape-><B>dms2degB>($dms) Accepts for instance 3d12’24.123, 3d12E, 3.12314w, n2.14, s3d12, -12d34, and returns floating point degrees.

OVERLOAD

overload: <B>’‘‘’’’ (stringification)B> Returns a string $proj($lat,$long) or $proj($x,$y). The $proj is the nickname you have assigned to the projection.
overload: <B>’bool’ (truth value)B> A point is always true: defined.

DIAGNOSTICS

Error: distance calculation not implemented between a $kind and a $kind Only a subset of all objects can be used in the distance calculation. The limitation is purely caused by lack of time to implement this.
Error: in() not implemented for a $class

SEE ALSO

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 geo-perl@list.hut.fi">http://geo-perl@list.hut.fi

LICENSE

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

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 GEO::SHAPE (3) 2014-01-21

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.