Parse Bezirke
This commit is contained in:
78006
geobezirke-parsed.json
Normal file
78006
geobezirke-parsed.json
Normal file
File diff suppressed because it is too large
Load Diff
25
geoparser.py
25
geoparser.py
@@ -1,25 +0,0 @@
|
||||
import json
|
||||
import os
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
os.chdir("C:\\Users\\milli\\Documents\\Datenbereinigung")
|
||||
|
||||
bezirk_table = defaultdict(dict)
|
||||
|
||||
with open("geobezirke.json", "r", encoding='utf-8') as file:
|
||||
data = json.load(file)
|
||||
for entry in data["features"]:
|
||||
bezirk = entry["properties"]["bezirk"]
|
||||
if bezirk not in bezirk_table:
|
||||
bezirk_table[bezirk] = []
|
||||
bezirk_table[bezirk].append(entry["properties"]["jahr_date"])
|
||||
|
||||
print(len(bezirk_table))
|
||||
for bez in bezirk_table.keys():
|
||||
print("----------")
|
||||
print(bez)
|
||||
for date in sorted(bezirk_table[bez]):
|
||||
print(date)
|
||||
print("---------")
|
||||
|
||||
31
geoparserbezirke.py
Normal file
31
geoparserbezirke.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import json
|
||||
import os
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
os.chdir("C:\\Users\\milli\\Documents\\Datenbereinigung")
|
||||
|
||||
output_file = {
|
||||
"type": "FeatureCollection",
|
||||
"features": [],
|
||||
}
|
||||
|
||||
bezirk_table = defaultdict(dict)
|
||||
|
||||
with open("geobezirke.json", "r", encoding='utf-8') as file:
|
||||
data = json.load(file)
|
||||
for entry in data["features"]:
|
||||
if entry["properties"]["jahr_date"] == "2024-12-31":
|
||||
output_file["features"].append({
|
||||
"type": entry["type"],
|
||||
"id": entry["id"],
|
||||
"geometry": entry["geometry"],
|
||||
"srsName": entry["srsName"],
|
||||
"properties": {
|
||||
"bezirk": entry["properties"]["bezirk"],
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
with open("geobezirke-parsed.json", "w", encoding='utf-8') as output:
|
||||
json.dump(output_file, output, ensure_ascii=False, indent=4)
|
||||
Reference in New Issue
Block a user