void-packages/srcpkgs/OpenOrienteering-Mapper/patches/accept-transformation-autho...

36 lines
1.6 KiB
Diff

https://github.com/OpenOrienteering/mapper/pull/2024/commits/40cddb15d316ec90fe1207b737afade7b382457a
From 40cddb15d316ec90fe1207b737afade7b382457a Mon Sep 17 00:00:00 2001
From: Scott Turner <github@pkturner.org>
Date: Sun, 9 Jan 2022 13:53:09 -0500
Subject: [PATCH] Georeferencing: Choose transformations without restricting
authority
When using PROJ to set up a transformation between two CRSes, use
an AUTHORITY=any option to allow all transformations to be considered.
In particular, an ESRI datum transformation between WGS84 and NAD83
is not available from EPSG, and provides a more accurate result.
---
src/core/georeferencing.cpp | 7 +++++++
1 file changed, 7 insertions(+)
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)});
}