From ce38ade494db73ab27dbdbdab84332e4530c8d8a Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 16 May 2020 17:41:12 +0200 Subject: peirce_q: limit input to positive latitudes Otherwise it returns junk (negative latitudes are mapped to the same location as positive latitudes) I'm a bit confused by PROJ peirce_q implementation. Looking at the projection of the world, it looks like this matches the diamond formulation of the right map shown at https://desktop.arcgis.com/en/arcmap/latest/map/projections/peirce-quincuncial.htm, but limited to the inner square of this diamond (which corresponds to the northern hemisphere). We lack the 4 triangles on left, top, right and bottom for the southern hemisphere. Furthermore, this formulation of peirce_q does not seem to have the quincuncial property of the square formulation (left images of the above ESRI doc), or the one at https://en.wikipedia.org/wiki/Peirce_quincuncial_projection ... --- src/projections/adams.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/projections/adams.cpp') diff --git a/src/projections/adams.cpp b/src/projections/adams.cpp index 88fce8e5..e704c687 100644 --- a/src/projections/adams.cpp +++ b/src/projections/adams.cpp @@ -118,6 +118,10 @@ static PJ_XY adams_forward(PJ_LP lp, PJ *P) { } break; case PEIRCE_Q: { + if( lp.phi < -TOL ) { + proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); + return proj_coord_error().xy; + } const double sl = sin(lp.lam); const double cl = cos(lp.lam); const double cp = cos(lp.phi); -- cgit v1.2.3