Skip to content

Commit

Permalink
Sort fluren
Browse files Browse the repository at this point in the history
  • Loading branch information
pathmapper authored Nov 4, 2024
1 parent aaa6a1c commit ceef804
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions create_json.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ unzip ./temp/wfsdata.zip -d ./temp/
ogr2ogr -f GeoJSON -dialect SQLite -sql "SELECT art, name, schluessel, gmdschl FROM KatasterBezirk" ./temp/data.geojson ./temp/ALKIS-Vereinfacht/KatasterBezirk.shp
jq -c --argfile katasteraemter katasteraemter.json '.features[] | select(.properties.art|contains("Gemarkungsteil/Flur")|not ) | {name: (.properties.name + " (" + (.properties.schluessel | tonumber | tostring | .[1:5]) +")"), schluessel: .properties.schluessel | tonumber | tostring | .[1:5], gmdschl: .properties.gmdschl | tonumber | tostring | .[0:4]} | .gmdschl |= $katasteraemter[.]' ./temp/data.geojson > ./temp/gemarkungen.txt
jq -c '.features[] | select(.properties.art|contains("Gemarkungsteil/Flur")) | {name: .properties.name | tonumber | tostring, schluessel: .properties.schluessel | tonumber | tostring | .[1:5]}' ./temp/data.geojson > ./temp/fluren.txt
jq -c -S --null-input --slurpfile gemarkungen ./temp/gemarkungen.txt --slurpfile fluren ./temp/fluren.txt 'reduce $gemarkungen[] as $i ({}; setpath([$i.gmdschl, $i.name];{schluessel: $i.schluessel, fluren: [$fluren[] | select(.schluessel == $i.schluessel).name]})) | if . == {} then empty else . end' > ./temp/katasteraemter-gemarkungen-fluren-nrw.json
jq -c -S --null-input --slurpfile gemarkungen ./temp/gemarkungen.txt --slurpfile fluren ./temp/fluren.txt 'reduce $gemarkungen[] as $i ({}; setpath([$i.gmdschl, $i.name]; {schluessel: $i.schluessel, fluren: ([$fluren[] | select(.schluessel == $i.schluessel).name | tonumber] | sort | map(tostring))})) | if . == {} then empty else . end' > ./temp/katasteraemter-gemarkungen-fluren-nrw.json
if [ -s ./temp/katasteraemter-gemarkungen-fluren-nrw.json ]; then
mv ./temp/katasteraemter-gemarkungen-fluren-nrw.json ./data/katasteraemter-gemarkungen-fluren-nrw.json
fi
Expand All @@ -19,7 +19,7 @@ unzip ./temp/gid7/wfsdata.zip -d ./temp/gid7/
ogr2ogr -f GeoJSON -dialect SQLite -sql "SELECT art, name, schluessel, gmdschl FROM KatasterBezirk" ./temp/gid7/data.geojson ./temp/gid7/ALKIS-Vereinfacht/KatasterBezirk.shp
jq -c --argfile katasteraemter katasteraemter.json '.features[] | select(.properties.art|contains("Gemarkungsteil/Flur")|not ) | {name: (.properties.name + " (" + (.properties.schluessel | tonumber | tostring | .[1:5]) +")"), schluessel: .properties.schluessel | tonumber | tostring | .[1:5], gmdschl: .properties.gmdschl | tonumber | tostring | .[0:4]} | .gmdschl |= $katasteraemter[.]' ./temp/gid7/data.geojson > ./temp/gid7/gemarkungen.txt
jq -c '.features[] | select(.properties.art|contains("Gemarkungsteil/Flur")) | {name: .properties.name | tonumber | tostring, schluessel: .properties.schluessel | tonumber | tostring | .[1:5]}' ./temp/gid7/data.geojson > ./temp/gid7/fluren.txt
jq -c -S --null-input --slurpfile gemarkungen ./temp/gid7/gemarkungen.txt --slurpfile fluren ./temp/gid7/fluren.txt 'reduce $gemarkungen[] as $i ({}; setpath([$i.gmdschl, $i.name];{schluessel: $i.schluessel, fluren: [$fluren[] | select(.schluessel == $i.schluessel).name]})) | if . == {} then empty else . end' > ./temp/gid7/katasteraemter-gemarkungen-fluren-nrw.json
jq -c -S --null-input --slurpfile gemarkungen ./temp/gid7/gemarkungen.txt --slurpfile fluren ./temp/gid7/fluren.txt 'reduce $gemarkungen[] as $i ({}; setpath([$i.gmdschl, $i.name]; {schluessel: $i.schluessel, fluren: ([$fluren[] | select(.schluessel == $i.schluessel).name | tonumber] | sort | map(tostring))})) | if . == {} then empty else . end' > ./temp/gid7/katasteraemter-gemarkungen-fluren-nrw.json
if [ -s ./temp/gid7/katasteraemter-gemarkungen-fluren-nrw.json ]; then
mv ./temp/gid7/katasteraemter-gemarkungen-fluren-nrw.json ./data/katasteraemter-gemarkungen-fluren-nrw_gid7.json
fi
Expand Down

0 comments on commit ceef804

Please sign in to comment.