diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-11-30 18:37:12 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-12-01 17:36:29 +0100 |
| commit | 9d19d5578705e06990fb716adcb9e6a1529424aa (patch) | |
| tree | e2bba1f4f1f07d61ea1b18638bd07e02c9b3b996 /src/io.cpp | |
| parent | b6a5c445e202e61c64b0986679a6e0a83724c322 (diff) | |
| download | PROJ-9d19d5578705e06990fb716adcb9e6a1529424aa.tar.gz PROJ-9d19d5578705e06990fb716adcb9e6a1529424aa.zip | |
importFromWKT: morph GDAL_WKT1 datum names into their EPSG spelling
Diffstat (limited to 'src/io.cpp')
| -rw-r--r-- | src/io.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -1925,6 +1925,37 @@ GeodeticReferenceFrameNNPtr WKTParser::Private::buildGeodeticReferenceFrame( .set(Identifier::AUTHORITY_KEY, authNameFromAlias))); properties.set(IdentifiedObject::IDENTIFIERS_KEY, identifiers); } + } else if (name.find('_') != std::string::npos) { + // Likely coming from WKT1 + if (dbContext_) { + auto authFactory = AuthorityFactory::create(NN_NO_CHECK(dbContext_), + std::string()); + auto res = authFactory->createObjectsFromName( + name, {AuthorityFactory::ObjectType::GEODETIC_REFERENCE_FRAME}, + true, 1); + if (!res.empty()) { + const auto &refDatum = res.front(); + if (metadata::Identifier::isEquivalentName( + name.c_str(), refDatum->nameStr().c_str())) { + properties.set(IdentifiedObject::NAME_KEY, + refDatum->nameStr()); + if (properties.find(Identifier::CODESPACE_KEY) == + properties.end() && + refDatum->identifiers().size() == 1) { + const auto &id = refDatum->identifiers()[0]; + auto identifiers = ArrayOfBaseObject::create(); + identifiers->add(Identifier::create( + id->code(), PropertyMap() + .set(Identifier::CODESPACE_KEY, + *id->codeSpace()) + .set(Identifier::AUTHORITY_KEY, + *id->codeSpace()))); + properties.set(IdentifiedObject::IDENTIFIERS_KEY, + identifiers); + } + } + } + } } auto ellipsoid = buildEllipsoid(ellipsoidNode); |
