Skip Menu |

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

Report information
The Basics
Id: 121300
Status: resolved
Priority: 0/
Queue: Geo-Proj4

People
Owner: Nobody in particular
Requestors: p.dean [...] internode.on.net
Cc:
AdminCc:

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



Subject: issue with z coordinates in transform method
Date: Sun, 23 Apr 2017 07:22:04 +1000
To: bug-Geo-Proj4 [...] rt.cpan.org
From: Peter Dean <p.dean [...] internode.on.net>
This came to light when playing with the +geoidgrids option in proj4. There's 2 off-by-one bugs in one line and in my opinion it isn't wise to exclude the possibility of a zero z-value. Here's a patch. diff -Naur Geo-Proj4-1.06-E4U_U2/Proj4.xs Geo-Proj4-1.06-tANwy_/Proj4.xs --- Geo-Proj4-1.06-E4U_U2/Proj4.xs 2017-02-23 19:24:50.000000000 +1000 +++ Geo-Proj4-1.06-tANwy_/Proj4.xs 2017-04-23 07:00:37.153647666 +1000 @@ -166,7 +166,7 @@ x[p] = SvNV(*av_fetch(point, 0, 0)); y[p] = SvNV(*av_fetch(point, 1, 0)); - z[p] = av_len(point) < 3 ? 0.0 : SvNV(*av_fetch(point, 1, 0)); + z[p] = av_len(point) < 2 ? -10000.0 : SvNV(*av_fetch(point, 2, 0)); /* fprintf(stderr, "point=%f %f %f\n", x[p], y[p], z[p]); */ if(degrees && pj_is_latlong(proj_from)) @@ -192,7 +192,7 @@ av_push(res, newSVnv(x[p])); av_push(res, newSVnv(y[p])); - if(z[p]!=0.0) av_push(res, newSVnv(z[p])); + if(z[p]>-1000.0) av_push(res, newSVnv(z[p])); av_push(retlist, newRV((SV *)res)); } regards Peter Dean
Subject: Re: [rt.cpan.org #121300] issue with z coordinates in transform method
Date: Sun, 23 Apr 2017 11:02:28 +0200
To: Peter Dean via RT <bug-Geo-Proj4 [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Peter Dean via RT (bug-Geo-Proj4@rt.cpan.org) [170422 21:28]: Show quoted text
> Sat Apr 22 17:27:50 2017: Request 121300 was acted upon. > Transaction: Ticket created by p.dean@internode.on.net > Queue: Geo-Proj4 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=121300 > > > This came to light when playing with the +geoidgrids option in proj4. > There's 2 off-by-one bugs in one line and in my opinion it isn't wise to > exclude the possibility of a zero z-value.
Yes, reading the code, it looks that you are right. Many corners of libraries are rarely visited :( I'll create a new release when you have finished playing... maybe you find more issues. -- Thanks! MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #121300] issue with z coordinates in transform method
Date: Tue, 25 Apr 2017 07:00:36 +1000
To: bug-Geo-Proj4 [...] rt.cpan.org
From: Peter Dean <p.dean [...] internode.on.net>
I wasn't completely happy with the arbitrary z-values in my patch. Here's a new one using NAN to flag absence of z. It passes through the geoid calculation unscathed. diff -Naur Geo-Proj4-1.06-E4U_U2/Proj4.xs Geo-Proj4-1.06-tANwy_/Proj4.xs --- Geo-Proj4-1.06-E4U_U2/Proj4.xs 2017-02-23 19:24:50.000000000 +1000 +++ Geo-Proj4-1.06-tANwy_/Proj4.xs 2017-04-25 06:51:18.975521005 +1000 @@ -166,7 +166,7 @@ x[p] = SvNV(*av_fetch(point, 0, 0)); y[p] = SvNV(*av_fetch(point, 1, 0)); - z[p] = av_len(point) < 3 ? 0.0 : SvNV(*av_fetch(point, 1, 0)); + z[p] = av_len(point) < 2 ? NAN : SvNV(*av_fetch(point, 2, 0)); /* fprintf(stderr, "point=%f %f %f\n", x[p], y[p], z[p]); */ if(degrees && pj_is_latlong(proj_from)) @@ -192,7 +192,7 @@ av_push(res, newSVnv(x[p])); av_push(res, newSVnv(y[p])); - if(z[p]!=0.0) av_push(res, newSVnv(z[p])); + if(!isnan(z[p])) av_push(res, newSVnv(z[p])); av_push(retlist, newRV((SV *)res)); }
Forgot about this. Will be released as 1.07 later today.