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
9fb0066d
Commit
9fb0066d
authored
1 month ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Preparing polygon check
parent
74451055
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
download_files_from_LGL_BW.py
+5
-4
download_files_from_LGL_BW.py
with
5 additions
and
4 deletions
+5
-4
download_files_from_LGL_BW.py
+
5
-
4
View file @
9fb0066d
...
...
@@ -101,14 +101,14 @@ def wkt_polygon_to_grid_coords(location_name: str, wkt: str) -> tuple[int, int,
return
(
x1
,
x2
,
y1
,
y2
)
def
download_
rectangle
(
output_dir
:
Path
,
x1
:
int
,
x2
:
int
,
y1
:
int
,
y2
:
int
)
->
None
:
def
download_
whole_region
(
output_dir
:
Path
,
wkt
:
str
,
x1
:
int
,
x2
:
int
,
y1
:
int
,
y2
:
int
)
->
None
:
"""Downloads every zip of a given region, to output_dir, and extracts CityGML files."""
# FIXME: Too many uninteresting tiles for complex shapes. Check if the tile is interesecting with the polygon!
for
x
in
range
(
x1
,
x2
+
1
,
RASTER
):
for
y
in
range
(
y1
,
y2
+
1
,
RASTER
):
citygml_zip
=
f
"LoD2_
{
UTM
}
_
{
x
}
_
{
y
}
_
{
RASTER
}
_
{
BUNDESLAND
}
.zip"
citygml_url
=
f
"
{
CITYGML_SERVER
}
/
{
citygml_zip
}
"
local_zip
=
output_dir
/
citygml_zip
# .replace('.zip', '.gml')
local_zip
=
output_dir
/
citygml_zip
if
local_zip
.
exists
():
print
(
f
"
{
local_zip
.
name
}
already in
{
output_dir
.
name
}
/"
)
else
:
...
...
@@ -165,7 +165,8 @@ def extract_region(output_dir: Path, location_name: str, wkt: str) -> None:
f
'@
{
params_path
}
'
],
text
=
True
,
capture_output
=
True
capture_output
=
True
,
check
=
False
)
if
(
result
.
stderr
):
print
(
result
.
stderr
)
...
...
@@ -195,7 +196,7 @@ def main(regions: dict[str, str]) -> None:
output_dir
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
wkt
=
get_wkt
(
wkt_or_zipcode
)
x1
,
x2
,
y1
,
y2
=
wkt_polygon_to_grid_coords
(
location_name
,
wkt
)
download_
rectangle
(
output_dir
,
x1
,
x2
,
y1
,
y2
)
download_
whole_region
(
output_dir
,
wkt
,
x1
,
x2
,
y1
,
y2
)
if
EXTRACT_REGIONS
:
extract_region
(
output_dir
,
location_name
,
wkt
)
print
()
...
...
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