Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
measprocess
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Eller
measprocess
Commits
2646e972
Commit
2646e972
authored
Dec 02, 2022
by
Sonja Tripkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to pull_from_geodatenviewer_meas and pull_from_geodatenviewer_list in fetch.py
parent
2335e4ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
fetch.py
measprocess/geospatial/fetch.py
+14
-12
No files found.
measprocess/geospatial/fetch.py
View file @
2646e972
...
...
@@ -131,12 +131,14 @@ def pull_from_geodatenviewer_list(squares: List[str]) -> gpd.GeoDataFrame:
# downloading .zip files
# example of single square with data: https://www.wien.gv.at/ma41datenviewer/downloads/ma41/geodaten/fmzk_bkm/103081_bkm.zip
for
square_number
in
squares
:
urllib
.
request
.
urlretrieve
(
"https://www.wien.gv.at/ma41datenviewer/downloads/geodaten/fmzk_bkm/{}_bkm.zip"
.
format
(
square_number
),
os
.
path
.
join
(
dir_path
,
"{}.zip"
.
format
(
square_number
)),
)
try
:
urllib
.
request
.
urlretrieve
(
"https://www.wien.gv.at/ma41datenviewer/downloads/geodaten/fmzk_bkm/{}_bkm.zip"
.
format
(
square_number
),
os
.
path
.
join
(
dir_path
,
"{}.zip"
.
format
(
square_number
)),
)
except
:
continue
# extracting and deleting .zip files
for
item
in
os
.
listdir
(
dir_path
):
# loop through items in dir
...
...
@@ -150,8 +152,10 @@ def pull_from_geodatenviewer_list(squares: List[str]) -> gpd.GeoDataFrame:
# combine all .shp files
geo_df_all
=
pd
.
DataFrame
()
for
square
in
squares
:
geo_df
=
gpd
.
read_file
(
os
.
path
.
join
(
dir_path
,
square
+
"_bkm.shp"
))
geo_df_all
=
pd
.
concat
([
geo_df_all
,
geo_df
],
ignore_index
=
True
)
try
:
geo_df
=
gpd
.
read_file
(
os
.
path
.
join
(
dir_path
,
square
+
"_bkm.shp"
))
geo_df_all
=
pd
.
concat
([
geo_df_all
,
geo_df
],
ignore_index
=
True
)
except
:
continue
shutil
.
rmtree
(
dir_path
)
# deletes the directory containing all the files
return
geo_df_all
...
...
@@ -187,10 +191,8 @@ def pull_from_geodatenviewer_meas(
for
file
in
os
.
listdir
(
raster_path
):
if
file
.
endswith
(
".shp"
):
raster_gdf
=
gpd
.
read_file
(
os
.
path
.
join
(
raster_path
,
file
))
if
raster_gdf
.
geometry
.
crs
!=
"EPSG:4326"
:
raise
ValueError
(
"Raster EPSG has changed, see https://www.data.gv.at/katalog/dataset/b2d17060-b2f4-4cd7-a2e5-64beccfeb4c1 for mor information."
)
raster_gdf
.
to_crs
(
4326
,
inplace
=
True
)
meas_gdf
=
gpd
.
GeoDataFrame
(
geometry
=
measurement_coords
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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