Ticket #45 (closed defect: fixed)
Silent @null gridshift failure for points outside -180º/+180º
| Reported by: | rcoup | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Core | Version: | Development (trunk) |
| Keywords: | Cc: |
Description
Following on from http://trac.osgeo.org/gdal/ticket/2994
Test case is attached against trunk r1583.
Basic problem:
- transform: (165.9134918212895400 -47.7347488403320312, 165.9134918212895400 -34.2310752868652344, 184.6205993652343977 -34.2310752868652344, 184.6205993652343977 -47.7347488403320312, 165.9134918212895400 -47.7347488403320312)
- from: +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
- to: +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs
- end up with points[0].x - points[4].x == -3.7252902984619141e-09 != 0.0 (which then results in a not-closed polygon)
What i've dug up:
- The @null gridshift isn't quite null:
(2.8957367057621863 + 3.1415926535897931 - 3.1415926535897931) - 2.8957367057621863 == -4.4408920985006262e-16 != 0 nad_cvt.c:13 & nad_cvt.c:57
- The @null gridshift fails for points outside +180º/-180º longitude.
- Then the failure is treated as a transient error (pj_transform.c:638) and returns a success code, so 1/2 the points are gridshifted (ie. slightly-not-0 change) and 1/2 are not (ie. 0 change).
Questions:
- Is the @null gridshift meant to fail for points outside +180º/-180º? nad_cvt() seems to normalise values back into a 2PI range anyway, so maybe it can be ignored?
- Should the gridshift failure be silently dropped?
- This particular case only happens to fail using Proj's DEG_TO_RAD (0.0174532925199432958) which is different from OGC's (0.0174532923199433) which GDAL uses... just to make it more fun.
- As an aside (for nad_cvt()'s normalising), in adjlon(), ONEPI * 2.0 != TWOPI...
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

