aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2018-12-06 22:10:57 +0100
committerEven Rouault <even.rouault@spatialys.com>2018-12-06 23:42:16 +0100
commit67ca5c199dfe62fc0738a808f3142af2e77eafd7 (patch)
tree9245d9a9c1f5f9e529636fb3e9d93906f6c8a3c0 /src
parentf06045c2f0145ec2290913fa144cd690e70736fd (diff)
downloadPROJ-67ca5c199dfe62fc0738a808f3142af2e77eafd7.tar.gz
PROJ-67ca5c199dfe62fc0738a808f3142af2e77eafd7.zip
projinfo: display deprecation info
Diffstat (limited to 'src')
-rw-r--r--src/projinfo.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/projinfo.cpp b/src/projinfo.cpp
index ddcc09da..ba19b8d2 100644
--- a/src/projinfo.cpp
+++ b/src/projinfo.cpp
@@ -37,6 +37,7 @@
#include "projects.h"
+#include <proj/common.hpp>
#include <proj/coordinateoperation.hpp>
#include <proj/crs.hpp>
#include <proj/io.hpp>
@@ -45,6 +46,7 @@
#include "proj/internal/internal.hpp" // for split
+using namespace NS_PROJ::common;
using namespace NS_PROJ::crs;
using namespace NS_PROJ::io;
using namespace NS_PROJ::metadata;
@@ -201,6 +203,30 @@ static BaseObjectNNPtr buildObject(DatabaseContextPtr dbContext,
static void outputObject(DatabaseContextPtr dbContext, BaseObjectNNPtr obj,
const OutputOptions &outputOpt) {
+
+ auto identified = dynamic_cast<const IdentifiedObject *>(obj.get());
+ if (!outputOpt.quiet && identified && identified->isDeprecated()) {
+ std::cout << "Warning: object is deprecated" << std::endl;
+ auto crs = dynamic_cast<const CRS *>(obj.get());
+ if (crs && dbContext) {
+ try {
+ auto list = crs->getNonDeprecated(NN_NO_CHECK(dbContext));
+ if (!list.empty()) {
+ std::cout << "Alternative non-deprecated CRS:" << std::endl;
+ }
+ for (const auto &altCRS : list) {
+ const auto &ids = altCRS->identifiers();
+ if (!ids.empty()) {
+ std::cout << " " << *(ids[0]->codeSpace()) << ":"
+ << ids[0]->code() << std::endl;
+ }
+ }
+ } catch (const std::exception &) {
+ }
+ }
+ std::cout << std::endl;
+ }
+
auto projStringExportable =
nn_dynamic_pointer_cast<IPROJStringExportable>(obj);
bool alreadyOutputed = false;