MCPcopy Create free account
hub / github.com/OSGeo/gdal / IsDynamic

Method IsDynamic

ogr/ogrspatialreference.cpp:9572–9639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9570 */
9571
9572bool OGRSpatialReference::IsDynamic() const
9573
9574{
9575 TAKE_OPTIONAL_LOCK();
9576 bool isDynamic = false;
9577 d->refreshProjObj();
9578 d->demoteFromBoundCRS();
9579 auto ctxt = d->getPROJContext();
9580 PJ *horiz = nullptr;
9581 if (d->m_pjType == PJ_TYPE_COMPOUND_CRS)
9582 {
9583 horiz = proj_crs_get_sub_crs(ctxt, d->m_pj_crs, 0);
9584 }
9585 else if (d->m_pj_crs)
9586 {
9587 horiz = proj_clone(ctxt, d->m_pj_crs);
9588 }
9589 if (horiz && proj_get_type(horiz) == PJ_TYPE_BOUND_CRS)
9590 {
9591 auto baseCRS = proj_get_source_crs(ctxt, horiz);
9592 if (baseCRS)
9593 {
9594 proj_destroy(horiz);
9595 horiz = baseCRS;
9596 }
9597 }
9598 auto datum = horiz ? proj_crs_get_datum(ctxt, horiz) : nullptr;
9599 if (datum)
9600 {
9601 const auto type = proj_get_type(datum);
9602 isDynamic = type == PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME ||
9603 type == PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME;
9604 if (!isDynamic)
9605 {
9606 const char *auth_name = proj_get_id_auth_name(datum, 0);
9607 const char *code = proj_get_id_code(datum, 0);
9608 if (auth_name && code && EQUAL(auth_name, "EPSG") &&
9609 EQUAL(code, "6326"))
9610 {
9611 isDynamic = true;
9612 }
9613 }
9614 proj_destroy(datum);
9615 }
9616#if PROJ_VERSION_MAJOR > 7 || \
9617 (PROJ_VERSION_MAJOR == 7 && PROJ_VERSION_MINOR >= 2)
9618 else
9619 {
9620 auto ensemble =
9621 horiz ? proj_crs_get_datum_ensemble(ctxt, horiz) : nullptr;
9622 if (ensemble)
9623 {
9624 auto member = proj_datum_ensemble_get_member(ctxt, ensemble, 0);
9625 if (member)
9626 {
9627 const auto type = proj_get_type(member);
9628 isDynamic = type == PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME ||
9629 type == PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME;

Calls 5

refreshProjObjMethod · 0.80
demoteFromBoundCRSMethod · 0.80
getPROJContextMethod · 0.80
EQUALFunction · 0.50