aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-04-04 11:27:59 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-04-04 11:27:59 +0200
commit99a2d5f248b828ff97121b0137569a0094b5c63e (patch)
tree1972a76299ee5dd2feea508106b38e247638dd23
parent670eab68f2345b2a77bfac8a109588770bceb740 (diff)
downloadPROJ-99a2d5f248b828ff97121b0137569a0094b5c63e.tar.gz
PROJ-99a2d5f248b828ff97121b0137569a0094b5c63e.zip
projinfo: add a --hide-ballpark option
-rw-r--r--docs/source/apps/projinfo.rst31
-rw-r--r--src/apps/projinfo.cpp14
-rwxr-xr-xtest/cli/testprojinfo4
-rw-r--r--test/cli/testprojinfo_out.dist5
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<CoordinateOperationNNPtr> 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