Geo-Ellipsoids-0.17/0000755000175000017500000000000014742617003013614 5ustar mdavismdavisGeo-Ellipsoids-0.17/Changes0000644000175000017500000000147614742615313015121 0ustar mdavismdavisRevision history for Perl module Geo::Ellipsoids 0.17 2025-01-17 - Moved from private repo to GitHub 0.16 2025-01-17 - Modernized package 0.15 2006-03-01 - Added test 0.14 2006-02-07 - Added second eccentricity, e' = ep methods 0.13 2006-01-21 - Documentation 0.12 2006-01-04 - Documentation 0.11 2006-12-10 - Documentation 0.10 2006-12-09 - Documentation 0.09 2006-12-08 - Added n_rad method - Changed prereq versions on Geo::* packages 0.08 2006-12-05 - Added n method 0.06 2006-11-28 - Added default for custom sphere case 0.05 2006-11-26 - Added Documentation - Changed indent of one if statement 0.04 2006-11-26 - Added Documentation 0.03 2006-11-26 - Added Documentation - Added Example 0.02 2006-11-25 - Fixed list method and example 0.01 2006-11-25 - Original version Geo-Ellipsoids-0.17/MANIFEST0000644000175000017500000000041714742617004014750 0ustar mdavismdavisChanges lib/Geo/Ellipsoids.pm LICENSE Makefile.PL MANIFEST README.md t/base.t perl-Geo-Ellipsoids.spec META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Geo-Ellipsoids-0.17/README.md0000644000175000017500000001122214742612262015073 0ustar mdavismdavis# NAME Geo::Ellipsoids - Package for standard Geo:: ellipsoid 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 Package for standard Geo:: ellipsoid a, b, f and 1/f values. # CONSTRUCTOR ## new The new() constructor may be called with any parameter that is appropriate to the set method. my $obj = Geo::Ellipsoid->new(); # METHODS ## initialize ## 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 ellipsoid 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; #b=a(1-f) ## f Method returns the value of flatting my $f=$obj->f; #f=(a-b)/a ## i Method returns the value of the inverse flatting my $i = $obj->i; #i=1/f=a/(a-b) ## invf Method synonym for the i method my $i = $obj->invf; #i=1/f ## e Method returns the value of the first eccentricity, e. This is the eccentricity of the earth's elliptical cross-section. my $e=$obj->e; ## e2 Method returns the value of eccentricity squared (e.g. e^2). This is not the second eccentricity, e' or e-prime see the "ep" method. my $e2 = sqrt($obj->e2); #e^2 = f(2-f) = 2f-f^2 = 1-b^2/a^2 ## ep Method returns the value of the second eccentricity, e' or e-prime. The second eccentricity is related to the first eccentricity by the equation: 1=(1-e^2)(1+e'^2). my $ep = $obj->ep; ## ep2 Method returns the square of value of second eccentricity, e' (e-prime). This is more useful in almost all equations. my $ep=sqrt($obj->ep2); #ep2=(ea/b)^2=e2/(1-e2)=a^2/b^2-1 ## n Method returns the value of n given latitude (degrees). Typically represented by the Greek letter nu, this is the radius of curvature of the ellipsoid perpendicular to the meridian plane. It is also the distance from the point in question to the polar axis, measured perpendicular to the ellipsoid's surface. my $n = $obj->n($lat); Note: Some define a variable n as (a-b)/(a+b) this is not that variable. Note: It appears that n can also be calculated as n = a^2/sqrt(a^2 * cos($lat)^2 + $b^2 * sin($lat)^2); ## n\_rad Method returns the value of n given latitude (radians). my $n_rad = $obj->n_rad($lat); Reference: John P. Snyder, "Map Projections: A Working Manual", USGS, page 25, equation (4-20) http://pubs.er.usgs.gov/usgspubs/pp/pp1395 ## rho rho is the radius of curvature of the earth in the meridian plane. my $rho=$obj->rho($lat); ## rho\_rad rho is the radius of curvature of the earth in the meridian plane. Sometimes denoted as R'. my $rho = $obj->rho_rad($lat); Reference: John P. Snyder, "Map Projections: A Working Manual", USGS, page 24, equation (4-18) http://pubs.er.usgs.gov/usgspubs/pp/pp1395 ## 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') # AUTHOR Michael R. Davis # LICENSE Copyright (c) 2006 Michael R. Davis This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. # SEE ALSO [Geo::Forward](https://metacpan.org/pod/Geo::Forward), [Geo::Ellipsoid](https://metacpan.org/pod/Geo::Ellipsoid), [Geo::Coordinates::UTM](https://metacpan.org/pod/Geo::Coordinates::UTM), [Geo::GPS::Data::Ellipsoid](https://metacpan.org/pod/Geo::GPS::Data::Ellipsoid), [GIS::Distance](https://metacpan.org/pod/GIS::Distance) Geo-Ellipsoids-0.17/lib/0000755000175000017500000000000014742617003014362 5ustar mdavismdavisGeo-Ellipsoids-0.17/lib/Geo/0000755000175000017500000000000014742617003015074 5ustar mdavismdavisGeo-Ellipsoids-0.17/lib/Geo/Ellipsoids.pm0000644000175000017500000003555114742611733017556 0ustar mdavismdavispackage Geo::Ellipsoids; use strict; use warnings; use Geo::Constants qw{PI}; use Geo::Functions qw{rad_deg}; our $VERSION = '0.17'; our $DEFAULT_ELIPS = 'WGS84'; =head1 NAME Geo::Ellipsoids - Package for standard Geo:: ellipsoid a, b, f and 1/f values. =head1 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"; =head1 DESCRIPTION Package for standard Geo:: ellipsoid a, b, f and 1/f values. =head1 CONSTRUCTOR =head2 new The new() constructor may be called with any parameter that is appropriate to the set method. my $obj = Geo::Ellipsoid->new(); =cut sub new { my $this = shift; my $class = ref($this) ? ref($this) : $this; my $self = {}; bless $self, $class; $self->initialize(@_); return $self; } =head1 METHODS =head2 initialize =cut sub initialize { my $self = shift; my $param = shift; $self->set($param); } =head2 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 =cut sub set { my $self = shift; my $param = shift || $DEFAULT_ELIPS; undef($self->{'shortname'}); undef($self->{'longname'}); if ('HASH' eq ref($param)) { return $self->_setref($param); } elsif ('' eq ref($param)) { return $self->_setname($param); } else { die('Error: Parameter must be the name of an ellipsoid or a hash reference'); } } =head2 list Method returns a list of known ellipsoid names. my @list=$obj->list; my $list=$obj->list; while (@$list) { print "$_\n"; } =cut sub list { my $self = shift; my $data = $self->data; my @keys = keys %$data; return wantarray ? @keys : \@keys; } =head2 a Method returns the value of the semi-major axis. my $a=$obj->a; =cut sub a { my $self = shift; return $self->{'a'} || die(q{Error: $self->{'a'} must be defined here}); } =head2 b Method returns the value of the semi-minor axis. my $b=$obj->b; #b=a(1-f) =cut sub b { my $self = shift; if (defined $self->{'b'}) { return $self->{'b'}; } elsif (defined $self->{'f'}) { return $self->{'a'}*(1-$self->{'f'}); } elsif (defined $self->{'i'}) { return $self->{'a'}*(1-1/$self->{'i'}); } else { return undef(); } } =head2 f Method returns the value of flatting my $f=$obj->f; #f=(a-b)/a =cut sub f { my $self = shift; if (defined $self->{'f'}) { return $self->{'f'}; } elsif (defined $self->{'b'}) { return ($self->{'a'}-$self->{'b'})/$self->{'a'}; } elsif (defined $self->{'i'}) { return 1/$self->{'i'}; } else { return undef(); } } =head2 i Method returns the value of the inverse flatting my $i = $obj->i; #i=1/f=a/(a-b) =cut sub i { my $self = shift; if (defined $self->{'i'}) { return $self->{'i'}; } elsif (defined $self->{'b'}) { if ($self->{'a'} == $self->{'b'}) { return undef(); } else { return $self->{'a'}/($self->{'a'}-$self->{'b'}); } } elsif (defined $self->{'f'}) { return 1/$self->{'f'}; } else { return undef(); } } =head2 invf Method synonym for the i method my $i = $obj->invf; #i=1/f =cut sub invf { my $self = shift; return $self->i(@_); } =head2 e Method returns the value of the first eccentricity, e. This is the eccentricity of the earth's elliptical cross-section. my $e=$obj->e; =cut sub e { my $self = shift; return sqrt($self->e2); } =head2 e2 Method returns the value of eccentricity squared (e.g. e^2). This is not the second eccentricity, e' or e-prime see the "ep" method. my $e2 = sqrt($obj->e2); #e^2 = f(2-f) = 2f-f^2 = 1-b^2/a^2 =cut sub e2 { my $self = shift; my $f = $self->f(); return $f*(2 - $f); } =head2 ep Method returns the value of the second eccentricity, e' or e-prime. The second eccentricity is related to the first eccentricity by the equation: 1=(1-e^2)(1+e'^2). my $ep = $obj->ep; =cut sub ep { my $self = shift; return sqrt($self->ep2); } =head2 ep2 Method returns the square of value of second eccentricity, e' (e-prime). This is more useful in almost all equations. my $ep=sqrt($obj->ep2); #ep2=(ea/b)^2=e2/(1-e2)=a^2/b^2-1 =cut sub ep2 { my $self = shift; my $a = $self->a(); my $b = $self->b(); return $a**2/$b**2 - 1; } =head2 n Method returns the value of n given latitude (degrees). Typically represented by the Greek letter nu, this is the radius of curvature of the ellipsoid perpendicular to the meridian plane. It is also the distance from the point in question to the polar axis, measured perpendicular to the ellipsoid's surface. my $n = $obj->n($lat); Note: Some define a variable n as (a-b)/(a+b) this is not that variable. Note: It appears that n can also be calculated as n = a^2/sqrt(a^2 * cos($lat)^2 + $b^2 * sin($lat)^2); =cut sub n { my $self = shift; my $lat = shift; #degrees die('Error: Latitude (degrees) required.') unless defined $lat; return $self->n_rad(rad_deg($lat)); } =head2 n_rad Method returns the value of n given latitude (radians). my $n_rad = $obj->n_rad($lat); Reference: John P. Snyder, "Map Projections: A Working Manual", USGS, page 25, equation (4-20) http://pubs.er.usgs.gov/usgspubs/pp/pp1395 =cut sub n_rad { my $self = shift; my $lat = shift; #radians die('Error: Latitude (radians) required.') unless defined $lat; my $a = $self->a; my $e2 = $self->e2; return $a / sqrt(1 - $e2 * sin($lat)**2); } =head2 rho rho is the radius of curvature of the earth in the meridian plane. my $rho=$obj->rho($lat); =cut sub rho { my $self = shift; my $lat = shift; #degrees die('Error: Latitude (degrees) required.') unless defined $lat; return $self->rho_rad(rad_deg($lat)); } =head2 rho_rad rho is the radius of curvature of the earth in the meridian plane. Sometimes denoted as R'. my $rho = $obj->rho_rad($lat); Reference: John P. Snyder, "Map Projections: A Working Manual", USGS, page 24, equation (4-18) http://pubs.er.usgs.gov/usgspubs/pp/pp1395 =cut sub rho_rad { my $self = shift; my $lat = shift; #radians die('Error: Latitude (radians) required.') unless defined $lat; my $a = $self->a; my $e2 = $self->e2; return $a * (1-$e2) / ( 1 - $e2 * sin($lat)**2 )**(3/2) #return $a * (1-$e2) / sqrt(1 - $e2 * sin($lat)**(3/2)); #Bad formula from somewhere } =head2 polar_circumference Method returns the value of the semi-minor axis times 2*PI. my $polar_circumference=$obj->polar_circumference; =cut sub polar_circumference { my $self = shift; return 2 * PI() * $self->b(); } =head2 equatorial_circumference Method returns the value of the semi-major axis times 2*PI. my $equatorial_circumference=$obj->equatorial_circumference; =cut sub equatorial_circumference { my $self = shift; return 2 * PI() * $self->a(); } sub _setref { my $self = shift; my $param = shift; if ('HASH' eq ref($param)) { if (defined($param->{'a'})) { $self->{'a'} = $param->{'a'}; $self->{'shortname'} = 'Custom' unless defined($self->shortname); if (defined $param->{'i'}) { $self->{'i'} = $param->{'i'}; undef($self->{'b'}); undef($self->{'f'}); $self->{'longname'} = 'Custom Ellipsoid {a=>'.$self->a.',i=>'.$self->i.'}' unless defined($self->longname); } elsif (defined $param->{'b'}){ $self->{'b'} = $param->{'b'}; undef($self->{'i'}); undef($self->{'f'}); $self->{'longname'} = 'Custom Ellipsoid {a=>'.$self->a.',b=>'.$self->b.'}' unless defined($self->longname); } elsif (defined $param->{'f'}){ $self->{'f'} = $param->{'f'}; undef($self->{'b'}); undef($self->{'i'}); $self->{'longname'} = 'Custom Ellipsoid {a=>'.$self->a.',f=>'.$self->f.'}' unless defined($self->longname); } else { $self->{'b'} = $param->{'a'}; undef($self->{'f'}); undef($self->{'i'}); $self->{'longname'} = 'Custom Sphere {a=>'.$self->a.'}' unless defined($self->longname); } } else { die('Error: a must be defined'); } } else { die('Error: a hash reference e.g. {a=>###, i=>###} must be define'); } return 1; } sub _setname { my $self = shift; my $param = shift; my $ref = $self->name2ref($param); if ('HASH' eq ref($ref)) { $self->{'shortname'}=$param; my $data = $self->data; my %data = map {$_, $data->{$_}->{'name'}} (keys %$data); $self->{'longname'} = $data{$param}; return $self->_setref($ref); } else { die("Error: Ellipsoid $param was not found"); } } =head2 shortname Method returns the shortname, which is the hash key, of the current ellipsoid my $shortname = $obj->shortname; =cut sub shortname { my $self = shift; return $self->{'shortname'}; } =head2 longname Method returns the long name of the current ellipsoid my $longname = $obj->longname; =cut sub longname { my $self = shift; return $self->{'longname'}; } =head2 data Method returns a hash reference for the ellipsoid definition data structure. my $datastructure = $obj->data; =cut sub data { #Information from # http://earth-info.nga.mil/GandG/coordsys/datums/datumorigins.html # http://www.ngs.noaa.gov/PC_PROD/Inv_Fwd/ return { WGS84=>{name=>'World Geodetic System of 1984', data=>{a=>6378137,i=>298.257223563}, alias=>[qw{WGS-84 NAD83 NAD-83}]}, GRS80=>{name=>'Geodetic Reference System of 1980', data=>{a=>6378137,i=>298.25722210088}, alias=>['GRS-80','GDA','Geocentric Datum of Australia']}, 'Clarke 1866'=>{name=>'Clarke Ellipsoid of 1866', data=>{a=>6378206.4,i=>294.9786982138}, alias=>[qw{NAD27 NAD-27}]}, 'Airy 1858'=>{name=>'Airy 1858 Ellipsoid', data=>{a=>6377563.396,i=>299.3249646}}, 'Airy Modified'=>{name=>'Modified Airy Spheroid', data=>{a=>6377340.189,b=>6356034.448}}, 'Australian National'=>{name=>'Australian National Spheroid of 1965', data=>{a=>6378160,i=>298.25}, alias=>['Australian 1965']}, 'Bessel 1841'=>{name=>'Bessel 1841 Ellipsoid', data=>{a=>6377397.155,i=>299.1528128}}, 'Clarke 1880'=>{name=>'Clarke Ellipsoid of 1880', data=>{a=>6378249.145,b=>6356514.966}}, 'Clarke 1866'=>{name=>'Clarke Ellipsoid of 1866', data=>{a=>6378206.4,b=>6356583.8}}, 'Danish 1876'=>{name=>'Danish Spheroid of 1876', data=>{a=>3271883.25*1.94903631,i=>300.00}}, 'Everest 1830'=>{name=>'Everest Spheroid of 1830', data=>{a=>6377276.345,i=>300.8017}}, 'Everest Modified'=>{name=>'Modified Everest Spheroid', data=>{a=>6377304.063,i=>300.8017}}, 'Fisher 1960'=>{name=>'Fisher 1960', data=>{a=>6378166,i=>298.3}}, 'Fisher 1968'=>{name=>'Fisher 1968', data=>{a=>6378150,i=>298.3}}, 'Hough 1956'=>{name=>'Hough 1956', data=>{a=>6378270,i=>297}}, 'International (Hayford)'=>{name=>'International - 1924 (Hayford - 1909)', data=>{a=>6378388,i=>297}}, 'Krassovsky 1938'=>{name=>'Krassovsky 1938', data=>{a=>6378245,i=>298.3}, alias=>['Krasovsky 1940']}, 'NWL-9D'=>{name=>'NWL-9D Ellipsoid', data=>{a=>6378145,i=>298.25}, alias=>['WGS-66'=>'World Geodetic System 1966']}, 'SA69'=>{name=>'South American 1969', data=>{a=>6378160,i=>298.25}, alias=>['SA-69']}, 'SGS85'=>{name=>'Soviet Geodetic System 1985', data=>{a=>6378136,i=>298.257}, alias=>['SGS-85']}, 'WGS72'=>{name=>'World Geodetic System 1972', data=>{a=>6378135,i=>298.26}, alias=>['WGS-72']}, 'WOS'=>{name=>'War Office Spheroid', data=>{a=>6378300.58,i=>296}}, 'UTM'=>{name=>'Department of the Army Universal Transverse Mercator', data=>{a=>6378249.2,b=>6356515.0}}, }; } =head2 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') =cut sub name2ref { my $self = shift; my $key = shift; my $data = $self->data; return $data->{$key}->{'data'}; } 1; __END__ =head1 AUTHOR Michael R. Davis =head1 LICENSE Copyright (c) 2006 Michael R. Davis This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO L, L, L, L, L =cut __END__ #Information from # http://earth-info.nga.mil/GandG/coordsys/datums/datumorigins.html # http://www.ngs.noaa.gov/PC_PROD/Inv_Fwd/ # # @DATA=([DATA, 0, a, #, i|b|f, #], ...); # @NAME=([NAME, 0, short_name, long_name], ...); # @ALIAS=([ALIAS, 0, alias, alias, alias,...], ...); DATA:0:a:6378137:i:298.257223563 NAME:0:WGS84:World Geodetic System of 1984 ALIAS:0:WGS-84:NAD83:NAD-83 DATA:1:a:6378137:i:298.25722210088 NAME:1:GRS80:Geodetic Reference System of 1980 ALIAS:1:GRS-80 DATA:2:a:6378206.4:i:294.9786982138 NAME:2:Clarke 1866:Clarke Ellipsoid - 1866 ALIAS:NAD27:NAD-27 DATA:3:a:6377563.396:i:299.3249646 NAME:3:Airy 1858:Airy 1858 #DATA:4:a:6377340.189:i:299.3249646 DATA:4:a:6377340.189:b:6356034.448 NAME:4:Airy Modified:Modified Airy Spheroid DATA:5:a:6378160:i:298.25 NAME:5:Australian National:Australian National Spheroid DATA:6:a:6377397.155:i:299.1528128 NAME:6:Bessel 1841:Bessel 1841 #DATA:7:a:6378249.145:i:293.465 DATA:7:a:6378249.145:b:6356514.966 NAME:7:Clarke 1880:Clarke 1880 DATA:8:a:6377276.345:i:300.8017 NAME:8:Everest 1830:Everest Spheroid 1830 DATA:9:a:6377304.063:i:300.8017 NAME:9:Everest Modified:Modified Everest Spheroid DATA:10:a:6378166:i:298.3 NAME:10:Fisher 1960:Fisher 1960 DATA:11:a:6378150:i:298.3 NAME:11:Fisher 1968:Fisher 1968 DATA:12:a:6378270:i:297 NAME:12:Hough 1956:Hough 1956 DATA:13:a:6378388:i:297 NAME:13:International (Hayford):International (Hayford) DATA:14:a:6378245:i:298.3 NAME:14:Krassovsky 1938:Krassovsky 1938 DATA:15:a:6378145:i:298.25 NAME:15:NWL-9D:NWL-9D Ellipsoid ALIAS:15:WGS-66:World Geodetic System 1966 DATA:16:a:6378160:i:298.25 NAME:16:SA69:South American 1969 ALIAS:16:SA-69 DATA:17:a:6378136:i:298.257 NAME:17:SGS85:Soviet Geodetic System 1985 ALIAS:17:SGS-85 DATA:18:a:6378135:i:298.26 NAME:18:WGS72:World Geodetic System 1972 ALIAS:18:WGS-72 DATA:19:a:6378300.58:i:296 NAME:19:WOS:War Office Spheroid DATA:20:a:6378249.2:b:6356515.0 NAME:20:UTM:Department of the Army Universal Transverse Mercator Geo-Ellipsoids-0.17/perl-Geo-Ellipsoids.spec0000644000175000017500000000270314742613737020263 0ustar mdavismdavisName: perl-Geo-Ellipsoids Version: 0.17 Release: 1%{?dist} Summary: Package for standard Geo:: ellipsoid a, b, f and 1/f values License: perl Group: Development/Libraries URL: http://search.cpan.org/dist/Geo-Ellipsoids/ Source0: http://www.cpan.org/modules/by-module/Geo/Geo-Ellipsoids-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: perl(Geo::Constants) >= 0.04 BuildRequires: perl(Geo::Functions) >= 0.03 Requires: perl(Geo::Constants) >= 0.04 Requires: perl(Geo::Functions) >= 0.03 Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) %description Package for standard Geo:: ellipsoid a, b, f and 1/f values %prep %setup -q -n Geo-Ellipsoids-%{version} %build %{__perl} Makefile.PL INSTALLDIRS=vendor make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \; %{_fixperms} $RPM_BUILD_ROOT/* %check make test %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %doc LICENSE README.md %{perl_vendorlib}/* %{_mandir}/man3/* %changelog * Fri Jan 17 2025 Michael R. Davis 0.16-1 - Specfile autogenerated by cpanspec 1.78. Geo-Ellipsoids-0.17/t/0000755000175000017500000000000014742617003014057 5ustar mdavismdavisGeo-Ellipsoids-0.17/t/base.t0000644000175000017500000000477614742605242015176 0ustar mdavismdavis#!/usr/bin/perl =head1 NAME base.t - Good examples concerning how to use this module =cut use strict; use warnings; use constant NEAR_DEFAULT => 7; sub near { my $x=shift(); my $y=shift(); my $p=shift()||NEAR_DEFAULT; if (($x-$y)/$y < 10**-$p) { return 1; } else { return 0; } } BEGIN { if (!eval q{ use Test; 1; }) { print "1..0 # tests only works with installed Test module\n"; exit; } } BEGIN { plan tests => 49 } # just check that all modules can be compiled ok(eval {require Geo::Ellipsoids; 1}, 1, $@); my $o = Geo::Ellipsoids->new(); ok(ref $o, "Geo::Ellipsoids"); my $obj=Geo::Ellipsoids->new(); $obj->set({a=>1,b=>1}); # a 1 unit sphere ok($obj->a, 1); ok($obj->b, 1); ok($obj->i, undef); ok($obj->f, 0); $obj->set({a=>1,b=>0.995}); ok($obj->a, 1); ok($obj->b, 0.995); ok($obj->i, 200); ok($obj->f, 0.005); $obj->set({a=>1,i=>200}); ok($obj->a, 1); ok($obj->b, 0.995); ok($obj->i, 200); ok($obj->f, 0.005); $obj->set({a=>1,f=>0.005}); ok($obj->a, 1); ok($obj->b, 0.995); ok($obj->i, 200); ok($obj->f, 0.005); $obj->set({a=>1}); ok($obj->a, 1); ok($obj->b, 1); ok($obj->i, undef()); ok($obj->f, 0); ok($obj->e, 0); ok near($obj->equatorial_circumference, 8 * atan2(1,1), 13); ok near($obj->polar_circumference, 8 * atan2(1,1), 13); $obj->set('WGS84'); ok($obj->a, 6378137); ok near($obj->b, 6356752.31424518, 13); ok($obj->i, 298.257223563); ok near($obj->f, 0.00335281066474748, 12); #For the Clarke 1866, e² is 0.006768658. $obj->set('Clarke 1866'); ok near($obj->e2, 0.006768658, 7); #For the GRS 80, e² is 0.0066943800. $obj->set('GRS80'); ok near($obj->e2, 0.0066943800, 6); $obj->set('WGS84'); ok($obj->shortname, "WGS84"); ok($obj->longname, "World Geodetic System of 1984"); ok near($obj->equatorial_circumference, 40075016.6855785, 13); ok near($obj->polar_circumference, 39940652.7422451, 13); #Just testing that n works. It is not my formula. ok(near $obj->n(39.56789), 6386817.167912991, 13); ok(near $obj->n_rad(0.690589958566939), 6386817.167912991, 13); my $a=$obj->a; my $b=$obj->b; my $i=$obj->i; my $f=$obj->f; my $e=$obj->e; my $e2=$obj->e2; my $ep2=$obj->ep2; #Run through a bunch of identities ok(near $i, 1/$f, 13); ok(near $i, $a/($a-$b), 13); ok(near $f, ($a-$b)/$a, 13); ok(near $b, $a*(1-$f), 13); ok(near 1, (1-$e2)*(1+$ep2), 13); ok(near $e2, $f*(2-$f), 13); ok(near $e2, 2*$f-$f**2, 13); ok(near $e2, 1-$b**2/$a**2, 13); ok(near $ep2, ($e*$a/$b)**2, 13); ok(near $ep2, $e2/(1-$e2), 13); ok(near $ep2, $a**2/$b**2-1, 13); ok(near $ep2, ($a**2-$b**2)/$b**2, 13); Geo-Ellipsoids-0.17/LICENSE0000644000175000017500000000026014051753704014621 0ustar mdavismdavisCopyright (c) 2006 Michael R. Davis (mrdvt92) All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Geo-Ellipsoids-0.17/Makefile.PL0000644000175000017500000000142414742610447015574 0ustar mdavismdavisuse ExtUtils::MakeMaker; WriteMakefile( NAME => 'Geo::Ellipsoids', VERSION_FROM => 'lib/Geo/Ellipsoids.pm', ABSTRACT_FROM => 'lib/Geo/Ellipsoids.pm', LICENSE => 'perl', PREREQ_PM => { 'Geo::Functions' => 0.03, 'Geo::Constants' => 0.04, }, 'META_MERGE' => { 'resources' => { 'repository' => { 'web' => 'https://github.com/mrdvt92/perl-Geo-Ellipsoids.git', 'url' => 'git@github.com:mrdvt92/perl-Geo-Ellipsoids.git', 'type' => 'git' }, 'homepage' => 'https://github.com/mrdvt92/perl-Geo-Ellipsoids', 'bugtracker' => { 'web' => 'https://github.com/mrdvt92/perl-Geo-Ellipsoids/issues' } }, 'meta-spec' => { 'version' => 2 } }, ); Geo-Ellipsoids-0.17/META.yml0000664000175000017500000000134414742617003015071 0ustar mdavismdavis--- abstract: 'Package for standard Geo:: ellipsoid a, b, f and 1/f values.' author: - unknown build_requires: ExtUtils::MakeMaker: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.52, CPAN::Meta::Converter version 2.150001' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Geo-Ellipsoids no_index: directory: - t - inc requires: Geo::Constants: '0.04' Geo::Functions: '0.03' resources: bugtracker: https://github.com/mrdvt92/perl-Geo-Ellipsoids/issues homepage: https://github.com/mrdvt92/perl-Geo-Ellipsoids repository: https://github.com/mrdvt92/perl-Geo-Ellipsoids.git version: '0.17' Geo-Ellipsoids-0.17/META.json0000664000175000017500000000235014742617003015237 0ustar mdavismdavis{ "abstract" : "Package for standard Geo:: ellipsoid a, b, f and 1/f values.", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.52, CPAN::Meta::Converter version 2.150001", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Geo-Ellipsoids", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Geo::Constants" : "0.04", "Geo::Functions" : "0.03" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/mrdvt92/perl-Geo-Ellipsoids/issues" }, "homepage" : "https://github.com/mrdvt92/perl-Geo-Ellipsoids", "repository" : { "type" : "git", "web" : "https://github.com/mrdvt92/perl-Geo-Ellipsoids.git" } }, "version" : "0.17" }