aboutsummaryrefslogtreecommitdiff
path: root/src/apps/projinfo.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-10-16 00:10:05 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-10-16 18:49:58 +0200
commit149366116ad0ffb936eaa042823211731e9dcdee (patch)
tree1258ceb40af7d348f12ed30c2eb4de1c80c2ace5 /src/apps/projinfo.cpp
parent82b496fb32df0b6705159cd5c626aab20c8e9d39 (diff)
downloadPROJ-149366116ad0ffb936eaa042823211731e9dcdee.tar.gz
PROJ-149366116ad0ffb936eaa042823211731e9dcdee.zip
Add multi-line PROJ string export capability, and use it by default in projinfo (unless --single-line is specified) (fixes #1543)
Diffstat (limited to 'src/apps/projinfo.cpp')
-rw-r--r--src/apps/projinfo.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/apps/projinfo.cpp b/src/apps/projinfo.cpp
index 966de03d..f36674fd 100644
--- a/src/apps/projinfo.cpp
+++ b/src/apps/projinfo.cpp
@@ -350,11 +350,10 @@ static void outputObject(
objToExport = projStringExportable;
}
- std::cout << objToExport->exportToPROJString(
- PROJStringFormatter::create(
- PROJStringFormatter::Convention::PROJ_5,
- dbContext)
- .get())
+ auto formatter = PROJStringFormatter::create(
+ PROJStringFormatter::Convention::PROJ_5, dbContext);
+ formatter->setMultiLine(!outputOpt.singleLine);
+ std::cout << objToExport->exportToPROJString(formatter.get())
<< std::endl;
} catch (const std::exception &e) {
std::cerr << "Error when exporting to PROJ string: " << e.what()
@@ -376,9 +375,7 @@ static void outputObject(
}
auto formatter =
WKTFormatter::create(WKTFormatter::Convention::WKT2_2015);
- if (outputOpt.singleLine) {
- formatter->setMultiLine(false);
- }
+ formatter->setMultiLine(!outputOpt.singleLine);
formatter->setStrict(outputOpt.strict);
auto wkt = wktExportable->exportToWKT(formatter.get());
if (outputOpt.c_ify) {