Skip to content
GitLab
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
9d539c2b
Commit
9d539c2b
authored
6 months ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Formatting
parent
9b394e44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
download_files_from_LGL_BW.py
+6
-2
download_files_from_LGL_BW.py
with
6 additions
and
2 deletions
+6
-2
download_files_from_LGL_BW.py
+
6
-
2
View file @
9d539c2b
...
@@ -42,7 +42,7 @@ CITYGML_SERVER = "https://opengeodata.lgl-bw.de/data/lod2"
...
@@ -42,7 +42,7 @@ CITYGML_SERVER = "https://opengeodata.lgl-bw.de/data/lod2"
RASTER
=
2
# [km]
RASTER
=
2
# [km]
BUNDESLAND
=
'bw'
BUNDESLAND
=
'bw'
# UTM32N, used in BW. https://epsg.io/32632
# UTM32N, used in BW. https://epsg.io/32632
TO_LOCAL_CRS
=
Transformer
.
from_crs
(
CRS
.
from_epsg
(
4326
),
TO_LOCAL_CRS
=
Transformer
.
from_crs
(
CRS
.
from_epsg
(
4326
),
CRS
.
from_epsg
(
32632
),
CRS
.
from_epsg
(
32632
),
always_xy
=
True
)
always_xy
=
True
)
...
@@ -88,7 +88,8 @@ def wkt_polygon_to_grid_coords(location_name: str, wkt: str) -> tuple[int, int,
...
@@ -88,7 +88,8 @@ def wkt_polygon_to_grid_coords(location_name: str, wkt: str) -> tuple[int, int,
min_lon
,
max_lon
=
min
(
lons
),
max
(
lons
)
min_lon
,
max_lon
=
min
(
lons
),
max
(
lons
)
min_lat
,
max_lat
=
min
(
lats
),
max
(
lats
)
min_lat
,
max_lat
=
min
(
lats
),
max
(
lats
)
print
(
"%s (%.3f°N %.3f°E -> %.3f°N %.3f°E)"
%
(
location_name
,
max_lat
,
min_lon
,
min_lat
,
max_lon
))
print
(
"%s (%.3f°N %.3f°E -> %.3f°N %.3f°E)"
%
(
location_name
,
max_lat
,
min_lon
,
min_lat
,
max_lon
))
x1
,
y1
=
coordinates_to_grid
(
min_lon
,
min_lat
)
x1
,
y1
=
coordinates_to_grid
(
min_lon
,
min_lat
)
x2
,
y2
=
coordinates_to_grid
(
max_lon
,
max_lat
)
x2
,
y2
=
coordinates_to_grid
(
max_lon
,
max_lat
)
...
@@ -181,13 +182,16 @@ def main(polygons: dict[str, str]) -> None:
...
@@ -181,13 +182,16 @@ def main(polygons: dict[str, str]) -> None:
extract_region
(
output_dir
,
location_name
,
wkt
)
extract_region
(
output_dir
,
location_name
,
wkt
)
print
()
print
()
def
show_coordinates
(
match
):
def
show_coordinates
(
match
):
longitude
,
latitude
=
match
.
groups
()
longitude
,
latitude
=
match
.
groups
()
x
,
y
=
TO_LOCAL_CRS
.
transform
(
longitude
,
latitude
)
x
,
y
=
TO_LOCAL_CRS
.
transform
(
longitude
,
latitude
)
return
f
"
{
x
}
{
y
}
"
return
f
"
{
x
}
{
y
}
"
def
convert_wkt_to_local
(
wkt
):
def
convert_wkt_to_local
(
wkt
):
return
COORDINATES_REGEX
.
sub
(
show_coordinates
,
wkt
)
return
COORDINATES_REGEX
.
sub
(
show_coordinates
,
wkt
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
(
POLYGONS
)
main
(
POLYGONS
)
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