diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp index 7fe0802313..09c8a81d36 100644 --- a/src/apps/proj.cpp +++ b/src/apps/proj.cpp @@ -490,6 +490,14 @@ int main(int argc, char **argv) { exit(0); } + // Ugly hack. See https://github.com/OSGeo/PROJ/issues/1782 + if( Proj->right == PJ_IO_UNITS_WHATEVER && Proj->descr && + strncmp(Proj->descr, "General Oblique Transformation", + strlen("General Oblique Transformation")) == 0 ) + { + Proj->right = PJ_IO_UNITS_PROJECTED; + } + if (inverse) { if (!Proj->inv) emess(3,"inverse projection not available"); diff --git a/src/transform.cpp b/src/transform.cpp index d111d835e9..781c006128 100644 --- a/src/transform.cpp +++ b/src/transform.cpp @@ -231,6 +231,14 @@ static int geographic_to_projected (PJ *P, long n, int dist, double *x, double * return 0; } + // Ugly hack. See https://github.com/OSGeo/PROJ/issues/1782 + if( P->right == PJ_IO_UNITS_WHATEVER && P->descr && + strncmp(P->descr, "General Oblique Transformation", + strlen("General Oblique Transformation")) == 0 ) + { + P->right = PJ_IO_UNITS_PROJECTED; + } + for( i = 0; i right == PJ_IO_UNITS_WHATEVER && P->descr && + strncmp(P->descr, "General Oblique Transformation", + strlen("General Oblique Transformation")) == 0 ) + { + P->right = PJ_IO_UNITS_PROJECTED; + } + /* Fallback to the original PROJ.4 API 2d inversion - inv */ for( i = 0; i < n; i++ ) { PJ_XY projected_loc; diff --git a/test/cli/CMakeLists.txt b/test/cli/CMakeLists.txt index 4e1ab75a5d..feef5bf011 100644 --- a/test/cli/CMakeLists.txt +++ b/test/cli/CMakeLists.txt @@ -7,6 +7,7 @@ set(PROJINFO_BIN "projinfo") set(CCT_BIN "cct") proj_add_test_script_sh("test27" PROJ_BIN) proj_add_test_script_sh("test83" PROJ_BIN) +proj_add_test_script_sh("testproj" PROJ_BIN) proj_add_test_script_sh("testvarious" CS2CS_BIN) proj_add_test_script_sh("testdatumfile" CS2CS_BIN "connu") proj_add_test_script_sh("testIGNF" CS2CS_BIN "ntf_r93.gsb") diff --git a/test/cli/Makefile.am b/test/cli/Makefile.am index 758352c6c1..fb7169e410 100644 --- a/test/cli/Makefile.am +++ b/test/cli/Makefile.am @@ -10,6 +10,7 @@ CCTEXE = $(EXEPATH)/cct # PROJ.4 test scripts TEST27 = $(THIS_DIR)/test27 TEST83 = $(THIS_DIR)/test83 +TESTPROJ = $(THIS_DIR)/testproj TESTNTV2 = $(THIS_DIR)/testntv2 TESTVARIOUS = $(THIS_DIR)/testvarious TESTFLAKY = $(THIS_DIR)/testflaky @@ -24,6 +25,7 @@ EXTRA_DIST = pj_out27.dist pj_out83.dist td_out.dist \ testIGNF proj_outIGNF.dist \ testprojinfo testprojinfo_out.dist \ testcct testcct_out.dist \ + testproj testproj_out.dist \ CMakeLists.txt testprojinfo-check: @@ -35,6 +37,9 @@ test27-check: test83-check: $(TEST83) $(PROJEXE) +testproj-check: + $(TESTPROJ) $(PROJEXE) + testvarious-check: PROJ_LIB=$(PROJ_LIB) $(TESTVARIOUS) $(CS2CSEXE) @@ -56,4 +61,4 @@ testntv2-check: testcct-check: PROJ_LIB=$(PROJ_LIB) $(TESTCCT) $(CCTEXE) -check-local: testprojinfo-check test27-check test83-check testvarious-check testdatumfile-check testign-check testntv2-check testcct-check +check-local: testprojinfo-check test27-check test83-check testproj-check testvarious-check testdatumfile-check testign-check testntv2-check testcct-check diff --git a/test/cli/testproj b/test/cli/testproj new file mode 100755 index 0000000000..8686224e94 --- /dev/null +++ b/test/cli/testproj @@ -0,0 +1,55 @@ +: +# Script to test proj exe +# +TEST_CLI_DIR=`dirname $0` +EXE=$1 + +usage() +{ + echo "Usage: ${0} " + echo + exit 1 +} + +if test -z "${EXE}"; then + EXE=../../src/cs2cs +fi + +if test ! -x ${EXE}; then + echo "*** ERROR: Can not find '${EXE}' program!" + exit 1 +fi + +if test -z "${PROJ_LIB}"; then + export PROJ_LIB="`dirname $0`/../../data" +fi + +echo "============================================" +echo "Running ${0} using ${EXE}:" +echo "============================================" + +OUT=testproj_out +# +echo "doing tests into file ${OUT}, please wait" +# +$EXE +ellps=WGS84 +proj=ob_tran +o_proj=latlon +o_lon_p=0.0 +o_lat_p=90.0 +lon_0=360.0 +to_meter=0.0174532925199433 +no_defs -E -f '%.3f' >${OUT} <