commit 0e960dd4c6fe5a7ad6864c1b63b1dc4d5ad8b3e7
parent 8aa4aa7fbc2151326821ac7c12ec8bb78b944082
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Sun, 16 May 2021 15:11:48 +0300
Add dem3-tiles
Diffstat:
2 files changed, 93 insertions(+), 23 deletions(-)
diff --git a/pkgs/data/maps/dem/default.nix b/pkgs/data/maps/dem/default.nix
@@ -1,29 +1,9 @@
-{ lib, stdenvNoCC, fetchurl, unzip
-, withVRT ? true, gdal }:
+{ lib, stdenvNoCC, fetchurl, unzip, gdal, elevation_server }:
let
- dem1 = builtins.fromJSON (builtins.readFile ./dem1.json);
-in
-stdenvNoCC.mkDerivation {
- pname = "dem";
version = "2014-05-25";
- srcs = lib.mapAttrsToList (name: spec: fetchurl spec) dem1;
-
- unpackPhase = "for src in $srcs; do ${unzip}/bin/unzip $src; done";
-
- nativeBuildInputs = lib.optional withVRT gdal;
-
- dontConfigure = true;
- dontBuild = true;
- dontFixup = true;
-
- preferLocalBuild = true;
-
- installPhase = ''
- install -Dm644 **/*.hgt -t $out
- '' + lib.optionalString withVRT ''
- gdalbuildvrt $out/SRTM.vrt $out/*.hgt
- '';
+ dem1 = builtins.fromJSON (builtins.readFile ./dem1.json);
+ dem3 = builtins.fromJSON (builtins.readFile ./dem3.json);
meta = with lib; {
description = "Digital Elevation Data";
@@ -33,4 +13,44 @@ stdenvNoCC.mkDerivation {
platforms = platforms.all;
skip.ci = true;
};
+in
+{
+ vrt = stdenvNoCC.mkDerivation rec {
+ pname = "dem1-vrt";
+ inherit version meta;
+
+ srcs = lib.mapAttrsToList (name: spec: fetchurl spec) dem1;
+
+ unpackPhase = lib.concatMapStringsSep "\n" (src: "unzip ${src}") srcs;
+
+ nativeBuildInputs = [ unzip gdal ];
+
+ dontFixup = true;
+ preferLocalBuild = true;
+
+ installPhase = ''
+ install -Dm644 **/*.hgt -t $out/hgt
+ gdalbuildvrt $out/SRTM1.vrt $out/hgt/*.hgt
+ '';
+ };
+
+ tiles = stdenvNoCC.mkDerivation rec {
+ pname = "dem3-tiles";
+ inherit version meta;
+
+ # 1 arc-second hgt files are not supported by elevation_server
+ srcs = lib.mapAttrsToList (name: spec: fetchurl spec) dem3;
+
+ unpackPhase = lib.concatMapStringsSep "\n" (src: "unzip ${src}") srcs;
+
+ nativeBuildInputs = [ unzip elevation_server ];
+
+ dontFixup = true;
+ preferLocalBuild = true;
+
+ installPhase = ''
+ install -Dm644 **/*.hgt -t $out/hgt
+ make_data -hgt $out/hgt -out $out/dem_tiles
+ '';
+ };
}
diff --git a/pkgs/data/maps/dem/dem3.json b/pkgs/data/maps/dem/dem3.json
@@ -0,0 +1,50 @@
+{
+ "R34": {
+ "url": "http://viewfinderpanoramas.org/dem3/R34v2.zip",
+ "sha256": "0q3q0lmmdnpxpmg8b20d80h2yfzqximzmr8h41rrm4rsbgy2wam6"
+ },
+ "R35": {
+ "url": "http://viewfinderpanoramas.org/dem3/R35v2.zip",
+ "sha256": "05g5q1v3gb2bj2xwhf5n4d64r9g5j56181f6lwm1a6v79jlkmnaz"
+ },
+ "R36": {
+ "url": "http://viewfinderpanoramas.org/dem3/R36v2.zip",
+ "sha256": "07xdaswvfzfx9905bv6qkdhsbfr407ri9xkalli35g69w22i1qsk"
+ },
+ "Q34": {
+ "url": "http://viewfinderpanoramas.org/dem3/Q34v2.zip",
+ "sha256": "0pz82xq0w81zdyvnjcr06kl3vngi5ccmi9p4wi1yq5kykay5z12j"
+ },
+ "Q35": {
+ "url": "http://viewfinderpanoramas.org/dem3/Q35v2.zip",
+ "sha256": "1ikbfica9yifmm2rjx4ykh8r0xfh7yqz03xbw6nq0mwrraj2dims"
+ },
+ "Q36": {
+ "url": "http://viewfinderpanoramas.org/dem3/Q36v2.zip",
+ "sha256": "03lj1z4y380yw49nxrbqcvj8kjp5zsq5s44j4f21sdcn6jzqnfds"
+ },
+ "P34": {
+ "url": "http://viewfinderpanoramas.org/dem3/P34v2.zip",
+ "sha256": "0z32s91043zjijrx5m5xsvljx8vh8k1r883yhkgf5v789mp08yvc"
+ },
+ "P35": {
+ "url": "http://viewfinderpanoramas.org/dem3/P35v2.zip",
+ "sha256": "06yvbifnzd4phb15c71psg69xnjllfm8kgq6nivf9yiwxiab4qk9"
+ },
+ "P36": {
+ "url": "http://viewfinderpanoramas.org/dem3/P36v2.zip",
+ "sha256": "019rl9kclv2crabwabqj443k8z0xai562xzxzk8hy0ij6a6ifiwm"
+ },
+ "O34": {
+ "url": "http://viewfinderpanoramas.org/dem3/O34.zip",
+ "sha256": "0rrkjxd9bsrmqpnx0vmqy5lv4djqplcymh9j0z53brmaplwhvzhi"
+ },
+ "O35": {
+ "url": "http://viewfinderpanoramas.org/dem3/O35.zip",
+ "sha256": "1inqyady5zi3bnfqmf89wmx9rvyzsxxirbq76d1jshzfghkabf92"
+ },
+ "O36": {
+ "url": "http://viewfinderpanoramas.org/dem3/O36.zip",
+ "sha256": "02a12spzrypv03mhn6ywddhz2kyy5j606g773jwigimdn985wr5s"
+ }
+}