aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/crs.cpp31
-rw-r--r--src/iso19111/io.cpp35
-rw-r--r--src/iso19111/static.cpp1
3 files changed, 62 insertions, 5 deletions
diff --git a/src/iso19111/crs.cpp b/src/iso19111/crs.cpp
index 26725e24..b9b38c80 100644
--- a/src/iso19111/crs.cpp
+++ b/src/iso19111/crs.cpp
@@ -2478,6 +2478,14 @@ void VerticalCRS::_exportToWKT(io::WKTFormatter *formatter) const {
cs->_exportToWKT(formatter);
formatter->setOutputAxis(oldAxisOutputRule);
+ if (isWKT2 && formatter->use2019Keywords() && !d->geoidModel.empty()) {
+ const auto &model = d->geoidModel[0];
+ formatter->startNode(io::WKTConstants::GEOIDMODEL, false);
+ formatter->addQuotedString(model->nameStr());
+ model->formatID(formatter);
+ formatter->endNode();
+ }
+
ObjectUsage::baseExportToWKT(formatter);
formatter->endNode();
}
@@ -2539,6 +2547,15 @@ void VerticalCRS::_exportToJSON(
formatter->setOmitTypeInImmediateChild();
coordinateSystem()->_exportToJSON(formatter);
+ if (!d->geoidModel.empty()) {
+ const auto &model = d->geoidModel[0];
+ writer.AddObjKey("geoid_model");
+ auto objectContext2(formatter->MakeObjectContext(nullptr, false));
+ writer.AddObjKey("name");
+ writer.Add(model->nameStr());
+ model->formatID(formatter);
+ }
+
ObjectUsage::baseExportToJSON(formatter);
}
//! @endcond
@@ -2572,7 +2589,8 @@ void VerticalCRS::addLinearUnitConvert(
* cs::VerticalCS.
*
* @param properties See \ref general_properties.
- * At minimum the name should be defined.
+ * At minimum the name should be defined. The GEOID_MODEL property can be set
+ * to a TransformationNNPtr object.
* @param datumIn The datum of the CRS.
* @param csIn a VerticalCS.
* @return new VerticalCRS.
@@ -2592,7 +2610,8 @@ VerticalCRS::create(const util::PropertyMap &properties,
* One and only one of datum or datumEnsemble should be set to a non-null value.
*
* @param properties See \ref general_properties.
- * At minimum the name should be defined.
+ * At minimum the name should be defined. The GEOID_MODEL property can be set
+ * to a TransformationNNPtr object.
* @param datumIn The datum of the CRS, or nullptr
* @param datumEnsembleIn The datum ensemble of the CRS, or nullptr.
* @param csIn a VerticalCS.
@@ -2607,6 +2626,14 @@ VerticalCRS::create(const util::PropertyMap &properties,
csIn));
crs->assignSelf(crs);
crs->setProperties(properties);
+ const auto geoidModelPtr = properties.get("GEOID_MODEL");
+ if (geoidModelPtr) {
+ auto transf = util::nn_dynamic_pointer_cast<operation::Transformation>(
+ *geoidModelPtr);
+ if (transf) {
+ crs->d->geoidModel.emplace_back(NN_NO_CHECK(transf));
+ }
+ }
return crs;
}
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index fc66b6c9..116a8b78 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -89,7 +89,7 @@ static const std::string emptyString{};
// If changing that value, change it in data/projjson.schema.json as well
#define PROJJSON_CURRENT_VERSION \
- "https://proj.org/schemas/v0.1/projjson.schema.json"
+ "https://proj.org/schemas/v0.2/projjson.schema.json"
//! @endcond
#if 0
@@ -3820,8 +3820,22 @@ CRSNNPtr WKTParser::Private::buildVerticalCRS(const WKTNodeNNPtr &node) {
ThrowNotExpectedCSType("vertical");
}
+ auto &props = buildProperties(node);
+ auto &geoidModelNode = nodeP->lookForChild(WKTConstants::GEOIDMODEL);
+ if (!isNull(geoidModelNode)) {
+ auto &propsModel = buildProperties(geoidModelNode);
+ const auto dummyCRS = VerticalCRS::create(
+ PropertyMap(), datum, datumEnsemble, NN_NO_CHECK(verticalCS));
+ const auto model(Transformation::create(
+ propsModel, dummyCRS, dummyCRS, nullptr,
+ OperationMethod::create(PropertyMap(),
+ std::vector<OperationParameterNNPtr>()),
+ {}, {}));
+ props.set("GEOID_MODEL", model);
+ }
+
auto crs = nn_static_pointer_cast<CRS>(VerticalCRS::create(
- buildProperties(node), datum, datumEnsemble, NN_NO_CHECK(verticalCS)));
+ props, datum, datumEnsemble, NN_NO_CHECK(verticalCS)));
if (!isNull(datumNode)) {
auto &extensionNode = datumNode->lookForChild(WKTConstants::EXTENSION);
@@ -4987,7 +5001,22 @@ VerticalCRSNNPtr JSONParser::buildVerticalCRS(const json &j) {
if (!verticalCS) {
throw ParsingException("expected a vertical CS");
}
- return VerticalCRS::create(buildProperties(j), datum, datumEnsemble,
+
+ auto props = buildProperties(j);
+ if (j.contains("geoid_model")) {
+ auto geoidModelJ = getObject(j, "geoid_model");
+ auto propsModel = buildProperties(geoidModelJ);
+ const auto dummyCRS = VerticalCRS::create(
+ PropertyMap(), datum, datumEnsemble, NN_NO_CHECK(verticalCS));
+ const auto model(Transformation::create(
+ propsModel, dummyCRS, dummyCRS, nullptr,
+ OperationMethod::create(PropertyMap(),
+ std::vector<OperationParameterNNPtr>()),
+ {}, {}));
+ props.set("GEOID_MODEL", model);
+ }
+
+ return VerticalCRS::create(props, datum, datumEnsemble,
NN_NO_CHECK(verticalCS));
}
diff --git a/src/iso19111/static.cpp b/src/iso19111/static.cpp
index 824047f0..0ed08c95 100644
--- a/src/iso19111/static.cpp
+++ b/src/iso19111/static.cpp
@@ -274,6 +274,7 @@ DEFINE_WKT_CONSTANT(BASEENGCRS);
DEFINE_WKT_CONSTANT(BASEPARAMCRS);
DEFINE_WKT_CONSTANT(BASETIMECRS);
DEFINE_WKT_CONSTANT(VERSION);
+DEFINE_WKT_CONSTANT(GEOIDMODEL);
DEFINE_WKT_CONSTANT(GEODETICCRS);
DEFINE_WKT_CONSTANT(GEODETICDATUM);