Skip Menu |

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

Report information
The Basics
Id: 129851
Status: open
Priority: 0/
Queue: Geo-Proj4

People
Owner: Nobody in particular
Requestors: rowet [...] metsci.com
Cc:
AdminCc:

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



Subject: Doesn't work with cities in the eastern hemisphere?
Date: Wed, 19 Jun 2019 00:38:02 +0000
To: "bug-Geo-Proj4 [...] rt.cpan.org" <bug-Geo-Proj4 [...] rt.cpan.org>
From: "Rowe, Thomas" <rowet [...] metsci.com>
use warnings; use strict; use feature ':5.14'; use Geo::Proj4; my $proj_from = Geo::Proj4->new("+proj=latlong +datum=WGS84 +ellps=WGS84") or die "parameter error: ".Geo::Proj4->error. "\n"; my $proj_to = Geo::Proj4->new("+proj=eqc +datum=WGS84 +ellps=sphere +lat_ts=0") or die "parameter error: ".Geo::Proj4->error. "\n"; my $philadelphia = [ 39, -75]; my $sydney = [-33, 151]; my $tokyo = [ 35, 139]; my $london = [ 51, 0]; for ($philadelphia, $sydney, $tokyo, $london) { my @p = @{$proj_from->transform($proj_to, $_)} or die Geo::Proj4->error; say join ' ', @p; } __END__ Output: 4336600.09710257 -8328886.09705354 -12800.9191526175 inf inf inf inf 5670938.58851874 0 7140.00000000093
Subject: RE: [rt.cpan.org #129851] AutoReply: Doesn't work with cities in the eastern hemisphere?
Date: Wed, 19 Jun 2019 01:08:44 +0000
To: "bug-Geo-Proj4 [...] rt.cpan.org" <bug-Geo-Proj4 [...] rt.cpan.org>
From: "Rowe, Thomas" <rowet [...] metsci.com>
If I don't use Geo::Proj4 directly and use Geo::Proj instead this problem does not manifest. Feel free to declare OBE. Especially if you're rewriting to use proj.6 instead.
CC: ;
Subject: Re: [rt.cpan.org #129851] Doesn't work with cities in the eastern hemisphere?
Date: Thu, 20 Jun 2019 08:36:34 +0200
To: "Rowe, Thomas via RT" <bug-Geo-Proj4 [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Rowe, Thomas via RT (bug-Geo-Proj4@rt.cpan.org) [190619 01:10]: Show quoted text
> Queue: Geo-Proj4 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=129851 > > > If I don't use Geo::Proj4 directly and use Geo::Proj instead this > problem does not manifest. Feel free to declare OBE. Especially if you're > rewriting to use proj.6 instead.
Can you show me the script you use for Geo::Proj which does work? And are those sensible returns? And how does it behave from the command-line using cs2cs? The Geo::Proj4 wrapper around libproj is totally agnostic on projection parameters. The same for Geo::Proj. (Tried to get more Perl-guru's involved to code around library incompatibilities, but that did not help. Fighting for a day of spare time to dive deeper in the subject) -- MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: RE: [rt.cpan.org #129851] Doesn't work with cities in the eastern hemisphere?
Date: Thu, 20 Jun 2019 16:30:33 +0000
To: "bug-Geo-Proj4 [...] rt.cpan.org" <bug-Geo-Proj4 [...] rt.cpan.org>
From: "Rowe, Thomas" <rowet [...] metsci.com>
Sure. This is the same thing, just not using Proj4 directly. It works fine, whereas the other one produces floating point errors. use Geo::Proj; use Geo::Point; my $wgs84 = Geo::Proj->new ( nick => 'wgs84', proj4 => '+proj=latlong +datum=WGS84 +ellps=WGS84' ); my $eqc = Geo::Proj->new ( nick => 'eqc', proj4 => '+proj=eqc +datum=WGS84 +ellps=sphere +lat_ts=0' ); my $philadelphia = [ 39.0, -75.0]; my $sydney = [-33.0, 151.0]; my $tokyo = [ 35.0, 139.0]; my $london = [ 51.0, 0.0]; for ($philadelphia, $sydney, $tokyo, $london) { my $point_wgs84 = Geo::Point->latlong(@$_, 'wgs84'); my $point_eqc = $point_wgs84->in('eqc'); say $point_eqc; } Show quoted text
-----Original Message----- From: Mark Overmeer via RT [mailto:bug-Geo-Proj4@rt.cpan.org] Sent: Thursday, June 20, 2019 2:58 AM To: Rowe, Thomas Subject: Re: [rt.cpan.org #129851] Doesn't work with cities in the eastern hemisphere? <URL: https://rt.cpan.org/Ticket/Display.html?id=129851 > * Rowe, Thomas via RT (bug-Geo-Proj4@rt.cpan.org) [190619 01:10]:
> Queue: Geo-Proj4 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=129851 > > > If I don't use Geo::Proj4 directly and use Geo::Proj instead this > problem does not manifest. Feel free to declare OBE. Especially if you're > rewriting to use proj.6 instead.
Can you show me the script you use for Geo::Proj which does work? And are those sensible returns? And how does it behave from the command-line using cs2cs? The Geo::Proj4 wrapper around libproj is totally agnostic on projection parameters. The same for Geo::Proj. (Tried to get more Perl-guru's involved to code around library incompatibilities, but that did not help. Fighting for a day of spare time to dive deeper in the subject) -- MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Where you call transform() directly, the coordinates are in the wrong order. Internally, all is in (x, y) order (longlat), even when the projection is named latlong. This is also documented for the transform() method. The lat must be between -90 and +90, the long between -180 and +180. Apparently that is not a problem for wgs84 to eqc mapping as long as both coordinates are between -90..90 Some validation process returns (Inf,Inf) for illegal coords. (sorry that his answer took so long... too busy and holidays) On Tue Jun 18 20:39:19 2019, rowet@metsci.com wrote: Show quoted text
> use warnings; > use strict; > use feature ':5.14'; > > use Geo::Proj4; > > my $proj_from = Geo::Proj4->new("+proj=latlong +datum=WGS84 > +ellps=WGS84") or die "parameter error: ".Geo::Proj4->error. "\n"; > my $proj_to = Geo::Proj4->new("+proj=eqc +datum=WGS84 +ellps=sphere > +lat_ts=0") or die "parameter error: ".Geo::Proj4->error. "\n"; > > my $philadelphia = [ 39, -75]; > my $sydney = [-33, 151]; > my $tokyo = [ 35, 139]; > my $london = [ 51, 0]; > for ($philadelphia, $sydney, $tokyo, $london) { > my @p = @{$proj_from->transform($proj_to, $_)} or die Geo::Proj4-
> >error;
> say join ' ', @p; > } > > __END__ > Output: > > 4336600.09710257 -8328886.09705354 -12800.9191526175 > inf inf > inf inf > 5670938.58851874 0 7140.00000000093
On Thu Jun 20 12:30:52 2019, rowet@metsci.com wrote: Show quoted text
> my $philadelphia = [ 39.0, -75.0]; > my $sydney = [-33.0, 151.0]; > my $tokyo = [ 35.0, 139.0]; > my $london = [ 51.0, 0.0]; > for ($philadelphia, $sydney, $tokyo, $london) { > my $point_wgs84 = Geo::Point->latlong(@$_, 'wgs84'); > my $point_eqc = $point_wgs84->in('eqc');
I would prefer to write my $philadelphia = Geo::Point->latlong( 39.0, -75.0, 'wgs84'); my $sydney = Geo::Point->latlong(-33.0, 151.0, 'wgs84'); my $tokyo = Geo::Point->latlong( 35.0, 139.0, 'wgs84'); my $london = Geo::Point->latlong( 51.0, 0.0, 'wgs84'); foreach my $city($philadelphia, $sydney, $tokyo, $london) { my $in_eqc = $city->in('eqc'); The projection system is part of the city coordinate. Now the abstraction is better.