Commit 1e151f09 authored by Eric Duminil's avatar Eric Duminil
Browse files

Trying Hessen

parent b997042b
# https://gds.hessen.de/INTERSHOP/web/WFS/HLBG-Geodaten-Site/de_DE/-/EUR/ViewDownloadcenter-Start?path=3D-Daten/3D-Geb%C3%A4udemodelle/3D-Geb%C3%A4udemodelle%20LoD2
import json
from datetime import datetime
from citygml_download import TMP_DIR, Bundesland, CityGMLWithDate, download_all_files, download_file
SERVER = "https://gds.hessen.de"
HESSEN = Bundesland(
"Hessen",
source="https://gds.hessen.de/INTERSHOP/rest/WFS/HLBG-Geodaten-Site/-/downloadcenter?path=3D-Daten/3D-Geb%C3%A4udemodelle/3D-Geb%C3%A4udemodelle%20LoD2&navigation=all",
info="https://gds.hessen.de/INTERSHOP/web/WFS/HLBG-Geodaten-Site/de_DE/-/EUR/ViewDownloadcenter-Start?path=3D-Daten/3D-Geb%C3%A4udemodelle/3D-Geb%C3%A4udemodelle%20LoD2",
)
if __name__ == "__main__":
local_json_path = TMP_DIR / "hessen_lod2.json"
download_file(HESSEN.source, local_json_path)
with open(local_json_path) as json_file:
data = json.load(json_file)
citygmls = []
for kreis_link in data['navigation']:
if 'LoD2' in kreis_link['uri'] and kreis_link['level'] == 4:
kreis_info_json_path = TMP_DIR / f"hessen_{kreis_link['name']}.json"
download_file(SERVER + kreis_link['uri'], kreis_info_json_path)
with open(kreis_info_json_path) as json_file:
kreis_data = json.load(json_file)
creation_date = kreis_data['searchresult']['packages'][0]['creationDate']
zip_link = kreis_data['searchresult']['packages'][0]['downloadLink']['uri']
citygmls.append(
CityGMLWithDate(
url=SERVER + zip_link,
bundesland=HESSEN,
source_date=datetime.strptime(creation_date, "%d.%m.%Y"),
)
)
download_all_files(citygmls, jobs=1, sleep=20)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment