[PROJ] "Over flag" for grid shifts

Peter Townsend peter.townsend at maplarge.com
Fri Aug 11 10:49:07 PDT 2023


I had a bit of an unusual situation pop up and wondered if anyone here had
any ideas.

Long story short, if you transform from EPSG:4326 to EPSG:4267 (wgs84 to
NAD27) using longitude 180 and latitude 50, you wind up with a longitude of
-179.997. Think of splitting a box across the antimeridian, like a big
bounding box over Russia. Coming from the left, you'd have a longitude of
around 25 to 180, then -180 to about -170. And if you were transforming
them, you'd go 25 to -179.997, which would be the wrong way for the first
section. (The second section would go from -179.997 to -170 in the correct
direction.)

PROJ has that +over flag that generally works as expected, but in this case
the transform's sign change is happening entirely in the hgridshift code
(pj_hgrid_apply_internal to be exact). When it gets to "in.lam =
adjlon(t.lam + extent->west);" it has become -179.997.

adjlon(t.lam + extent->west) * 180 / 3.14159265359
-179.99748513695496

Adding a P->over check around the adjlon call would still result in the
same value.

(t.lam + extent->west)
-3.1415487609496271
(t.lam + extent->west)* 180 / 3.14159265359
-179.99748513695496

Is there any sort of change that could happen inside of that function that
might keep it from changing its sign? Ideally it would be returning 180.003
instead of -179.997.

-- 
Peter Townsend
Senior Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20230811/660cc183/attachment.htm>


More information about the PROJ mailing list