Skip Menu |

This queue is for tickets about the Geo-Point CPAN distribution.

Report information
The Basics
Id: 42076
Status: resolved
Priority: 0/
Queue: Geo-Point

People
Owner: Nobody in particular
Requestors: frequency [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.08
Fixed in: (no value)



I am running this Perl code: #!/usr/bin/perl use strict; use warnings; use Geo::Point; my $gp = Geo::Point->latlong(52.3213, -155.5313, 'wgs84'); my $gp2 = Geo::Point->latlong(30.0000, 30.0000, 'wgs84'); print "$gp\n"; print "$gp2\n"; my $line = Geo::Line->line($gp, $gp2); my $dist = $line->perimeter; print "point distance: $dist\n"; -- Parsing the latitude/longitude data into Geo::Point objects works perfectly. As does the stringification. So nothing gets mixed up while parsing. The problem is, when trying to construct a line between the two points (per the Geo::Line docs), the line cannot be constructed. -- Expected behaviour: the "arc length" across the curvature of the earth. I don't know the field-specific terminology for this, I'm not a cartographer by any means :-) Got: the following errors: point[wgs84](52.3213 -155.5313) point[wgs84](30.0000 30.0000) Not an ARRAY reference at /usr/local/share/perl/5.10.0/Geo/Line.pm line 185. This is with 'use strict' and 'use warnings' enabled. However, diagnostics are not enabled.
Subject: Re: [rt.cpan.org #42076]
Date: Fri, 2 Jan 2009 20:14:22 +0100
To: Jonathan Yu via RT <bug-Geo-Point [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Jonathan Yu via RT (bug-Geo-Point@rt.cpan.org) [090101 04:02]: Show quoted text
> Wed Dec 31 23:02:55 2008: Request 42076 was acted upon. > Transaction: Ticket created by FREQUENCY > Queue: Geo-Point > > my $gp = Geo::Point->latlong(52.3213, -155.5313, 'wgs84'); > my $gp2 = Geo::Point->latlong(30.0000, 30.0000, 'wgs84'); > my $line = Geo::Line->line($gp, $gp2);
I have made some fixes, after your report: see release 0.09. This should work as well: my $line = Geo::Line->line([52.3213, -155.5313], [30, 30], proj => 'wgs84'); Show quoted text
> my $dist = $line->perimeter;
my $dist = $line->length; If you read the docs, you find that it only works for orthogonal projection systems. wgs84 isn't working... The reason is that Geo::Point will not do complex calculations, but use the popular proj4 library as available via Geo::Proj4. Although that Proj4 package comes with a "geod" program which can do distance calculations, it is not integrated in the interface, so cannot be linked with Perl :( Looking at it, I saw a new geodesic implementation in http://members.verizon.net/~gerald.evenden/proj4/ But I do not know what the plans are about the near future. Of course, I would really like to support it (but too much work on my hands to investigate it on the moment...) What you can try is my $dist = $line->in('utm')->length; But I do not know the quality of the result. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
usage problem