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
27896a9c
Commit
27896a9c
authored
Nov 19, 2025
by
Eric Duminil
Browse files
Trying to specify a custom name
parent
c477b595
Changes
1
Hide whitespace changes
Inline
Side-by-side
15_schleswig_holstein.py
View file @
27896a9c
# https://geodaten.schleswig-holstein.de/gaialight-sh/_apps/dladownload/single.php?file=LOD2_SH_Massendownload.geojson&id=4
# https://geodaten.schleswig-holstein.de/gaialight-sh/_apps/dladownload/single.php?file=LOD2_SH_Massendownload.geojson&id=4
import
json
import
json
import
re
from
datetime
import
datetime
from
datetime
import
datetime
from
citygml_download
import
TMP_DIR
,
Bundesland
,
CityGMLWithDate
,
download_all_files
,
download_file
from
citygml_download
import
TMP_DIR
,
Bundesland
,
CityGMLWithDate
,
download_all_files
,
download_file
...
@@ -13,6 +14,19 @@ SCHLESWIG_HOLSTEIN = Bundesland(
...
@@ -13,6 +14,19 @@ SCHLESWIG_HOLSTEIN = Bundesland(
)
)
class
CityGMLWithCustomName
(
CityGMLWithDate
):
# massen.php?file=LoD2_32_454_6068_1_SH.xml&id=4&live=2023&km=32450_6060
FILENAME_PATTERN
=
re
.
compile
(
r
"lod2_.*?\.[xg]ml"
,
re
.
IGNORECASE
)
@
property
def
filename
(
self
)
->
str
:
full_filename
=
super
().
filename
if
m
:
=
self
.
FILENAME_PATTERN
.
search
(
full_filename
):
short
=
m
.
group
().
replace
(
".xml"
,
".gml"
)
return
short
raise
ValueError
(
f
"Couldn't recognize filename from
{
full_filename
}
"
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
geojson_path
=
TMP_DIR
/
f
"
{
SCHLESWIG_HOLSTEIN
}
.geojson"
geojson_path
=
TMP_DIR
/
f
"
{
SCHLESWIG_HOLSTEIN
}
.geojson"
download_file
(
SCHLESWIG_HOLSTEIN
.
source
,
TMP_DIR
/
geojson_path
)
download_file
(
SCHLESWIG_HOLSTEIN
.
source
,
TMP_DIR
/
geojson_path
)
...
@@ -26,7 +40,7 @@ if __name__ == "__main__":
...
@@ -26,7 +40,7 @@ if __name__ == "__main__":
for
feature
in
features
:
for
feature
in
features
:
properties
=
feature
[
"properties"
]
properties
=
feature
[
"properties"
]
citygmls
.
append
(
citygmls
.
append
(
CityGMLWith
Dat
e
(
CityGMLWith
CustomNam
e
(
url
=
properties
[
"link_data"
],
url
=
properties
[
"link_data"
],
bundesland
=
SCHLESWIG_HOLSTEIN
,
bundesland
=
SCHLESWIG_HOLSTEIN
,
source_date
=
datetime
.
strptime
(
properties
[
"datum"
],
"%Y-%m-%d"
),
source_date
=
datetime
.
strptime
(
properties
[
"datum"
],
"%Y-%m-%d"
),
...
...
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