Skip to content

Commit

Permalink
Merge pull request #16 from mundialis/add_file_import
Browse files Browse the repository at this point in the history
Add file import and tests
* updates `administrative_boundaries()`
* restructures and refactors addon
* adds local file import if data available and overlapping with AOI
* fix tests for nw and multi fs
* added tests for sn and bw
  • Loading branch information
anikaweinmann authored Feb 1, 2024
2 parents 7f0e743 + 292335a commit 408bd06
Show file tree
Hide file tree
Showing 21 changed files with 978 additions and 511 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/grass-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Run tests for GRASS GIS addons
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]

jobs:
tests:
uses: mundialis/github-workflows/.github/workflows/grass-tests.yml@main
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MODULE_TOPDIR = ../..

PGM = v.alkis.buildings.import

ETCFILES = download_urls
ETCFILES = download_urls federal_state_info

include $(MODULE_TOPDIR)/include/Make/Python.make
include $(MODULE_TOPDIR)/include/Make/Script.make
Expand Down
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 federal_state_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
#
############################################################################
#
# MODULE: federal_state_info
# 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",
}
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
py7zr
grass-gis-helpers
requests
Binary file added testsuite/data/ALKIS/BW/ALKIS_testGebaeude.gpkg
Binary file not shown.
1 change: 1 addition & 0 deletions testsuite/data/fs_file_BW.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Baden-Württemberg
File renamed without changes.
1 change: 1 addition & 0 deletions testsuite/data/fs_file_SN.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sachsen
15 changes: 11 additions & 4 deletions testsuite/data/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

Test area: located in Bonn-Beuel settlement area (SIE01)

## area_cologne.geojson
## test_aoi_NW.geojson, test_aoi_BW.geojson, test_aoi_SN.geojson

Test area: located in a part of Cologne (created at geojson.io)
Test area for:
* NW - located in a part of Cologne (created at geojson.io)
* BW
* SN

## area_nw_rp.geojson

Expand All @@ -16,10 +19,14 @@ Test area: located partly in Nordrhein-Westfalen and partly in Rheinland-Pfalz (

Test area: located partly in Germany and partly in the Netherlands

## singleFs
## fs_file_NW.txt, fs_file_BW.txt, fs_file_SN.txt

Test text-file containing single federal state name

## multiFs
## multiFs.txt

Test text-file containing multiple federal state names

## ALKIS/BW/ALKIS_testGebaeude.gpkg

Polygons generated in BW to simulate local ALKIS buildings data
1 change: 1 addition & 0 deletions testsuite/data/test_aoi_BW.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[9.958585901835793,48.403691878384031],[9.95898887753941,48.40377413704698],[9.959341638592079,48.403687667530306],[9.959452166537243,48.403561452908349],[9.959413034425308,48.403148312465191],[9.958942051544028,48.402784712958955],[9.958630490741641,48.402893808371815],[9.958550736192205,48.403322557156393],[9.958585901835793,48.403691878384031]]]}}]}
File renamed without changes.
1 change: 1 addition & 0 deletions testsuite/data/test_aoi_SN.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[13.654632568359375,51.103521942404186],[13.63677978515625,51.034485632974125],[13.798828125,50.98350536409832],[13.863372802734373,51.055207338584943],[13.808441162109375,51.094898034822961],[13.654632568359375,51.103521942404186]]]}}]}
Loading

0 comments on commit 408bd06

Please sign in to comment.