METHODS

Constructors

$class->new( [NICK], OPTIONS )

Create a new object.

Option Default

name

<from proj4>

nick

<required>

proj4

<required>

srid

undef

name => STRING
nick => LABEL
The abbrevated name for this projection.
proj4 => OBJECT|ARRAY|STRING
The ARRAY or STRING will by used to create a Geo::Proj4 object by calling Geo::Proj4::new(). You may also specify such an prepared OBJECT.
srid => INTEGER
SRID stands for "Spatial Reference System ID", which is just an index in a table of spatial descriptions as used by SQL. Only INTEGER values larger than 0 are permitted.

Attributes

$obj->name

The full, official name of the projection

$obj->nick

Simple abbreviating of the projection.

$obj->proj4( [NICK|PROJ4] )
$class->proj4( [NICK|PROJ4] )

Returns the projection library handle (a Geo::Proj4) to be used by this component. As class method, the NICK is specified for a lookup. In case a PROJ4 is specified, that is returned.

» Example:
 my $wgs84 = Geo::Proj->new(nick => 'wgs84', ...);
 my $wgs84_proj4 = Geo::Proj->proj4('wgs84');
 my $wgs84_proj4 = Geo::Proj->proj4($wgs84);
 my $wgs84_proj4 = $wgs84->proj4;
$obj->srid

The "Spatial Reference System ID" if known.

Projecting

$class->defaultProjection( [NICK|PROJ] )

The NICK must be defined with new(). Returned is the nickname for a projection. The default is the first name created, which probably is 'wgs84' (when import() had a chance)

$class->dumpProjections( [FILEHANDLE] )

Print details about the defined projections to the FILEHANDLE, which defaults to the selected. Especially useful for debugging.

$class->listProjections

Returns a sorted lost of projection nicks.

$class->projection( NICK|PROJ )

Returns the Geo::Proj object, defined with NICK. In case such an object is passed in as PROJ, it is returned unaffected. This method is used where in other methods NICKS or PROJ can be used as arguments.

» Example:
 my $wgs84 = Geo::Proj->projection('wgs84');
 my $again = Geo::Proj->projection($wgs84);
$obj->to( [PROJ|NICK], PROJ|NICK, POINT|ARRAY_OF_POINTS )
$class->to( [PROJ|NICK], PROJ|NICK, POINT|ARRAY_OF_POINTS )

Expects an Geo::Proj to project the POINT or POINTS to. The work is done by Geo::Proj4::transform(). As class method, you have to specify two nicks or projections.

» Example:
 my $p2 = $wgs84->to('utm-wgs84-31', $p1);
 my $p2 = $wgs84->to($utm, $p1);
 my $p2 = Geo::Proj->to('wgs84', 'utm-wgs84-31', $p1);

UTM

$class->UTMprojection( DATUM|PROJ|undef, ZONE )

The PROJ is a Geo::Proj which is used to collect the datum information from if no DATUM was specified explicitly. It may also be a string which is the name of a datum, as known by proj4. Undef will be replaced by the default projection.

» Example:
 my $proj = Geo::Proj->UTMprojection('WGS84', 31) or die;
 print $proj->nick;    # for instance utm-wgs84-31
$obj->bestUTMprojection( POINT, [PROJ|NICK] )
$class->bestUTMprojection( POINT, [PROJ|NICK] )

Returns the best UTM projection for some POINT. As class method, you specify the nickname or the object for the point.

» Example:
 my $point = Geo::Point->longlat(2.234, 52.12);
 my $proj  = Geo::Proj->bestUTMprojection($point);
 print $proj->nick;    # for instance utm-wgs84-31
$obj->zoneForUTM( POINT )
$class->zoneForUTM( POINT )

Provided some point, figure-out which zone is most optimal for representing the point. In LIST context, zone number, zone letter, and meridian are returned as separate scalars. In LIST context, the zone number and letter are returned as one..

This code is stolen from manual Geo::Coordinates::UTM, because that module immediately starts to do computations with this knowledge, which is not wanted here. Probably a lot of zones are missing.