about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2023-11-02 07:14:30 +0900
committerNguyễn Gia Phong <cnx@loang.net>2023-11-02 07:14:30 +0900
commit5de7d79d93e009cf6e52f0006ef8bcbd00d3cf56 (patch)
tree10435d0e4ba91e9215b94140fd253c124ea54469
parentbb25f70192a3276f2cca2913e9012d2c56393bd6 (diff)
downloadbux-5de7d79d93e009cf6e52f0006ef8bcbd00d3cf56.tar.gz
Add PROJ bug 1654 HEAD main
References: https://github.com/OSGeo/PROJ/issues/1654
-rw-r--r--.reuse/dep54
-rw-r--r--proj/1654.gie23
-rw-r--r--proj/default.nix35
-rw-r--r--shell.nix12
4 files changed, 74 insertions, 0 deletions
diff --git a/.reuse/dep5 b/.reuse/dep5
index 63ea501..7123f0a 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -11,6 +11,10 @@ Files: md4c/fix-pkgconfig.patch
 Copyright: 2023 Nguyễn Gia Phong
 License: AGPL-3.0-or-later
 
+Files: proj/1654.gie
+Copyright: 2019 Even Rouault
+License: MIT
+
 Files: README.md
 Copyright: N/A
 License: CC0-1.0
diff --git a/proj/1654.gie b/proj/1654.gie
new file mode 100644
index 0000000..10964f1
--- /dev/null
+++ b/proj/1654.gie
@@ -0,0 +1,23 @@
+<gie>
+# Test oblique aeqd with point very close lon_0, lat_0, on a perfect sphere
+operation +proj=aeqd +a=6371008.771415 +b=6371008.771415 +lat_0=30.2345 +lon_0=-120.2345
+tolerance 1 mm
+accept    -120.234501 30.234501
+expect    -0.096      0.111
+roundtrip 1
+
+accept    -120.2345   30.2345
+expect    0.000       0.000
+roundtrip 1
+
+# Same on an ellipsoid very close to the sphere
+operation +proj=aeqd +a=6371008.771415 +b=6371008.771414 +lat_0=30.2345 +lon_0=-120.2345
+tolerance 1 mm
+accept    -120.234501 30.234501
+expect    -0.096      0.111
+roundtrip 1
+
+accept    -120.2345   30.2345
+expect    0.000       0.000
+roundtrip 1
+</gie>
diff --git a/proj/default.nix b/proj/default.nix
new file mode 100644
index 0000000..96b8470
--- /dev/null
+++ b/proj/default.nix
@@ -0,0 +1,35 @@
+# Recipe for building PROJ at specific snapshot
+#
+# SPDX-FileCopyrightText: 2007 Marc Weber
+# SPDX-FileCopyrightText: 2019 Jonathan Ringer
+# SPDX-License-Identifier: MIT
+#
+# SPDX-FileCopyrightText: 2023 Nguyễn Gia Phong
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+{ lib, stdenv, version, fetchFromGitHub, commit, hash
+, autoreconfHook, binRenameHook, pkg-config, sqlite }:
+
+stdenv.mkDerivation rec {
+  name = "proj";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "OSGeo";
+    repo = "PROJ";
+    rev = commit;
+    inherit hash;
+  };
+
+  nativeBuildInputs = [ autoreconfHook binRenameHook pkg-config ];
+  buildInputs = [ sqlite ];
+  enableParallelBuilding = true;
+  outputs = [ "out" "dev" ];
+
+  meta = with lib; {
+    description = "Cartographic Projections Library";
+    homepage = "https://proj.org";
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/shell.nix b/shell.nix
index 8ec7eb8..b8ce9dc 100644
--- a/shell.nix
+++ b/shell.nix
@@ -48,6 +48,12 @@ let
     inherit hash;
     binRenameHook = binRenameHook version;
   };
+  proj = version: commit: hash: callPackage ./proj {
+    inherit version;
+    inherit commit;
+    inherit hash;
+    binRenameHook = binRenameHook version;
+  };
 in mkShell {
   packages = [
     (cppcheck "9261.buggy"
@@ -74,5 +80,11 @@ in mkShell {
     (md4c "107.fixed"
       "5d7c35973e5d06b46ca21b5b6e292c56dba7ca23"
       "sha256-N/vIRhXuU948z0O4NXKMSKOZGAEE6UjGDT5oqrGpUy8=")
+    (proj "1654.buggy"
+      "c45855b38f701a66a96cbd3fe4534f6a52c393b1"
+      "sha256-t+RYX4HRdlNlb8IvFXmjvD8C9P1e5/rCA+dkw1JSNW4=")
+    (proj "1654.fixed"
+      "9b561406e1ddcde02e868bef908e5cd5140745c7"
+      "sha256-zdxidjNOoExFpbqAasKpfs6coLkEVA9U9rvNkQ7XgSI=")
   ];
 }