aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/coordinatesystem.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-07-06 17:06:23 +0200
committerEven Rouault <even.rouault@spatialys.com>2019-07-08 00:05:00 +0200
commitece151aed1b4bf2634de5759f37fd7bc005e8313 (patch)
tree8e2e38daaffc878cc3ba673857e66274555e3dcc /src/iso19111/coordinatesystem.cpp
parent17f0b0b3bc65ffba39bf6f22a12b2cc7fcb9bafd (diff)
downloadPROJ-ece151aed1b4bf2634de5759f37fd7bc005e8313.tar.gz
PROJ-ece151aed1b4bf2634de5759f37fd7bc005e8313.zip
CRS JSON: export GeographicCRS and Projected CRS
Diffstat (limited to 'src/iso19111/coordinatesystem.cpp')
-rw-r--r--src/iso19111/coordinatesystem.cpp59
1 files changed, 57 insertions, 2 deletions
diff --git a/src/iso19111/coordinatesystem.cpp b/src/iso19111/coordinatesystem.cpp
index ef9cac93..f96a962f 100644
--- a/src/iso19111/coordinatesystem.cpp
+++ b/src/iso19111/coordinatesystem.cpp
@@ -311,8 +311,8 @@ void CoordinateSystemAxis::_exportToWKT(io::WKTFormatter *formatter, int order,
bool disableAbbrev) const {
const bool isWKT2 = formatter->version() == io::WKTFormatter::Version::WKT2;
formatter->startNode(io::WKTConstants::AXIS, !identifiers().empty());
- std::string axisName = *(name()->description());
- std::string abbrev = abbreviation();
+ const std::string &axisName = nameStr();
+ const std::string &abbrev = abbreviation();
std::string parenthesizedAbbrev = "(" + abbrev + ")";
std::string dir = direction().toString();
std::string axisDesignation;
@@ -393,6 +393,34 @@ void CoordinateSystemAxis::_exportToWKT(io::WKTFormatter *formatter, int order,
// ---------------------------------------------------------------------------
//! @cond Doxygen_Suppress
+void CoordinateSystemAxis::_exportToJSON(
+ io::JSONFormatter *formatter) const // throw(FormattingException)
+{
+ auto &writer = formatter->writer();
+ auto objectContext(
+ formatter->MakeObjectContext("Axis", !identifiers().empty()));
+
+ writer.AddObjKey("name");
+ writer.Add(nameStr());
+
+ writer.AddObjKey("abbreviation");
+ writer.Add(abbreviation());
+
+ writer.AddObjKey("direction");
+ writer.Add(direction().toString());
+
+ writer.AddObjKey("unit");
+ unit()._exportToJSON(formatter);
+
+ if (formatter->outputId()) {
+ formatID(formatter);
+ }
+}
+//! @endcond
+
+// ---------------------------------------------------------------------------
+
+//! @cond Doxygen_Suppress
bool CoordinateSystemAxis::_isEquivalentTo(
const util::IComparable *other,
util::IComparable::Criterion criterion) const {
@@ -535,6 +563,33 @@ void CoordinateSystem::_exportToWKT(
// ---------------------------------------------------------------------------
//! @cond Doxygen_Suppress
+void CoordinateSystem::_exportToJSON(
+ io::JSONFormatter *formatter) const // throw(FormattingException)
+{
+ auto &writer = formatter->writer();
+ auto objectContext(formatter->MakeObjectContext("CoordinateSystem",
+ !identifiers().empty()));
+
+ writer.AddObjKey("subtype");
+ writer.Add(getWKT2Type(true));
+
+ writer.AddObjKey("axis");
+ auto axisContext(writer.MakeArrayContext(false));
+ const auto &l_axisList = axisList();
+ for (auto &axis : l_axisList) {
+ axis->_exportToJSON(formatter);
+ }
+
+ if (formatter->outputId()) {
+ formatID(formatter);
+ }
+}
+
+//! @endcond
+
+// ---------------------------------------------------------------------------
+
+//! @cond Doxygen_Suppress
bool CoordinateSystem::_isEquivalentTo(
const util::IComparable *other,
util::IComparable::Criterion criterion) const {