Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
Get Baden-Württemberg CityGML Opendata
Commits
76a8c8b2
Commit
76a8c8b2
authored
1 month ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Allow space in names, with a warning
parent
ce7b378e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
download_LoD2_from_LGL_BW.py
+7
-6
download_LoD2_from_LGL_BW.py
test_download_lod2.py
+10
-3
test_download_lod2.py
with
17 additions
and
9 deletions
+17
-9
download_LoD2_from_LGL_BW.py
+
7
-
6
View file @
76a8c8b2
...
...
@@ -164,15 +164,16 @@ def extract_region(output_dir: Path, location_name: str, wkt_str: str, simstadt_
f
.
write
(
local_wkt
)
with
open
(
params_path
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
f
.
write
(
"--input
\n
"
)
f
.
write
(
','
.
join
(
f
"
{
gml
.
as_posix
()
}
"
for
gml
in
gml_inputs
))
f
.
write
(
"
\n
"
)
f
.
write
(
"--input
\n
\"
"
)
f
.
write
(
','
.
join
(
f
'
{
gml
.
as_posix
()
}
'
for
gml
in
gml_inputs
))
f
.
write
(
"
\
"\
n
"
)
f
.
write
(
"--output
\n
"
)
f
.
write
(
f
'"
{
output_file
.
as_posix
()
}
"
\n
'
)
f
.
write
(
'--local
\n
'
)
f
.
write
(
"--wkt
\n
"
)
f
.
write
(
f
'"
{
wkt_path
.
as_posix
()
}
"
\n
'
)
result
=
subprocess
.
run
([
'java'
,
'-classpath'
,
f
'
{
region_chooser_libs
}
'
,
'eu.simstadt.regionchooser.RegionChooserCLI'
,
f
'@
{
params_path
}
'
...
...
@@ -181,9 +182,9 @@ def extract_region(output_dir: Path, location_name: str, wkt_str: str, simstadt_
capture_output
=
True
,
check
=
False
)
if
result
.
returncode
!=
0
:
if
result
.
stderr
:
logger
.
error
(
"%s"
,
result
.
stderr
)
if
result
.
returncode
!=
0
:
raise
ValueError
(
f
"RegionChooser failed with code
{
result
.
returncode
}
"
)
logger
.
info
(
" DONE!"
)
return
output_file
...
...
@@ -251,7 +252,7 @@ def main(location_name: str, wkt_or_zipcode: str, download_only: bool = False,
# Validate location name
if
' '
in
location_name
:
raise
ValueError
(
"Location name should not
contain spaces
: 'Some City' -> 'SomeCity'
"
)
logger
.
warning
(
"Location
contain
s
spaces
, some workflows might fail.
"
)
if
output_folder
:
output_folder
=
Path
(
output_folder
)
...
...
This diff is collapsed.
Click to expand it.
test_download_lod2.py
+
10
-
3
View file @
76a8c8b2
...
...
@@ -9,6 +9,7 @@ import download_LoD2_from_LGL_BW as bw_data
# Just a few buildings in Schwarzwald
KALTENBRONN_WKT
=
"POLYGON ((8.4266 48.704415, 8.43926 48.704415, 8.43926 48.709031, 8.4266 48.709031, 8.4266 48.704415))"
class
TestUtils
(
unittest
.
TestCase
):
def
test_simstadt_is_available
(
self
):
self
.
assertIsNotNone
(
bw_data
.
find_simstadt_folder
(),
...
...
@@ -59,8 +60,14 @@ class TestGetOpenData(unittest.TestCase):
self
.
assertIn
(
"DEBW_B010000BSWW"
,
content
)
def
test_get_weird_name
(
self
):
bw_data
.
main
(
"WëírdNämeß"
,
KALTENBRONN_WKT
,
output_folder
=
self
.
tempFolder
/
'Kaltenbronn.proj'
)
weird_name
=
"WëírdNämeß"
bw_data
.
main
(
weird_name
,
KALTENBRONN_WKT
,
output_folder
=
self
.
tempFolder
/
f
'
{
weird_name
}
.proj'
)
def
test_get_space_in_name
(
self
):
name_with_space
=
"Two words"
bw_data
.
main
(
name_with_space
,
KALTENBRONN_WKT
,
output_folder
=
self
.
tempFolder
/
f
'
{
name_with_space
}
.proj'
)
def
test_only_download
(
self
):
gml_path
=
bw_data
.
main
(
"JustDownload"
,
KALTENBRONN_WKT
,
download_only
=
True
,
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets