diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-01-08 17:44:49 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2019-01-08 21:25:08 +0100 |
| commit | a6899c98a6455dc022bdd6785af3e528488422b8 (patch) | |
| tree | 37e78e8ff7bc497292e6e277422454ed330dbe02 | |
| parent | 87cde49072b55c220f0ad10fa997fe9a584d1df1 (diff) | |
| download | PROJ-a6899c98a6455dc022bdd6785af3e528488422b8.tar.gz PROJ-a6899c98a6455dc022bdd6785af3e528488422b8.zip | |
projinfo: use PROJ.4 label for CRS, and PROJ otherwise. Add test case for CRS with towgs84 keyword
| -rw-r--r-- | src/apps/projinfo.cpp | 8 | ||||
| -rwxr-xr-x | test/cli/testprojinfo | 4 | ||||
| -rw-r--r-- | test/cli/testprojinfo_out.dist | 12 |
3 files changed, 18 insertions, 6 deletions
diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp index 0540a0f9..446a1e9e 100644 --- a/src/apps/projinfo.cpp +++ b/src/apps/projinfo.cpp @@ -258,11 +258,15 @@ static void outputObject(DatabaseContextPtr dbContext, BaseObjectNNPtr obj, if (alreadyOutputed) { std::cout << std::endl; } + auto crs = nn_dynamic_pointer_cast<CRS>(obj); if (!outputOpt.quiet) { - std::cout << "PROJ string:" << std::endl; + if( crs ) { + std::cout << "PROJ.4 string:" << std::endl; + } else { + std::cout << "PROJ string:" << std::endl; + } } - auto crs = nn_dynamic_pointer_cast<CRS>(obj); std::shared_ptr<IPROJStringExportable> objToExport; if (crs) { objToExport = diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo index bae38482..70e4912f 100755 --- a/test/cli/testprojinfo +++ b/test/cli/testprojinfo @@ -82,6 +82,10 @@ echo "Testing non compliant WKT1" >> ${OUT} $EXE 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],UNIT["degree",0.0174532925199433]]' >>${OUT} 2>&1 echo "" >>${OUT} +echo "Testing CRS with towgs84: projinfo -o PROJ EPSG:25832" >> ${OUT} +$EXE -o PROJ EPSG:25832 >>${OUT} 2>&1 +echo "" >>${OUT} + # do 'diff' with distribution results echo "diff ${OUT} with testprojinfo_out.dist" diff -u ${OUT} ${TEST_CLI_DIR}/testprojinfo_out.dist diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index 3d70bd99..23e26975 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -1,5 +1,5 @@ Testing projinfo EPSG:4326 -PROJ string: +PROJ.4 string: +proj=longlat +datum=WGS84 +no_defs WKT2_2015 string: @@ -21,7 +21,7 @@ GEODCRS["WGS 84", ID["EPSG",4326]] Testing projinfo -o ALL EPSG:4326 -PROJ string: +PROJ.4 string: +proj=longlat +datum=WGS84 +no_defs WKT2_2015 string: @@ -480,7 +480,7 @@ Warning: object is deprecated Alternative non-deprecated CRS: EPSG:3003 -PROJ string: +PROJ.4 string: +proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996 +x_0=1500000 +y_0=0 +ellps=intl +pm=rome +units=m +no_defs WKT2_2015 string: @@ -525,7 +525,7 @@ Warning: GEOGCS should have a PRIMEM node Warning: Parsing error : syntax error, unexpected UNIT, expecting PRIMEM. Error occurred around: HEROID["WGS 84",6378137,298.257223563]],UNIT["degree",0.0174532925199433]] ^ -PROJ string: +PROJ.4 string: +proj=longlat +datum=WGS84 +no_defs WKT2_2015 string: @@ -545,3 +545,7 @@ GEODCRS["WGS 84", ORDER[2], ANGLEUNIT["degree",0.0174532925199433]]] +Testing CRS with towgs84: projinfo -o PROJ EPSG:25832 +PROJ.4 string: ++proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs + |
