commit 429e7be6a254d865ec36006ecce19c7934fc82bd
parent 9d45b98b9a69d1f15f161439a79187ee917dcd6d
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Fri, 17 Jun 2022 11:09:51 +0300
Add tilecloud
Diffstat:
3 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -210,6 +210,7 @@ lib.makeScope newScope (
tpkutils = callPackage ./geospatial/tpkutils { };
vt2geojson = callPackage ./geospatial/vt2geojson { };
titiler = callPackage ./geospatial/titiler { };
+ tilecloud = callPackage ./geospatial/tilecloud { };
### GNSS
diff --git a/pkgs/geospatial/tilecloud/default.nix b/pkgs/geospatial/tilecloud/default.nix
@@ -0,0 +1,43 @@
+{ lib, fetchFromGitHub, python3Packages, c2cwsgiutils }:
+
+python3Packages.buildPythonApplication rec {
+ pname = "tilecloud";
+ version = "1.8.0";
+
+ src = fetchFromGitHub {
+ owner = "camptocamp";
+ repo = pname;
+ rev = version;
+ hash = "sha256-TaBwrh+bvyMBx8IlCLZ/S/7Sb0Gp9tz02204qbWStBA=";
+ };
+
+ patches = [ ./set-tmpl-path.patch ];
+
+ propagatedBuildInputs = with python3Packages; [
+ azure-storage-blob
+ azure-identity
+ boto3
+ bottle
+ c2cwsgiutils
+ pillow
+ pyproj
+ requests
+ redis
+ ];
+
+ checkInputs = with python3Packages; [ pytestCheckHook ];
+
+ # https://github.com/camptocamp/tilecloud/issues/391
+ postInstall = ''
+ site_packages=$out/lib/${python3Packages.python.libPrefix}/site-packages
+ cp -r static tiles views $site_packages
+ substituteInPlace $out/bin/tc-viewer --subst-var site_packages
+ '';
+
+ meta = with lib; {
+ description = "Tools for managing tiles";
+ inherit (src.meta) homepage;
+ license = licenses.bsd2;
+ maintainers = [ maintainers.sikmir ];
+ };
+}
diff --git a/pkgs/geospatial/tilecloud/set-tmpl-path.patch b/pkgs/geospatial/tilecloud/set-tmpl-path.patch
@@ -0,0 +1,28 @@
+diff --git i/tc-viewer w/tc-viewer
+index bf226d2..2ff2735 100755
+--- i/tc-viewer
++++ w/tc-viewer
+@@ -7,6 +7,8 @@ import sys
+
+ import bottle
+
++bottle.TEMPLATE_PATH = "@site_packages@/views"
++
+ from tilecloud import BoundingPyramid, Bounds, Tile, TileCoord, TileStore
+ from tilecloud.filter.contenttype import ContentTypeAdder
+
+@@ -146,12 +148,12 @@ def openwebglobe():
+
+ @bottle.route("/favicon.ico")
+ def favicon():
+- return bottle.static_file("favicon.ico", root="static")
++ return bottle.static_file("favicon.ico", root="@site_packages@/static")
+
+
+ @bottle.route("/static/<path:re:.*>")
+ def static(path):
+- return bottle.static_file(path, root="static")
++ return bottle.static_file(path, root="@site_packages@/static")
+
+
+ @bottle.route("/")