commit 1e44a2cee5a2f6603fa19ed0bfd36a273b726b2d
parent 2b3343dd8da17fe943fefc7bfbe333aaa7fb5590
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Thu, 3 Dec 2020 01:14:13 +0300
Add osm-extracts
Diffstat:
2 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/pkgs/data/misc/osm-extracts/default.nix b/pkgs/data/misc/osm-extracts/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, gdal, osmium-tool, sources }:
+let
+ year = stdenv.lib.substring 0 2 sources.geofabrik-russia-nwfd.version;
+ month = stdenv.lib.substring 2 2 sources.geofabrik-russia-nwfd.version;
+ day = stdenv.lib.substring 4 2 sources.geofabrik-russia-nwfd.version;
+
+ regions = [
+ "RU-ARK"
+ "RU-VLG"
+ "RU-KGD"
+ "RU-KR"
+ "RU-KO"
+ "RU-LEN"
+ "RU-MUR"
+ "RU-NEN"
+ "RU-NGR"
+ "RU-PSK"
+ "RU-SPE"
+ ];
+in
+{
+ admin-boundaries = stdenv.mkDerivation {
+ pname = "osm-admin-boundaries";
+ version = "20${year}-${month}-${day}";
+
+ src = sources.geofabrik-russia-nwfd;
+
+ dontUnpack = true;
+
+ nativeBuildInputs = [ gdal osmium-tool ];
+
+ buildPhase = stdenv.lib.concatMapStringsSep "\n"
+ (name: ''
+ osmium tags-filter -o ${name}-boundary.osm $src r/ISO3166-2=${name}
+ ogr2ogr -f GeoJSON ${name}-boundary.geojson ${name}-boundary.osm multipolygons
+ '')
+ regions;
+
+ installPhase = "install -Dm644 *.geojson -t $out";
+
+ meta = with stdenv.lib; {
+ description = "Administrative boundaries";
+ homepage = "https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative";
+ license = licenses.free;
+ maintainers = [ maintainers.sikmir ];
+ platforms = platforms.all;
+ skip.ci = true;
+ };
+ };
+}
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -80,6 +80,7 @@ lib.makeScope newScope (
usa-osm-topo-routable = callPackage ./data/maps/usa-osm-topo-routable { };
gpxsee-poi = callPackage ./data/misc/gpxsee-poi { };
+ osm-extracts = callPackage ./data/misc/osm-extracts { };
routinodb = callPackage ./data/misc/routinodb { };
goldendict-arc-dark-theme =