-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
proj-data: init at 1.16.0 #280062
proj-data: init at 1.16.0 #280062
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,73 @@ | ||||||
{ lib | ||||||
, stdenv | ||||||
, callPackage | ||||||
, fetchFromGitHub | ||||||
|
||||||
# proj-data grid directories to install (ex.: "nz_linz"). | ||||||
# By default, no grids are installed due to the large size (size of all proj- | ||||||
# data grids is nearly 1GB and will grow over the time). | ||||||
, gridPackages ? [ ] | ||||||
}: | ||||||
|
||||||
stdenv.mkDerivation (finalAttrs: { | ||||||
pname = "proj-data"; | ||||||
version = "1.16.0"; | ||||||
|
||||||
src = fetchFromGitHub { | ||||||
owner = "OSGeo"; | ||||||
repo = "PROJ-data"; | ||||||
rev = finalAttrs.version; | ||||||
hash = "sha256-/EgDeWy2+KdcI4DLsRfWi5OWcGwO3AieEJQ5Zh+wdYE="; | ||||||
}; | ||||||
|
||||||
installPhase = '' | ||||||
runHook preInstall | ||||||
shopt -s extglob | ||||||
|
||||||
mkdir -p $out | ||||||
cp README.DATA $out/README-PROJ-DATA.md | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the comment about store path variables quoting above. |
||||||
|
||||||
for grid in ${builtins.toString gridPackages}; do | ||||||
if [ ! -d $grid ]; then | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this check redundant? The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this check doesn't exist, the error message is quite confusing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. In that case I'd recommend changing the check to |
||||||
echo "ERROR: Grid ($grid) does not exist." >&2 | ||||||
exit 1 | ||||||
fi | ||||||
|
||||||
cp $grid/!(*.sh|*.py) $out/ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
That said, would it be possible to create a positive rather than negative glob to include the relevant files? Something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, but it is very hard to create future-proof list of allowed file types. I would prefer to leave it as is for now. |
||||||
done | ||||||
|
||||||
shopt -u extglob | ||||||
runHook postInstall | ||||||
''; | ||||||
|
||||||
passthru.tests = | ||||||
let | ||||||
# build custom package containing `nz_linz` grids | ||||||
projDataWithGrid = finalAttrs.finalPackage.overrideAttrs (_: { | ||||||
postInstall = "cp nz_linz/* $out/"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this override There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I would like to, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know Nix well enough to suggest anything. Feel free to ignore this, unless someone else has a suggestion. |
||||||
}); | ||||||
in | ||||||
{ | ||||||
proj-data = callPackage ./tests.nix { | ||||||
proj-data = projDataWithGrid; | ||||||
}; | ||||||
}; | ||||||
|
||||||
meta = with lib; { | ||||||
description = "Repository for proj datum grids (for use by PROJ 7 or later)"; | ||||||
homepage = "https://proj4.org"; | ||||||
# Licensing note: | ||||||
# All grids in the package are released under permissive licenses. New grids | ||||||
# are accepted into the package as long as they are released under a license that | ||||||
# is compatible with the Open Source Definition and the source of the grid is | ||||||
# clearly stated and verifiable. Suitable licenses include: | ||||||
# Public domain | ||||||
# X/MIT | ||||||
# BSD 2/3/4 clause | ||||||
# CC0 | ||||||
# CC-BY (v3.0 or later) | ||||||
# CC-BY-SA (v3.0 or later) | ||||||
license = licenses.mit; | ||||||
maintainers = teams.geospatial.members; | ||||||
}; | ||||||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ runCommand, proj, proj-data }: | ||
|
||
let | ||
inherit (proj-data) pname; | ||
in | ||
runCommand "${pname}-tests" { meta.timeout = 60; } | ||
'' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is using pipelines, so There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, done. |
||
set -o pipefail | ||
|
||
# add proj-data files to proj resources search path | ||
export PROJ_DATA=${proj}/share/proj:${proj-data} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this possibly be set by the package itself? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what is the best approach. We can wrap all executables with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sounds good.
Isn't that unrelated? We'd be making one thing work without breaking anything else, right? |
||
|
||
# conversion from NZGD1949 to NZGD2000 using proj strings | ||
echo '173 -41 0' \ | ||
| ${proj}/bin/cs2cs --only-best -f %.8f \ | ||
+proj=longlat +ellps=intl +datum=nzgd49 +nadgrids=nz_linz_nzgd2kgrid0005.tif \ | ||
+to +proj=longlat +ellps=GRS80 +towgs84=0,0,0 \ | ||
| grep -E '[0-9\.\-]+*' | ||
|
||
# conversion from NZGD1949 to NZGD2000 using EPSG codes | ||
echo '-41 173 0' | ${proj}/bin/cs2cs --only-best -f %.8f EPSG:4272 EPSG:4167 \ | ||
| grep -E '[0-9\.\-]+*' | ||
|
||
touch $out | ||
'' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment about store path variables quoting above.