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
7c5c7e80
Commit
7c5c7e80
authored
Nov 05, 2025
by
Eric Duminil
Browse files
Remove corrupt zips
parent
c69d76a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
07_hessen.py
View file @
7c5c7e80
# 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
import
zipfile
from
datetime
import
datetime
from
pathlib
import
Path
from
urllib.parse
import
quote
import
zipfile
from
citygml_download
import
TMP_DIR
,
Bundesland
,
CityGMLWithDate
,
download_all_files
,
download_file
...
...
@@ -26,12 +26,21 @@ class ZipFile(CityGMLWithDate):
result
=
super
().
download
(
tmp_dir
,
max_retries
,
sleep
)
if
result
:
output_folder
=
self
.
download_folder
/
self
.
path
.
stem
with
zipfile
.
ZipFile
(
self
.
path
,
"r"
)
as
main_zip
:
main_zip
.
extractall
(
output_folder
)
for
inner_zip_path
in
output_folder
.
glob
(
'*.zip'
):
try
:
print
(
f
" Extracting
{
self
.
filename
}
"
,
end
=
""
)
with
zipfile
.
ZipFile
(
self
.
path
,
"r"
)
as
main_zip
:
main_zip
.
extractall
(
output_folder
)
except
zipfile
.
BadZipfile
:
print
(
f
"🛑
{
self
.
path
}
is corrupt. Deleting"
)
self
.
path
.
unlink
()
return
False
for
inner_zip_path
in
output_folder
.
glob
(
"*.zip"
):
with
zipfile
.
ZipFile
(
inner_zip_path
,
"r"
)
as
inner_zip
:
inner_zip
.
extractall
(
self
.
bundesland
.
download_folder
)
print
(
f
" Extracted
{
inner_zip_path
}
"
)
print
(
"."
,
end
=
""
,
flush
=
True
)
print
()
return
result
...
...
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