aboutsummaryrefslogtreecommitdiff
path: root/src/iso19111/io.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-04-21 20:45:49 +0200
committerGitHub <noreply@github.com>2020-04-21 20:45:49 +0200
commite493a5c17b2ebebb687b1758c0a10c418ffd49d3 (patch)
treed6f5bc7ad7d86c8af0e49675490b9195212042a8 /src/iso19111/io.cpp
parentea18e39b3b4905b7e6087d1683f62f843cde5564 (diff)
downloadPROJ-e493a5c17b2ebebb687b1758c0a10c418ffd49d3.tar.gz
PROJ-e493a5c17b2ebebb687b1758c0a10c418ffd49d3.zip
Add limited support for non-conformant WKT1 LAS COMPD_CS[] (#2171)
* Allow importing EPSG:{horizontal_code}+{geographic_code} and turn it into valid Geographic 3D or Projected 3D CRS internally * Allow importing WKT1 COMPD_CS[] with above structure * On an object imported that way, allow exporting to WKT1_GDAL, with this non-standard structure of a horizontal CRS + geographic CRS
Diffstat (limited to 'src/iso19111/io.cpp')
-rw-r--r--src/iso19111/io.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/iso19111/io.cpp b/src/iso19111/io.cpp
index e516e4b5..59116ad6 100644
--- a/src/iso19111/io.cpp
+++ b/src/iso19111/io.cpp
@@ -1334,7 +1334,7 @@ struct WKTParser::Private {
DerivedVerticalCRSNNPtr buildDerivedVerticalCRS(const WKTNodeNNPtr &node);
- CompoundCRSNNPtr buildCompoundCRS(const WKTNodeNNPtr &node);
+ CRSNNPtr buildCompoundCRS(const WKTNodeNNPtr &node);
BoundCRSNNPtr buildBoundCRS(const WKTNodeNNPtr &node);
@@ -4157,8 +4157,7 @@ WKTParser::Private::buildDerivedVerticalCRS(const WKTNodeNNPtr &node) {
// ---------------------------------------------------------------------------
-CompoundCRSNNPtr
-WKTParser::Private::buildCompoundCRS(const WKTNodeNNPtr &node) {
+CRSNNPtr WKTParser::Private::buildCompoundCRS(const WKTNodeNNPtr &node) {
std::vector<CRSNNPtr> components;
for (const auto &child : node->GP()->children()) {
auto crs = buildCRS(child);
@@ -4166,7 +4165,13 @@ WKTParser::Private::buildCompoundCRS(const WKTNodeNNPtr &node) {
components.push_back(NN_NO_CHECK(crs));
}
}
- return CompoundCRS::create(buildProperties(node), components);
+
+ if (ci_equal(node->GP()->value(), WKTConstants::COMPD_CS)) {
+ return CompoundCRS::createLax(buildProperties(node), components,
+ dbContext_);
+ } else {
+ return CompoundCRS::create(buildProperties(node), components);
+ }
}
// ---------------------------------------------------------------------------
@@ -5851,11 +5856,11 @@ static BaseObjectNNPtr createFromUserInput(const std::string &text,
tokensCode[0], false));
auto crs2(factory->createCoordinateReferenceSystem(
tokensCode[1], false));
- return CompoundCRS::create(
+ return CompoundCRS::createLax(
util::PropertyMap().set(
IdentifiedObject::NAME_KEY,
crs1->nameStr() + " + " + crs2->nameStr()),
- {crs1, crs2});
+ {crs1, crs2}, dbContext);
}
throw;
}