The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Geo::Ellipsoids - Standard perl Geo package for ellipsoids a, b, f and 1/f values.

SYNOPSIS

  use Geo::Ellipsoids;
  my $obj = Geo::Ellipsoids->new();
  $obj->set('WGS84'); #default
  print "a=", $obj->a, "\n";
  print "b=", $obj->b, "\n";
  print "f=", $obj->f, "\n";
  print "i=", $obj->i, "\n";
  print "e=", $obj->e, "\n";
  print "n=", $obj->n(45), "\n";

DESCRIPTION

CONSTRUCTOR

new

The new() constructor may be called with any parameter that is appropriate to the set method.

  my $obj = Geo::Ellipsoid->new();
    

METHODS

set

Method sets the current ellipsoid. This method is called when the object is constructed (default is WGS84).

  $obj->set(); #default WGS84
  $obj->set('Clarke 1866'); #All built in ellipsoids are stored in meters
  $obj->set({a=>1, b=>1});  #Custom Sphere 1 unit radius

list

Method returns a list of known elipsoid names.

  my @list=$obj->list;

  my $list=$obj->list;
  while (@$list) {
    print "$_\n";
  }

a

Method returns the value of the semi-major axis.

  my $a=$obj->a;

b

Method returns the value of the semi-minor axis.

  my $b=$obj->b;

f

Method returns the value of flatting

  my $f=$obj->f;

i

Method returns the value of the inverse flatting

  my $i=$obj->i;

invf

Method synonym for the i method

  my $i=$obj->infv;

e

Method returns the value of eccentricity

  my $e=$obj->e;

e2

Method returns the value of eccentricity squared (e.g. e^2)

  my $e=sqrt($obj->e2);

n

Method returns the value of n given latitude (degrees). #What is n called?

  my $n=$obj->n($lat);

n_rad

Method returns the value of n given latitude (radians). #What is n called?

  my $n=$obj->n_rad($lat);

polar_circumference

Method returns the value of the semi-minor axis times 2*PI.

  my $polar_circumference=$obj->polar_circumference;

equatorial_circumference

Method returns the value of the semi-major axis times 2*PI.

  my $equatorial_circumference=$obj->equatorial_circumference;

shortname

Method returns the shortname, which is the hash key, of the current ellipsoid

  my $shortname=$obj->shortname;

longname

Method returns the long name of the current ellipsoid

  my $longname=$obj->longname;

data

Method returns a hash reference for the ellipsoid definition data structure.

  my $datastructure=$obj->data;

name2ref

Method returns a hash reference (e.g. {a=>6378137,i=>298.257223563}) when passed a valid ellipsoid name (e.g. 'WGS84').

  my $ref=$obj->name2ref('WGS84')

TODO

What should we do about bad input? I tend to die in the module which for most situations is fine. I guess you could always overload die to handle exceptions for web based solutions and the like.

Support for ellipsoid aliases in the data structure

BUGS

Please send to the geo-perl email list.

LIMITS

No guarantees that Perl handles all of the double precision calculations in the same manner as Fortran.

AUTHOR

Michael R. Davis qw/perl michaelrdavis com/

LICENSE

Copyright (c) 2006 Michael R. Davis (mrdvt92)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Geo::Forward Geo::Ellipsoid Geo::Coordinates::UTM Geo::GPS::Data::Ellipsoid GIS::Distance