Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
Germany Open-Data CityGML
Commits
b7da7eaf
Commit
b7da7eaf
authored
Nov 18, 2025
by
Eric Duminil
Browse files
Trying to download zip files for Berlin
parent
7e39bcda
Changes
1
Hide whitespace changes
Inline
Side-by-side
03_berlin.py
View file @
b7da7eaf
import
xml.etree.ElementTree
as
ET
from
datetime
import
datetime
from
pathlib
import
Path
from
citygml_download
import
TMP_DIR
,
Bundesland
,
download_all_files
,
download_file
from
citygml_download
import
TMP_DIR
,
Bundesland
,
download_all_files
,
download_file
from
zipfile_download
import
ZipFile
from
zipfile_download
import
ZipFile
...
@@ -7,3 +11,31 @@ BERLIN = Bundesland(
...
@@ -7,3 +11,31 @@ BERLIN = Bundesland(
info
=
"https://gdi.berlin.de/geonetwork/srv/ger/catalog.search#/metadata/3c7c49af-00a4-3bcd-bc00-20e7f0f1b7bf"
,
info
=
"https://gdi.berlin.de/geonetwork/srv/ger/catalog.search#/metadata/3c7c49af-00a4-3bcd-bc00-20e7f0f1b7bf"
,
license
=
"dl-de/zero-2-0"
,
license
=
"dl-de/zero-2-0"
,
)
)
if
__name__
==
"__main__"
:
atom_path
=
TMP_DIR
/
f
"
{
BERLIN
}
.atom"
download_file
(
BERLIN
.
source
,
TMP_DIR
/
atom_path
)
tree
=
ET
.
parse
(
atom_path
)
root
=
tree
.
getroot
()
zip_files
=
[]
ns
=
{
"atom"
:
"http://www.w3.org/2005/Atom"
}
updated_node
=
root
.
find
(
"atom:updated"
,
ns
)
if
updated_node
is
None
:
raise
ValueError
(
"No date has been found"
)
updated_date
=
updated_node
.
text
if
updated_date
is
None
:
raise
ValueError
(
"No date has been found"
)
source_date
=
datetime
.
strptime
(
updated_date
,
"%Y-%m-%dT%H:%M:%SZ"
)
for
file_elem
in
root
.
findall
(
"atom:entry/atom:link"
,
ns
):
href
=
file_elem
.
attrib
[
"href"
]
if
href
.
endswith
(
".zip"
):
zip_files
.
append
(
ZipFile
(
url
=
href
,
bundesland
=
BERLIN
,
source_date
=
source_date
,
)
)
download_all_files
(
zip_files
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment