[libgeo-point-perl] 01/06: Add patches to fix the Geo::Distance integration.

Bas Couwenberg sebastic at xs4all.nl
Fri Jan 17 19:18:53 UTC 2014


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

sebastic-guest pushed a commit to branch master
in repository libgeo-point-perl.

commit ca7abad959ad8c5fa03858c5c3f6226963972fb9
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Jan 17 19:59:52 2014 +0100

    Add patches to fix the Geo::Distance integration.
    
    Add patches to fix the Geo::Distance integration.
    Thanks to Niko Tyni for the patches. (closes: #735744)
---
 debian/changelog                                   |  8 ++++
 .../patches/0001-Fix-distance-calculations.patch   | 48 ++++++++++++++++++++++
 ...e-degree-and-radian-custom-distance-units.patch | 47 +++++++++++++++++++++
 debian/patches/series                              |  2 +
 4 files changed, 105 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index ff76de4..a2ab0d4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+libgeo-point-perl (0.94-2) UNRELEASED; urgency=low
+
+  * Team upload.
+  * Add patches to fix the Geo::Distance integration.
+    Thanks to Niko Tyni for the patches. (closes: #735744)
+
+ -- Bas Couwenberg <sebastic at xs4all.nl>  Fri, 17 Jan 2014 19:58:13 +0100
+
 libgeo-point-perl (0.94-1) unstable; urgency=low
 
   [ upstream ]
diff --git a/debian/patches/0001-Fix-distance-calculations.patch b/debian/patches/0001-Fix-distance-calculations.patch
new file mode 100644
index 0000000..262531d
--- /dev/null
+++ b/debian/patches/0001-Fix-distance-calculations.patch
@@ -0,0 +1,48 @@
+From 7462faadd61d3e24661aa6ee1dab6febb6e575a1 Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Fri, 17 Jan 2014 16:22:19 +0200
+Subject: [PATCH 1/2] Fix distance calculations
+Bug-Debian: http://bugs.debian.org/735744
+
+Geo::Distance, at least version 0.20, doesn't offer a distance_calc()
+method at all.
+---
+ lib/Geo/Point.pm |  2 +-
+ t/11point.t      | 11 ++++++++++-
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+--- a/lib/Geo/Point.pm
++++ b/lib/Geo/Point.pm
+@@ -230,7 +230,7 @@ sub distancePointPoint($$$)
+ 
+     my $here  = $self->in('wgs84');
+     my $there = $other->in('wgs84');
+-    $geodist->distance_calc($units, $here->latlong, $there->latlong);
++    $geodist->distance($units, $here->latlong, $there->latlong);
+ }
+ 
+ 
+--- a/t/11point.t
++++ b/t/11point.t
+@@ -8,7 +8,7 @@ use warnings;
+ 
+ use lib qw(. lib tests ../MathPolygon/lib ../../MathPolygon/lib);
+ 
+-use Test::More tests => 39;
++use Test::More tests => 40;
+ 
+ use Geo::Point;
+ use Geo::Proj;
+@@ -91,3 +91,12 @@ is($p->string, 'point[utm-31](5.0000 4.0
+ is($p->x, 5);
+ is($p->y, 4);
+ 
++#
++# distance
++#
++
++my $p1 = $gp->latlong(0, 1);
++my $p2 = $gp->latlong(1, 1);
++
++cmp_ok(abs($p1->distance($p2, 'nautical mile') - 60), '<', 0.1);
++
diff --git a/debian/patches/0002-Fix-the-degree-and-radian-custom-distance-units.patch b/debian/patches/0002-Fix-the-degree-and-radian-custom-distance-units.patch
new file mode 100644
index 0000000..0a97f13
--- /dev/null
+++ b/debian/patches/0002-Fix-the-degree-and-radian-custom-distance-units.patch
@@ -0,0 +1,47 @@
+From 056c53aff0c2a2b44be7df1d6ed67843005b5183 Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Fri, 17 Jan 2014 17:07:43 +0200
+Subject: [PATCH 2/2] Fix the 'degree' and 'radian' custom distance units
+Bug-Debian: http://bugs.debian.org/735744
+
+The error in reg_unit() call was probably a victim of a bug in
+Geo::Distance documentation, see http://bugs.debian.org/735682
+
+The geometrical interpretation of these distance units isn't
+obvious to me, so just check that results are nonzero.
+---
+ lib/Geo/Shape.pm | 4 ++--
+ t/11point.t      | 5 ++++-
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+--- a/lib/Geo/Shape.pm
++++ b/lib/Geo/Shape.pm
+@@ -90,8 +90,8 @@ sub distance($;$)
+     unless($geodist)
+     {   $geodist = Geo::Distance->new;
+         $geodist->formula('hsin');
+-        $geodist->reg_unit(radians => 1);
+-        $geodist->reg_unit(degrees => deg2rad(1));
++        $geodist->reg_unit(1 => 'radians');
++        $geodist->reg_unit(deg2rad(1) => 'degrees');
+         $geodist->reg_unit(km => 1, 'kilometer');
+     }
+ 
+--- a/t/11point.t
++++ b/t/11point.t
+@@ -8,7 +8,7 @@ use warnings;
+ 
+ use lib qw(. lib tests ../MathPolygon/lib ../../MathPolygon/lib);
+ 
+-use Test::More tests => 40;
++use Test::More tests => 42;
+ 
+ use Geo::Point;
+ use Geo::Proj;
+@@ -100,3 +100,6 @@ my $p2 = $gp->latlong(1, 1);
+ 
+ cmp_ok(abs($p1->distance($p2, 'nautical mile') - 60), '<', 0.1);
+ 
++isnt($p1->distance($p2, 'degrees'), 0);
++isnt($p1->distance($p2, 'radians'), 0);
++
diff --git a/debian/patches/series b/debian/patches/series
index 38edaa7..fbd2a9c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,3 @@
 spelling-errors.patch
+0001-Fix-distance-calculations.patch
+0002-Fix-the-degree-and-radian-custom-distance-units.patch

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



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