[libgeo-coordinates-utm-perl] 18/30: Imported Upstream version 0.10

dom at earth.li dom at earth.li
Sat Apr 23 15:53:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

dom pushed a commit to branch master
in repository libgeo-coordinates-utm-perl.

commit 9f8511fd2fa20fa844148c39fe84004e226b1a89
Author: Dominic Hargreaves <dom at earth.li>
Date:   Sat Apr 20 23:34:44 2013 +0100

    Imported Upstream version 0.10
---
 Changes               | 11 ++++++--
 MANIFEST              |  1 +
 META.yml              | 42 ++++++++++++++--------------
 Makefile.PL           |  0
 README                |  3 +-
 UTM.pm                | 29 ++++++++++++++------
 t/01_basic_settings.t |  0
 t/02_points.t         |  0
 t/03_mgrs.t           | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 128 insertions(+), 34 deletions(-)

diff --git a/Changes b/Changes
old mode 100755
new mode 100644
index 1cfb241..bb50bb1
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-Revision history for Perl extension Geo::Coord.
+Revision history for Perl extension Geo::Coordinates::UTM.
 
 0.01  Wed Sep 27 12:37:38 2000
 	- original version; created by h2xs 1.19
@@ -23,7 +23,12 @@ Revision history for Perl extension Geo::Coord.
 	- Addition of new ellipsoids
 	- Refinement of MGRS calculations
 	- Addition of latlon_to_utm_force_zone 
-0.08  Thu Dec 06 17:15:03
+0.08  Thu Dec 06 17:15:03 2007
 	- Refinement of MGRS calculations
-0.09  Mon May 17 16:30:32
+0.09  Mon May 17 16:30:32 2010
 	- Patched mgrs_to_utm to handle short MGRS strings
+0.10 Mon Mar 25 19:05:12 2013
+	- fixed error in Everest Pakistan ellipsoid axis
+	- Added Arc 1950 ellipsoid
+	- patched MGRS calculations for S. Hemisphere
+	- Added MGRS tests
\ No newline at end of file
diff --git a/MANIFEST b/MANIFEST
old mode 100755
new mode 100644
index 48324ed..4eb2551
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,4 +5,5 @@ MANIFEST
 README
 t/01_basic_settings.t
 t/02_points.t
+t/03_mgrs.t
 META.yml                                 Module meta-data (added by MakeMaker)
diff --git a/META.yml b/META.yml
old mode 100755
new mode 100644
index 4c7354d..7eacba9
--- a/META.yml
+++ b/META.yml
@@ -1,21 +1,21 @@
---- #YAML:1.0
-name:               Geo-Coordinates-UTM
-version:            0.09
-abstract:           Convert LatLon to UTM and vice versa
-author:
-    - Graham Crookham (grahamc at cpan.org)
-license:            unknown
-distribution_type:  module
-configure_requires:
-    ExtUtils::MakeMaker:  0
-build_requires:
-    ExtUtils::MakeMaker:  0
-requires:  {}
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.55_02
-meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+--- #YAML:1.0
+name:               Geo-Coordinates-UTM
+version:            0.10
+abstract:           Convert LatLon to UTM and vice versa
+author:
+    - Graham Crookham (grahamc at cpan.org)
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:  {}
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.55_02
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4
diff --git a/Makefile.PL b/Makefile.PL
old mode 100755
new mode 100644
diff --git a/README b/README
old mode 100755
new mode 100644
index a23c702..0bcb3c6
--- a/README
+++ b/README
@@ -137,6 +137,7 @@ EXAMPLES
     27 Everest 1969 Malaysia
     28 Everest Pakistan
     29 Indonesian 1974
+	30 Arc 1950
 
   ellipsoid_names
 
@@ -289,7 +290,7 @@ THANKS
     Peder Stray for the short MGRS patch
 
 COPYRIGHT
-    Copyright (c) 2000,2002,2004,2007,2010 by Graham Crookham. All rights reserved.
+    Copyright (c) 2000,2002,2004,2007,2010,2013 by Graham Crookham. All rights reserved.
 
     This package is free software; you can redistribute it and/or modify it
     under the same terms as Perl itself.
diff --git a/UTM.pm b/UTM.pm
old mode 100755
new mode 100644
index a3701f3..0b5f7ae
--- a/UTM.pm
+++ b/UTM.pm
@@ -12,7 +12,7 @@ our @EXPORT  = qw( latlon_to_utm  latlon_to_utm_force_zone
                    latlon_to_mgrs mgrs_to_utm mgrs_to_latlon
 		   ellipsoid_info ellipsoid_names );
 
-our $VERSION = '0.09';
+our $VERSION = '0.10';
 
 use Math::Trig;
 my $deg2rad =  pi / 180;
@@ -66,8 +66,18 @@ BEGIN {  # Initialize this before other modules get a chance
     , [ "Everest 1969 Malaysia", 6377296, 0.006637847]
     , [ "Everest Pakistan", 6377296, 0.006637534]
     , [ "Indonesian 1974", 6378160, 0.006694609]
+	, [ "Arc 1950", 6378249.145,0.006803481]
     );
 
+# calc ecc  as  
+# a = semi major axis
+# b = semi minor axis
+# e^2 = (a^2-b^2)/a^2	
+# For clarke 1880 (Arc1950) a=6378249.145 b=6356514.966398753
+# e^2 (40682062155693.23 - 40405282518051.34) / 40682062155693.23
+# e^2 = 0.0068034810178165
+	
+
   foreach my $el (@Ellipsoid)
   {   my ($name, $eqrad, $eccsq) = @$el;
       $Ellipsoid{$name} = $el;
@@ -279,7 +289,7 @@ sub utm_to_mgrs($$$)
      unless _valid_utm_zone $zone_letter;
 
    my $northing_zones="ABCDEFGHJKLMNPQRSTUV";
-   my $rnd_north=sprintf("%.0f",$northing);
+   my $rnd_north=sprintf("%d",$northing);
    my $north_split=length($rnd_north)-5;
    $north_split=0 if $north_split < 0;
    my $mgrs_north=substr($rnd_north,(length($rnd_north)-5));
@@ -290,7 +300,7 @@ sub utm_to_mgrs($$$)
    $num_north-=20 until $num_north <20;
    my $lett_north=substr($northing_zones,$num_north,1);
 
-   my $rnd_east=sprintf("%.0f",$easting);
+   my $rnd_east=sprintf("%d",$easting);
    my $east_split=length($rnd_east)-5;
    $east_split=0 if $east_split < 0;
    my $mgrs_east=substr($rnd_east,(length($rnd_east)-5));
@@ -322,8 +332,9 @@ sub latlon_to_mgrs($$$)
 
 sub mgrs_to_utm($)
 {  my ($mgrs_string) = @_;
-
-   my $zone = substr($mgrs_string,0,3);
+   my $zone = substr($mgrs_string,0,2);
+   $mgrs_string = "0$mgrs_string" if !($zone =~ /^\d+$/);
+   $zone = substr($mgrs_string,0,3);
    my $zone_number = $zone;
    my $zone_letter = chop $zone_number;
 
@@ -379,16 +390,14 @@ sub mgrs_to_utm($)
    }
    else {
        #Southern Hemisphere
-       #my $tmpNorth=index('MLKJHGFEDC',$zone_letter);
        my $tmpNorth=index('CDEFGHJKLM',$zone_letter);
-       $tmpNorth++;
        $tmpNorth*=8;
        $tmpNorth*=10/9;
        $tmpNorth=int((($tmpNorth-$north_pos)/20)+0.5)*20;
        $north_pos+=$tmpNorth;
        $north_pos*=100000;
        $north_pos-=100000;
-       $north_pos+=2000000;
+       $north_pos+=2000000 if $zone_letter ne "C";
        $y_coord+=$north_pos;
    }
 
@@ -531,6 +540,8 @@ The Ellipsoids available are as follows:
 
 =item 29 Indonesian 1974
 
+=item 30 Arc 1950
+
 =back
 
 
@@ -695,7 +706,7 @@ Peder Stray for the short MGRS patch
 
 =head1 COPYRIGHT
 
-Copyright (c) 2000,2002,2004,2007,2010 by Graham Crookham.  All rights reserved.
+Copyright (c) 2000,2002,2004,2007,2010,2013 by Graham Crookham.  All rights reserved.
     
 This package is free software; you can redistribute it
 and/or modify it under the same terms as Perl itself.             
diff --git a/t/01_basic_settings.t b/t/01_basic_settings.t
old mode 100755
new mode 100644
diff --git a/t/02_points.t b/t/02_points.t
old mode 100755
new mode 100644
diff --git a/t/03_mgrs.t b/t/03_mgrs.t
new file mode 100644
index 0000000..6115d4b
--- /dev/null
+++ b/t/03_mgrs.t
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+
+use Test::More tests =>118;
+BEGIN { use_ok ('Geo::Coordinates::UTM'); }
+
+use constant maxerror => 1e-2;
+
+use warnings;
+use strict;
+
+sub fleq ($$;$) {
+    if (abs($_[0] - $_[1]) < maxerror) {
+        pass($_[2]);
+    }
+    else {
+        fail($_[2]);
+        diag("floating point value $_[0] too different to reference $_[1]");
+    }
+}
+
+my $latlon = "CCDEFGHJKLMNPQRSTUVWXX";
+
+while(<DATA>) {
+    chomp;
+    next if /^\s*(?:#.*)?$/;
+
+    my ($ellipsoid, $latitude, $longitude, $mgrs) = split /\|/;
+    my ($m) = latlon_to_mgrs($ellipsoid, $latitude, $longitude);
+    is($m, $mgrs, "MGRS $.");
+
+    my ($lat, $lon) = mgrs_to_latlon($ellipsoid, $m);
+    fleq($lon, $longitude, "longitude $.");
+    fleq($lat, $latitude, "latitude $.");
+}
+
+__DATA__
+# ellipsoid|latitude|longitude|mgrs
+WGS-84|-15.038207087342|-169.633239244409|2LPJ4692336993
+Airy|-62.664347298066|-18.1318011641218|27EXL4689749077
+Bessel 1841 Nambia|-25.9668774017417|176.847283481794|60JVS8471328217
+Fischer 1968|35.6355896701843|-128.779407270838|9SWV1997243564
+Clarke 1880|-23.7249091815666|-58.725260492694|21KUP2412875382
+Clarke 1880|32.1214082107167|39.4139996279968|37SER3905453697
+Everest 1830 India|-77.8630147119741|-167.673126297052|3CVP3729056475
+Airy|18.3773457007429|166.226582243424|58QFF2956632235
+Australian National|56.0384628238617|-162.332085699794|3VXC6620413592
+GRS 1967|73.8433062387819|84.4955735592175|45XVB2223396218
+WGS-84|45.3359588450991|40.0400031298722|37TEL8148720798
+Helmert 1906|59.9201815839611|-99.2827685844408|14VMM8418942625
+Bessel 1841 Nambia |-14.7469801908782|85.8375051526079|45LUD7488269470
+WGS 66|76.7872465101191|65.0798587586657|41XNF5305723979
+Clarke 1880|-77.955182771371|144.231341269374|55CDP3552145300
+WGS-84|-46.0648299617229|79.4920266271394|44GLP8337197644
+Fischer 1968|-46.0648299617229|79.4920266271394|44GLP8337097630
+Airy|-29.748187686171|-135.405807319046|8JMN6076509275
+Airy|7.02664660839798|25.1759536336006|35NKH9852877035
+GRS 1980|-23.328081037079|-157.911520393938|4KFV1128219742
+Krassovsky|11.2850029025532|160.123416303008|57PXN2261647750
+Modified Fischer 1960|63.3429435572545|-65.5753780930164|20VLR7110826412
+Hough|18.8829467124758|-72.6426446845981|18QYF4834589517
+Bessel 1841 Nambia |-33.5599610482547|149.259628455931|55HGC0974084663
+Fischer 1968|-42.9864757600699|73.2901330922691|43GCN6059939255
+GRS 1967|19.5586150524789|78.6857081619374|44QKG5719264288
+International|52.870630356142|-150.706593044311|5UPU5436760466
+WGS 66|59.0836358798848|-60.7869841003324|20VPL2681951474
+Krassovsky|50.3319354501851|50.6262418599614|39UVR7339875702
+Hough|-67.0761049801843|17.6673796933028|33DXF1591557596
+Hough|44.6070598377999|-79.0353060704053|17TPK5590741178
+WGS 66|56.9743083375776|-0.986959536978418|30VXJ2236216335
+WGS-84|54.8376254894191|-30.4398113516179|25UFA6441379726
+Everest 1830 India|7.80734863804564|-94.7379708763827|15NUJ0838563327
+WGS-84|42.1388081786232|94.1239212872368|46TEM9287865799
+Modified Fischer 1960|-50.2668337384696|137.577966166824|53FPE8371928502
+Modified Fischer 1960|-16.0823420814511|-30.9872437684145|25KGC1529720901
+Airy|-66.2328424771405|-54.6449818303734|21DXG0588052719
+Everest 1830 India|-6.84757411014701|39.7458086007605|37MEN8239243096
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libgeo-coordinates-utm-perl.git



More information about the Pkg-perl-cvs-commits mailing list