Skip to content

Commit

Permalink
add local file import and restructure addon
Browse files Browse the repository at this point in the history
  • Loading branch information
juleshaas committed Jan 24, 2024
1 parent d1f04c3 commit 408aef8
Show file tree
Hide file tree
Showing 5 changed files with 363 additions and 203 deletions.
87 changes: 54 additions & 33 deletions download_urls.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,66 @@
#!/usr/bin/env python3
#
############################################################################
#
# MODULE: download_urls
# AUTHOR(S): Anika Weinmann, Julia Haas

# PURPOSE: German Federal State download urls for ALKIS buildings
# COPYRIGHT: (C) 2024 by mundialis GmbH & Co. KG and the GRASS
# Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#############################################################################

URLS = {
"Brandenburg": None,
"Berlin": "https://datenbox.stadt-berlin.de/ssf/s/readFile/share"
"BW": None,
"BY": None,
"BE": "https://datenbox.stadt-berlin.de/ssf/s/readFile/share"
"/14254/8799702476865788292/publicLink/SHP_BE_ALKIS.7z",
"Baden-Württemberg": None,
"Bayern": None,
"Bremen": None,
"Hessen": "https://gds.hessen.de/downloadcenter/DATE/"
"BB": None,
"HB": None,
"HH": None,
"HE": "https://gds.hessen.de/downloadcenter/DATE/"
"Liegenschaftskataster/Hausumringe%20(shape)/Hausumringe%20Hessen.zip",
"Hamburg": None,
"Mecklenburg-Vorpommern": None,
"Niedersachsen": None,
"Nordrhein-Westfalen": "https://www.opengeodata.nrw.de/produkte/geobasis"
"MV": None,
"NI": None,
"NW": "https://www.opengeodata.nrw.de/produkte/geobasis"
"/lk/akt/hu_shp/hu_EPSG4647_Shape.zip",
"Rheinland-Pfalz": None,
"Schleswig-Holstein": None,
"Saarland": None,
"Sachsen": "https://geocloud.landesvermessung.sachsen.de/index.php/s"
"RP": None,
"SL": None,
"SN": "https://geocloud.landesvermessung.sachsen.de/index.php/s"
"/YgBfai4gXoiExJx/download?path=%2F&files=hu_sn_shape.zip",
"Sachsen-Anhalt": None,
"Thüringen": "https://geoportal.geoportal-th.de/hausko_umr/HU-TH.zip",
"ST": None,
"SH": None,
"TH": "https://geoportal.geoportal-th.de/hausko_umr/HU-TH.zip",
}

filenames = {
"Brandenburg": None,
"Berlin": "SHP_BE_ALKIS_Merged/Gebaeude_Bauteile_Flaechen.shp",
"Baden-Württemberg": None,
"Bayern": None,
"Bremen": None,
"Hessen": "gebaeude-he.shp",
"Hamburg": None,
"Mecklenburg-Vorpommern": None,
"Niedersachsen": None,
"Nordrhein-Westfalen": "hu_shp.shp",
"Rheinland-Pfalz": None,
"Schleswig-Holstein": None,
"Saarland": None,
"Sachsen": "hu_sn_gebaeude_20231123.shp",
"Sachsen-Anhalt": None,
"Thüringen": "gebaeude-th.shp",
BUILDINGS_FILENAMES = {
"BW": None,
"BY": None,
"BE": "SHP_BE_ALKIS_Merged/Gebaeude_Bauteile_Flaechen.shp",
"BB": None,
"HB": None,
"HH": None,
"HE": "gebaeude-he.shp",
"MV": None,
"NI": None,
"NW": "hu_shp.shp",
"RP": None,
"SL": None,
"SN": "hu_sn_gebaeude_20231123.shp",
"ST": None,
"SH": None,
"TH": "gebaeude-th.shp",
}

BB_districts = {
Expand Down
57 changes: 57 additions & 0 deletions fs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
#
############################################################################
#
# MODULE: fs
# AUTHOR(S): Anika Weinmann, Julia Haas

# PURPOSE: German Federal State information as dictionary
# COPYRIGHT: (C) 2024 by mundialis GmbH & Co. KG and the GRASS
# Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#############################################################################

FS_ABBREVIATION = {
"Baden-Württemberg": "BW",
"BW": "BW",
"Bayern": "BY",
"BY": "BY",
"Berlin": "BE",
"BE": "BE",
"Brandenburg": "BB",
"BB": "BB",
"Bremen": "HB",
"HB": "HB",
"Hamburg": "HH",
"HH": "HH",
"Hessen": "HE",
"HE": "HE",
"Mecklenburg-Vorpommern": "MV",
"MV": "MV",
"Niedersachsen": "NI",
"NI": "NI",
"Nordrhein-Westfalen": "NW",
"NW": "NW",
"Rheinland-Pfalz": "RP",
"RP": "RP",
"Saarland": "SL",
"SL": "SL",
"Sachsen": "SN",
"SN": "SN",
"Sachsen-Anhalt": "ST",
"ST": "ST",
"Schleswig-Holstein": "SH",
"SH": "SH",
"Thüringen": "TH",
"TH": "TH",
}
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
py7zr
grass_gis_helpers
25 changes: 24 additions & 1 deletion v.alkis.buildings.import.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<h2>DESCRIPTION</h2>

<em>v.alkis.buildings.import</em> downloads ALKIS building data and imports them into GRASS.
Alternatively, local data can be imported.
To download the data, the federal_state(s) of the area of interest has to be given.
Either given in a text file, comma-separated for multiple federal_states (<b>file</b> option).
Or given directly as input, comma-separated for multiple federal_states (<b>federal_state</b> option).
Expand All @@ -13,16 +14,29 @@ <h2>DESCRIPTION</h2>
<p>
Implemented federal state options are:
<ul>
<li>Baden-Würrtemberg: only local data</li>
<li>Berlin</li>
<li>Brandenburg</li>
<li>Hessen</li>
<li>Nordrhein-Westfalen</li>
<li>Sachsen</li>
</ul>

For local data import the parameter <b>local_data_dir</b> has to be given and
the folder structure has to be as follows:
<div class="code"><pre>
/path/to/ALKIS_buildings/
├── BW/*.gpkg
└── NW/*.shp
└── ...
</pre></div>
If local data does not overlap with AOI, data will be downloaded from Open Data
portals if federal state supports Open Data.

<h2>REQUIREMENTS</h2>

<div class="code"><pre>py7zr</pre></div> needs to be installed.
<div class="code"><pre>py7zr</pre></div>,
<div class="code"><pre>grass-gis-helpers</pre></div> need to be installed.

<h2>EXAMPLE</h2>

Expand Down Expand Up @@ -57,6 +71,13 @@ <h3>Load ALKIS building data for current set region</h3>
v.alkis.buildings.import output=alkis_buildings federal_state=Nordrhein-Westfalen -r
</pre></div>

<h3>Load ALKIS building data from local file</h3>

<div class="code"><pre>
v.alkis.buildings.import aoi_map=AOI_BW output=buildings_bw federal_state=Baden-Württemberg local_data_dir=/path/to/ALKIS_buildings/
</pre></div>


<h2>SEE ALSO</h2>

<em>
Expand All @@ -66,3 +87,5 @@ <h2>SEE ALSO</h2>
<h2>AUTHORS</h2>

Lina Krisztian, <a href="https://www.mundialis.de/">mundialis</a>
Anika Weinmann, <a href="https://www.mundialis.de/">mundialis</a>
Julia Haas, <a href="https://www.mundialis.de/">mundialis</a>
Loading

0 comments on commit 408aef8

Please sign in to comment.