From 99a2d5f248b828ff97121b0137569a0094b5c63e Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 4 Apr 2020 11:27:59 +0200 Subject: projinfo: add a --hide-ballpark option --- docs/source/apps/projinfo.rst | 31 ++++++++++++++++++++----------- src/apps/projinfo.cpp | 14 +++++++++++++- test/cli/testprojinfo | 4 ++-- test/cli/testprojinfo_out.dist | 5 ++--- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/docs/source/apps/projinfo.rst b/docs/source/apps/projinfo.rst index 0e54c244..10ac70e8 100644 --- a/docs/source/apps/projinfo.rst +++ b/docs/source/apps/projinfo.rst @@ -20,8 +20,9 @@ Synopsis | [[--area name_or_code] | [--bbox west_long,south_lat,east_long,north_lat]] | [--spatial-test contains|intersects] | [--crs-extent-use none|both|intersection|smallest] - | [--grid-check none|discard_missing|sort|known_available] [--show-superseded] + | [--grid-check none|discard_missing|sort|known_available] | [--pivot-crs always|if_no_direct_transformation|never|{auth:code[,auth:code]*}] + | [--show-superseded] [--hide-ballpark] | [--boundcrs-to-wgs84] | [--main-db-path path] [--aux-db-path path]* | [--identify] [--3d] @@ -177,16 +178,6 @@ The following control parameters can appear in any order: .. note:: only used for coordinate operation computation -.. option:: -show-superseded - - When enabled, coordinate operations that are superseded by others will be - listed. Note that supersession is not equivalent to deprecation: superseded - operations are still considered valid although they have a better equivalent, - whereas deprecated operations have been determined to be erroneous and are - not considered at all. - - .. note:: only used for coordinate operation computation - .. option:: --pivot-crs always|if_no_direct_transformation|never|{auth:code[,auth:code]*} Determine if intermediate (pivot) CRS can be used when researching coordinate @@ -201,6 +192,24 @@ The following control parameters can appear in any order: .. note:: only used for coordinate operation computation +.. option:: --show-superseded + + When enabled, coordinate operations that are superseded by others will be + listed. Note that supersession is not equivalent to deprecation: superseded + operations are still considered valid although they have a better equivalent, + whereas deprecated operations have been determined to be erroneous and are + not considered at all. + + .. note:: only used for coordinate operation computation + +.. option:: --hide-ballpark + + .. versionadded:: 7.1 + + Hides any coordinate operation that is, or contains, a ballpark transformation. + + .. note:: only used for coordinate operation computation + .. option:: --boundcrs-to-wgs84 When specified, this option researches a coordinate operation from the diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp index 1e58cfb0..10ce346f 100644 --- a/src/apps/projinfo.cpp +++ b/src/apps/projinfo.cpp @@ -71,6 +71,7 @@ struct OutputOptions { bool c_ify = false; bool singleLine = false; bool strict = true; + bool ballparkAllowed = true; }; } // anonymous namespace @@ -89,10 +90,10 @@ static void usage() { << std::endl << " [--grid-check " "none|discard_missing|sort|known_available] " - "[--show-superseded]" << std::endl << " [--pivot-crs always|if_no_direct_transformation|" << "never|{auth:code[,auth:code]*}]" << std::endl + << " [--show-superseded] [--hide-ballpark]" << std::endl << " [--boundcrs-to-wgs84]" << std::endl << " [--main-db-path path] [--aux-db-path path]*" << std::endl @@ -725,6 +726,15 @@ static void outputOperations( << std::endl; std::exit(1); } + if (!outputOpt.ballparkAllowed) { + std::vector listNew; + for (const auto &op : list) { + if (!op->hasBallparkTransformation()) { + listNew.emplace_back(op); + } + } + list = std::move(listNew); + } if (outputOpt.quiet && !list.empty()) { outputObject(dbContext, list[0], allowUseIntermediateCRS, outputOpt); return; @@ -1053,6 +1063,8 @@ int main(int argc, char **argv) { showSuperseded = true; } else if (arg == "--lax") { outputOpt.strict = false; + } else if (arg == "--hide-ballpark") { + outputOpt.ballparkAllowed = false; } else if (ci_equal(arg, "--3d")) { promoteTo3D = true; } else if (ci_equal(arg, "--searchpaths")) { diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo index 4ec1bdbb..df8cac8c 100755 --- a/test/cli/testprojinfo +++ b/test/cli/testprojinfo @@ -58,8 +58,8 @@ echo "Testing projinfo -s NAD27 -t NAD83" >> ${OUT} $EXE -s NAD27 -t NAD83 >>${OUT} echo "" >>${OUT} -echo "Testing projinfo -s NAD27 -t NAD83 --grid-check none --spatial-test intersects --summary" >> ${OUT} -$EXE -s NAD27 -t NAD83 --grid-check none --spatial-test intersects --summary >>${OUT} +echo "Testing projinfo -s NAD27 -t NAD83 --grid-check none --spatial-test intersects --summary --hide-ballpark" >> ${OUT} +$EXE -s NAD27 -t NAD83 --grid-check none --spatial-test intersects --summary --hide-ballpark >>${OUT} echo "" >>${OUT} echo "Testing projinfo -s NAD27 -t NAD83 --grid-check none --spatial-test intersects" >> ${OUT} diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index 99fae293..17390534 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -266,8 +266,8 @@ COORDINATEOPERATION["Ballpark geographic offset from NAD27 to NAD83", AREA["World"], BBOX[-90,-180,90,180]]] -Testing projinfo -s NAD27 -t NAD83 --grid-check none --spatial-test intersects --summary -Candidate operations found: 10 +Testing projinfo -s NAD27 -t NAD83 --grid-check none --spatial-test intersects --summary --hide-ballpark +Candidate operations found: 9 DERIVED_FROM(EPSG):1312, NAD27 to NAD83 (3), 2.0 m, Canada DERIVED_FROM(EPSG):1313, NAD27 to NAD83 (4), 1.5 m, Canada - NAD27 DERIVED_FROM(EPSG):1241, NAD27 to NAD83 (1), 0.15 m, USA - CONUS including EEZ @@ -275,7 +275,6 @@ DERIVED_FROM(EPSG):1243, NAD27 to NAD83 (2), 0.5 m, USA - Alaska including EEZ DERIVED_FROM(EPSG):1573, NAD27 to NAD83 (6), 1.5 m, Canada - Quebec EPSG:1462, NAD27 to NAD83 (5), 2.0 m, Canada - Quebec EPSG:9111, NAD27 to NAD83 (9), 1.5 m, Canada - Saskatchewan -unknown id, Ballpark geographic offset from NAD27 to NAD83, unknown accuracy, World, has ballpark transformation EPSG:8555, NAD27 to NAD83 (7), 0.15 m, USA - CONUS and GoM EPSG:8549, NAD27 to NAD83 (8), 0.5 m, USA - Alaska -- cgit v1.2.3 From ef3a387abd5989f6d5242a6c8cd0f7b6e7318484 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 4 Apr 2020 13:17:02 +0200 Subject: Doc: define 'Ballpark transformation' --- docs/source/glossary.rst | 19 +++++++++++++++++++ docs/source/operations/operations_computation.rst | 7 ++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/docs/source/glossary.rst b/docs/source/glossary.rst index 21dd0f34..883460d4 100644 --- a/docs/source/glossary.rst +++ b/docs/source/glossary.rst @@ -6,6 +6,25 @@ Glossary .. glossary:: + Ballpark transformation + + For a transformation between two geographic CRS, a ballpark + transformation is a coordinate operation that only takes into account + potential difference of axis orders (long-lat vs lat-long), + units (degree vs grads) and prime meridian (Greewich vs Paris/Rome/other + historic prime meridians). It does not attempt any datum shift, hence + the "ballpark" qualifier in its name. Its accuracy is unknown, and could + lead in some cases to errors of a few hundreds of metres. + + For a transformation between two vertical CRS or a vertical CRS and + a geogrpahic CRS, a ballpark transformation only takes into account + potential different in units (e.g. metres vs feet). Its accuracy is + unknown, and could lead in some cases to errors of a few tens of metres. + + .. note:: + + The term "Ballpark transformation" is specific to PROJ. + Pseudocylindrical Projection Pseudocylindrical projections have the mathematical characteristics of diff --git a/docs/source/operations/operations_computation.rst b/docs/source/operations/operations_computation.rst index ef84cfb2..2f532127 100644 --- a/docs/source/operations/operations_computation.rst +++ b/docs/source/operations/operations_computation.rst @@ -106,11 +106,8 @@ which can be used as an override). As those results all involve operations that does not have a perfect accuracy and that does not cover the area of use of the 2 CRSs, a -'Ballpark geographic offset from NAD27 to NAD83' operation is synthetized by PROJ. -This operation is a sort of dummy operation that only takes into account potential -difference of axis orders (long-lat vs lat-long), units (degree vs grads) and -prime meridian (Greewich vs Paris/Rome/other historic prime meridians). It does -not attempt any datum shift, hence the "ballpark" qualifier in its name. +'Ballpark geographic offset from NAD27 to NAD83' operation is synthetized by PROJ +(see :term:`Ballpark transformation`) Filtering and sorting of coordinate operations ---------------------------------------------- -- cgit v1.2.3 From 335d9367fd07ebe5da50d2f9e336d5d8f6e31aee Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 4 Apr 2020 13:17:15 +0200 Subject: Doc: link projinfo to ballpark transformation term --- docs/source/apps/projinfo.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/apps/projinfo.rst b/docs/source/apps/projinfo.rst index 10ac70e8..99adbd50 100644 --- a/docs/source/apps/projinfo.rst +++ b/docs/source/apps/projinfo.rst @@ -206,7 +206,8 @@ The following control parameters can appear in any order: .. versionadded:: 7.1 - Hides any coordinate operation that is, or contains, a ballpark transformation. + Hides any coordinate operation that is, or contains, a + :term:`Ballpark transformation` .. note:: only used for coordinate operation computation -- cgit v1.2.3