diff --git a/src/core/georeferencing.cpp b/src/core/georeferencing.cpp index 43b28fec6..57a4d7b74 100644 --- a/src/core/georeferencing.cpp +++ b/src/core/georeferencing.cpp @@ -383,7 +383,14 @@ ProjTransform::ProjTransform(const QString& crs_spec) // Cf. https://github.com/OSGeo/PROJ/pull/1573 crs_spec_utf8.replace("+datum=potsdam", "+ellps=bessel +nadgrids=@BETA2007.gsb"); #endif +#if defined(ACCEPT_USE_OF_DEPRECATED_PROJ_API_H) || (PROJ_VERSION_MAJOR) < 8 pj = proj_create_crs_to_crs(PJ_DEFAULT_CTX, geographic_crs_spec_utf8, crs_spec_utf8, nullptr); +#else + static auto const geographic_crs = crs(Georeferencing::geographic_crs_spec); + auto const projected_crs = crs(crs_spec); + static const char* const options[] = {"AUTHORITY=any", nullptr}; + pj = proj_create_crs_to_crs_from_pj(PJ_DEFAULT_CTX, geographic_crs.pj, projected_crs.pj, nullptr, options); +#endif if (pj) operator=({proj_normalize_for_visualization(PJ_DEFAULT_CTX, pj)}); } diff --git a/test/template_t.cpp b/test/template_t.cpp index 8eeca94e2..51cf52f13 100644 --- a/test/template_t.cpp +++ b/test/template_t.cpp @@ -51,8 +51,6 @@ #ifdef ACCEPT_USE_OF_DEPRECATED_PROJ_API_H # include -#else -# include #endif #include "test_config.h" @@ -446,7 +444,7 @@ private slots: QVERIFY(map.getTemplate(template_index)->loadTemplateFile()); QCOMPARE(temp->getTemplateState(), Template::Loaded); -#if (!defined(ACCEPT_USE_OF_DEPRECATED_PROJ_API_H) && (PROJ_VERSION_MAJOR)*100+(PROJ_VERSION_MINOR) < 802) || PJ_VERSION >= 600 +#if !defined(ACCEPT_USE_OF_DEPRECATED_PROJ_API_H) || PJ_VERSION >= 600 QEXPECT_FAIL("TemplateTrack from v0.8.4", "Unsupported WGS 84 -> NAD 83 transformation", Continue); #else QEXPECT_FAIL("TemplateTrack NAD83", "Unsupported WGS 84 -> NAD 83 transformation", Continue); @@ -569,7 +567,7 @@ private slots: ogr_template_center = center(temp); } -#if (!defined(ACCEPT_USE_OF_DEPRECATED_PROJ_API_H) && (PROJ_VERSION_MAJOR)*100+(PROJ_VERSION_MINOR) < 802) || PJ_VERSION >= 600 +#if !defined(ACCEPT_USE_OF_DEPRECATED_PROJ_API_H) || PJ_VERSION >= 600 QEXPECT_FAIL("TemplateTrack NAD83", "Unsupported WGS 84 -> NAD 83 transformation", Continue); QEXPECT_FAIL("OgrTemplate NAD83", "Unsupported WGS 84 -> NAD 83 transformation", Continue); #endif