aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-12-03 16:54:31 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-12-03 16:54:31 +0100
commitac24807d189e2deea969656a229aad7a8c1236c6 (patch)
tree1929209587fd95fc6d14d7a674205af2386b56e7
parentba111ac8323ff194039a06db87d1fb17ed8175b3 (diff)
downloadPROJ-ac24807d189e2deea969656a229aad7a8c1236c6.tar.gz
PROJ-ac24807d189e2deea969656a229aad7a8c1236c6.zip
projinfo: output operation summary, even in non summary mode (refs #1188)
-rw-r--r--src/projinfo.cpp88
-rw-r--r--test/cli/testprojinfo_out.dist18
2 files changed, 66 insertions, 40 deletions
diff --git a/src/projinfo.cpp b/src/projinfo.cpp
index 7acb13af..5f580a6f 100644
--- a/src/projinfo.cpp
+++ b/src/projinfo.cpp
@@ -422,6 +422,51 @@ static void outputObject(DatabaseContextPtr dbContext, BaseObjectNNPtr obj,
// ---------------------------------------------------------------------------
+static void outputOperationSummary(const CoordinateOperationNNPtr &op) {
+ auto ids = op->identifiers();
+ if (!ids.empty()) {
+ std::cout << *(ids[0]->codeSpace()) << ":" << ids[0]->code();
+ } else {
+ std::cout << "unknown id";
+ }
+
+ std::cout << ", ";
+
+ auto name = op->nameStr();
+ if (!name.empty()) {
+ std::cout << name;
+ } else {
+ std::cout << "unknown name";
+ }
+
+ std::cout << ", ";
+
+ auto accuracies = op->coordinateOperationAccuracies();
+ if (!accuracies.empty()) {
+ std::cout << accuracies[0]->value() << " m";
+ } else {
+ if (std::dynamic_pointer_cast<Conversion>(op.as_nullable())) {
+ std::cout << "0 m";
+ } else {
+ std::cout << "unknown accuracy";
+ }
+ }
+
+ std::cout << ", ";
+
+ auto domains = op->domains();
+ if (!domains.empty() && domains[0]->domainOfValidity() &&
+ domains[0]->domainOfValidity()->description().has_value()) {
+ std::cout << *(domains[0]->domainOfValidity()->description());
+ } else {
+ std::cout << "unknown domain of validity";
+ }
+
+ std::cout << std::endl;
+}
+
+// ---------------------------------------------------------------------------
+
static void outputOperations(
DatabaseContextPtr dbContext, const std::string &sourceCRSStr,
const std::string &targetCRSStr, const ExtentPtr &bboxFilter,
@@ -477,46 +522,7 @@ static void outputOperations(
if (summary) {
std::cout << "Candidate operations found: " << list.size() << std::endl;
for (const auto &op : list) {
- auto ids = op->identifiers();
- if (!ids.empty()) {
- std::cout << *(ids[0]->codeSpace()) << ":" << ids[0]->code();
- } else {
- std::cout << "unknown id";
- }
-
- std::cout << ", ";
-
- auto name = op->nameStr();
- if (!name.empty()) {
- std::cout << name;
- } else {
- std::cout << "unknown name";
- }
-
- std::cout << ", ";
-
- auto accuracies = op->coordinateOperationAccuracies();
- if (!accuracies.empty()) {
- std::cout << accuracies[0]->value() << " m";
- } else {
- if (std::dynamic_pointer_cast<Conversion>(op.as_nullable())) {
- std::cout << "0 m";
- } else {
- std::cout << "unknown accuracy";
- }
- }
-
- std::cout << ", ";
-
- auto domains = op->domains();
- if (!domains.empty() && domains[0]->domainOfValidity() &&
- domains[0]->domainOfValidity()->description().has_value()) {
- std::cout << *(domains[0]->domainOfValidity()->description());
- } else {
- std::cout << "unknown domain of validity";
- }
-
- std::cout << std::endl;
+ outputOperationSummary(op);
}
} else {
bool first = true;
@@ -534,6 +540,8 @@ static void outputOperations(
<< (i + 1) << ":" << std::endl
<< std::endl;
}
+ outputOperationSummary(op);
+ std::cout << std::endl;
outputObject(dbContext, op, outputOpt);
}
}
diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist
index fea5a299..7cb4891b 100644
--- a/test/cli/testprojinfo_out.dist
+++ b/test/cli/testprojinfo_out.dist
@@ -83,6 +83,8 @@ GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.25722
Testing projinfo -s EPSG:4326 -t EPSG:32631
+EPSG:16031, UTM zone 31N, 0 m, World - N hemisphere - 0°E to 6°E
+
PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=utm +zone=31 +ellps=WGS84
@@ -122,6 +124,8 @@ Testing projinfo -s NAD27 -t NAD83 --grid-check none --spatial-test intersects
-------------------------------------
Operation n°1:
+DERIVED_FROM(EPSG):1312, NAD27 to NAD83 (3), 1.0 m, Canada
+
PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv1_can.dat +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
@@ -166,6 +170,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (3)",
-------------------------------------
Operation n°2:
+DERIVED_FROM(EPSG):1313, NAD27 to NAD83 (4), 1.5 m, Canada - NAD27
+
PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=ntv2_0.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
@@ -210,6 +216,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (4)",
-------------------------------------
Operation n°3:
+DERIVED_FROM(EPSG):1241, NAD27 to NAD83 (1), 0.15 m, USA - CONUS including EEZ
+
PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=conus +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
@@ -253,6 +261,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (1)",
-------------------------------------
Operation n°4:
+DERIVED_FROM(EPSG):1243, NAD27 to NAD83 (2), 0.5 m, USA - Alaska including EEZ
+
PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=alaska +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
@@ -296,6 +306,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (2)",
-------------------------------------
Operation n°5:
+ESRI:108003, NAD_1927_To_NAD_1983_PR_VI, 0.05 m, Caribbean - Puerto Rico and Virgin Islands - onshore
+
PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=prvi +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
@@ -340,6 +352,8 @@ COORDINATEOPERATION["NAD_1927_To_NAD_1983_PR_VI",
-------------------------------------
Operation n°6:
+unknown id, Null geographic offset from NAD27 to NAD83, unknown accuracy, World
+
PROJ string:
@@ -393,6 +407,8 @@ COORDINATEOPERATION["Null geographic offset from NAD27 to NAD83",
-------------------------------------
Operation n°7:
+EPSG:1462, NAD27 to NAD83 (5), 1.0 m, Canada - Quebec
+
PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=GS2783v1.QUE +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1
@@ -437,6 +453,8 @@ COORDINATEOPERATION["NAD27 to NAD83 (5)",
-------------------------------------
Operation n°8:
+EPSG:1573, NAD27 to NAD83 (6), 1.5 m, Canada - Quebec
+
PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=hgridshift +grids=QUE27-83.gsb +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1