default.nix (1256B)
1 { 2 lib, 3 stdenv, 4 fetchurl, 5 osmium-tool, 6 }: 7 8 stdenv.mkDerivation rec { 9 pname = "osm-extracts"; 10 version = "241110"; 11 12 src = fetchurl { 13 url = "https://download.geofabrik.de/russia/northwestern-fed-district-${version}.osm.pbf"; 14 hash = "sha256-ixfuHOkkOxxMb2YGsXII6tzWnxG6/E01u8byVgM12OM="; 15 }; 16 17 dontUnpack = true; 18 19 nativeBuildInputs = [ osmium-tool ]; 20 21 buildPhase = '' 22 runHook preBuild 23 24 for region in RU-{ARK,KO,KR,LEN,MUR,NEN,NGR,PSK,SPE,VLG}; do 25 osmium tags-filter -o $region-boundary.osm $src r/ISO3166-2=$region 26 osmium extract -p $region-boundary.osm $src --set-bounds -s simple -o $region.osm.pbf 27 osmium export $region-boundary.osm -o $region-boundary.geojson 28 osmium tags-filter -o $region-water.osm $region.osm.pbf a/natural=water 29 osmium export $region-water.osm -o $region-water.geojson 30 done 31 32 runHook postBuild 33 ''; 34 35 installPhase = '' 36 install -Dm644 *.geojson *.osm *.osm.pbf -t $out 37 ''; 38 39 meta = { 40 description = "Administrative boundaries"; 41 homepage = "https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative"; 42 license = lib.licenses.free; 43 maintainers = [ lib.maintainers.sikmir ]; 44 platforms = lib.platforms.all; 45 skip.ci = true; 46 }; 47 }