Renumer sql files

This commit is contained in:
2023-03-13 21:41:30 +01:00
parent e01f4e1c34
commit 6c314c5954
7 changed files with 11 additions and 11 deletions

View File

@ -14,8 +14,8 @@ import PyPDF2
PLZ_URL = 'https://www.post.at/g/c/postlexikon'
PLZ_BUTTON = re.compile(r'title="PLZ Bestimmungsort" href="(.*?)"')
KGV_URL = 'https://www.bev.gv.at/portal/page?_pageid=713,2601283&_dad=portal&_schema=PORTAL'
KGV_LINK = re.compile(r'<a\s+href="(.*?)"\s*>')
KGV_URL = 'https://www.bev.gv.at/Services/Downloads/Produktbezogene-Downloads/Unentgeltliche-Produkte/Kataster-Verzeichnisse/Katastralgemeindenverzeichnis.html'
KGV_LINK = re.compile(r'<a\s+href="(.*?)".*?>Katastral')
OV_URL = 'https://statistik.gv.at/fileadmin/publications/Ortsverzeichnis_2001__{}.pdf'
OV_NAMES = ['Burgenland', 'Niederoesterreich', 'Wien']
@ -251,7 +251,7 @@ def write_sql(plz_rows: List[PlzRow], kgv_rows: List[KgvRow], ov_rows: List[OvRo
gemeinden = {gkz: (gem_name, [], []) for kgnr, kg_name, gkz, gem_name in kgv_rows}
pr = set()
with open('plz.sql', 'wb') as f:
with open('90.plz.sql', 'wb') as f:
f.write(b"\nINSERT INTO AT_gem VALUES\n")
for gkz, (name, _, _) in gemeinden.items():
f.write(f"({gkz:5}, '{name}'),\n".encode('utf8'))
@ -332,6 +332,6 @@ if __name__ == '__main__':
plz_data = download_plz()
print('Downloading Katastralgemeindenverzeichnis from www.bev.gv.at')
kgv_data = download_kgv()
print('Generating plz.sql')
print('Generating 90.plz.sql')
write_sql(plz_data, kgv_data, ov_data)
print('Successfully created plz.sql!')
print('Successfully created 90.plz.sql!')