aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-10-05 14:56:41 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-10-06 23:48:52 +0200
commit2cfdd6f7fc683517a62147feace1b98b3f587abc (patch)
tree695468cff547ebdba0d575e77a65d0ac292c85af /src
parent4c992038ea01ead56df12f468f29325f7ca9e43d (diff)
downloadPROJ-2cfdd6f7fc683517a62147feace1b98b3f587abc.tar.gz
PROJ-2cfdd6f7fc683517a62147feace1b98b3f587abc.zip
Database: instanciate DynamicGeodeticReferenceFrame (things like ITRFxxx, WGS 84 (Gxxxx), etc.) when possible
Diffstat (limited to 'src')
-rw-r--r--src/iso19111/factory.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/iso19111/factory.cpp b/src/iso19111/factory.cpp
index f98e5cc8..79419d73 100644
--- a/src/iso19111/factory.cpp
+++ b/src/iso19111/factory.cpp
@@ -2011,7 +2011,8 @@ AuthorityFactory::createGeodeticDatum(const std::string &code) const {
auto res =
d->runWithCodeParam("SELECT name, ellipsoid_auth_name, ellipsoid_code, "
"prime_meridian_auth_name, prime_meridian_code, "
- "publication_date, deprecated FROM geodetic_datum "
+ "publication_date, frame_reference_epoch, "
+ "deprecated FROM geodetic_datum "
"WHERE "
"auth_name = ? AND code = ?",
code);
@@ -2027,7 +2028,8 @@ AuthorityFactory::createGeodeticDatum(const std::string &code) const {
const auto &prime_meridian_auth_name = row[3];
const auto &prime_meridian_code = row[4];
const auto &publication_date = row[5];
- const bool deprecated = row[6] == "1";
+ const auto &frame_reference_epoch = row[6];
+ const bool deprecated = row[7] == "1";
auto ellipsoid = d->createFactory(ellipsoid_auth_name)
->createEllipsoid(ellipsoid_code);
auto pm = d->createFactory(prime_meridian_auth_name)
@@ -2039,7 +2041,15 @@ AuthorityFactory::createGeodeticDatum(const std::string &code) const {
props.set("PUBLICATION_DATE", publication_date);
}
auto datum =
- datum::GeodeticReferenceFrame::create(props, ellipsoid, anchor, pm);
+ frame_reference_epoch.empty()
+ ? datum::GeodeticReferenceFrame::create(props, ellipsoid,
+ anchor, pm)
+ : util::nn_static_pointer_cast<datum::GeodeticReferenceFrame>(
+ datum::DynamicGeodeticReferenceFrame::create(
+ props, ellipsoid, anchor, pm,
+ common::Measure(c_locale_stod(frame_reference_epoch),
+ common::UnitOfMeasure::YEAR),
+ util::optional<std::string>()));
d->context()->d->cache(cacheKey, datum);
return datum;
} catch (const std::exception &ex) {