Skip to content

Commit

Permalink
Docker with WXGUI + m.import.rvr changes (#64)
Browse files Browse the repository at this point in the history
* add guisection to m.import.rvr

* Docker with GUI

* m.import.rvr: change FNK full name

* m.import.rvr (html): change FNK full name

* change column option

* Update grass-gis-addons/m.import.rvr/m.import.rvr.py

Co-authored-by: linakrisztian <106728040+linakrisztian@users.noreply.github.com>

* Update Dockerfile

Co-authored-by: linakrisztian <106728040+linakrisztian@users.noreply.github.com>

---------

Co-authored-by: anikaweinmann <aweinmann@mundialis.de>
Co-authored-by: linakrisztian <106728040+linakrisztian@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 3, 2024
1 parent 1ee6e47 commit c587315
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 73 deletions.
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM osgeo/grass-gis:releasebranch_8_3-alpine
FROM osgeo/grass-gis:main-ubuntu_wxgui

# is this needed or already set in the base image?
# --->
# --->
SHELL ["/bin/bash", "-c"]
# set SHELL var to avoid /bin/sh fallback in interactive GRASS GIS sessions
ENV SHELL /bin/bash
Expand All @@ -12,12 +12,12 @@ ENV GRASS_SKIP_MAPSET_OWNER_CHECK 1
ENV PROJ_NETWORK=ON
# <---

# set GRASS_ADDON_BASE
ENV GRASS_ADDON_BASE=/usr/local/grass84

# install external dependencies
RUN apk add --no-cache gcc make py3-psutil bash musl-dev python3-dev proj-dev
RUN apk add --no-cache py3-scikit-learn
RUN pip3 install py7zr tqdm requests
# workaround for broken pyproj release, remove when pyproj 3.6.1 is out
RUN pip3 install pyproj@git+https://github.com/pyproj4/pyproj.git@main
# RUN apt install musl-dev ??
RUN pip3 install py7zr tqdm requests psutil scikit-learn pyproj

# install official addons
RUN grass --tmp-location EPSG:4326 --exec g.extension r.mapcalc.tiled -s
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ Instead of "latest", a version number can be used. This should create a local
docker image with all needed addons and dependencies. Once the docker image
has been created locally, it can be started with e.g.
```bash
docker run -it \
xhost local:*
docker run -it --privileged --rm \
-v /path/to/grassdata:/grassdb \
-v /path/to/rvr_daten:/mnt/data \
rvr_interface:latest sh
-v "/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--env DISPLAY=$DISPLAY \
--device="/dev/dri/card0:/dev/dri/card0" \
rvr_interface:latest bash
```
4 changes: 2 additions & 2 deletions grass-gis-addons/m.import.rvr/m.import.rvr.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h2>DESCRIPTION</h2>
<ul>
<li><b>gebaeudedetektion</b>
<ul>
<li>Flächennutzungskatalog (FNK): imported from given vector file <b>fnk_file</b></li>
<li>Flächennutzungskartierung (FNK): imported from given vector file <b>fnk_file</b></li>
<li>Reference buildings: imported from given vector file <b>reference_buildings_file</b> or from openNRW if <b>-b</b> is set</li>
<li>Digital orthophotos (DOP): GTIFF files from given directory <b>dop_dir</b> imported and resampled to 0.5 m</li>
<li>Digital surface model (DSM): LAZ files from given directory <b>dsm_dir</b> imported and resampled to 0.5 m</li>
Expand All @@ -22,7 +22,7 @@ <h2>DESCRIPTION</h2>
</li>
<li><b>dachbegruenung</b>
<ul>
<li>Flächennutzungskatalog (FNK): imported from given vector file <b>fnk_file</b></li>
<li>Flächennutzungskartierung (FNK): imported from given vector file <b>fnk_file</b></li>
<li>Reference Trees: imported from given vector file <b>tree_file</b></li>
<li>Reference buildings: imported from given vector file <b>houserings_file</b> or from openNRW if <b>-b</b> is set</li>
<li>Digital orthophotos (DOP): GTIFF files from given directory <b>dop_dir</b> imported and resampled to 0.5 m</li>
Expand Down
147 changes: 85 additions & 62 deletions grass-gis-addons/m.import.rvr/m.import.rvr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# PURPOSE: Imports data for the processing of gebaeudedetektion,
# dachbegruenung and/or einzelbaumerkennung
#
# COPYRIGHT: (C) 2023 by mundialis and the GRASS Development Team
# COPYRIGHT: (C) 2023 - 2024 by mundialis and the GRASS Development Team
#
# This program is free software under the GNU General Public
# License (>=v2). Read the file COPYING that comes with GRASS
Expand All @@ -22,39 +22,100 @@
# % keyword: raster
# % keyword: vector
# % keyword: import
# % keyword: trees analysis
# % keyword: buildings analysis
# % keyword: greenroofs
# %end

# %option G_OPT_MEMORYMB
# %option
# % key: type
# % type: string
# % required: yes
# % multiple: yes
# % label: Type of processing for which the data should be imported
# % options: gebaeudedetektion,dachbegruenung,einzelbaumerkennung
# % answer: gebaeudedetektion,dachbegruenung,einzelbaumerkennung
# % guisection: General input
# %end

# %option G_OPT_F_INPUT
# % key: area
# % required: yes
# % multiple: no
# % label: Vector file (e.g. GPKG or Shapefile format) of the study area
# % guisection: General input
# %end

# %option G_OPT_F_INPUT
# % key: fnk_file
# % key: reference_buildings_file
# % required: no
# % multiple: no
# % label: Vector file (e.g. GPKG or Shapefile format) of the Flächennutzungskatalog (FNK)
# % description: Required for the processing type gebaeudedetektion and optional for dachbegruenung
# % label: Vector file (e.g. GPKG or Shapefile format) of the building reference data
# % description: Needed for the change detection after the gebaeudedetektion
# % guisection: General input
# %end

# %option G_OPT_DB_COLUMN
# % key: fnk_column
# %option G_OPT_M_DIR
# % key: dsm_dir
# % required: yes
# % multiple: no
# % label: Directory where the digital surface model (DSM) is stored as laz files
# % description: The DSM is required for the processing of gebaeudedetektion, dachbegruenung and einzelbaumerkennung
# % guisection: General input
# %end

# %option G_OPT_F_INPUT
# % key: dsm_tindex
# % required: no
# % label: Name of class code attribute column of the FNK map
# % description: Required for the processing type gebaeudedetektion and optional for dachbegruenung
# % multiple: no
# % label: Name of the DSM tindex which should be used or created
# % description: If this is set the tindex needs a column <location> with the absolute path to the DSM files
# % guisection: General input
# %end

# %option
# % key: dtm_file
# % required: no
# % multiple: no
# % label: Raster file or directory where XYZ files of the digital terrain model (DTM)
# % description: The DTM is required for the processing of gebaeudedetektion, dachbegruenung and einzelbaumerkennung
# % guisection: General input
# %end

# %option G_OPT_F_INPUT
# % key: reference_buildings_file
# % key: dtm_tindex
# % required: no
# % multiple: no
# % label: Vector file (e.g. GPKG or Shapefile format) of the building reference data
# % description: Needed for the change detection after the gebaeudedetektion
# % label: Name of the DTM tindex which should be used or created
# % description: If this is set the tindex needs a column <location> with the absolute path to the DTM files
# % guisection: General input
# %end

# %option
# % key: dtm_resolution
# % type: double
# % required: no
# % multiple: yes
# % label: Resolution of the source DTM XYZ file
# % guisection: General input
# %end

# %option G_OPT_F_INPUT
# % key: fnk_file
# % required: no
# % multiple: no
# % label: Vector file (e.g. GPKG or Shapefile format) of the Flächennutzungskartierung (FNK)
# % description: Required for the processing type gebaeudedetektion and optional for dachbegruenung
# % guisection: Input buildings analysis
# %end

# %option
# % key: fnk_column
# % type: string
# % required: no
# % label: Name of class code attribute column of the FNK map
# % description: Required for the processing type gebaeudedetektion and optional for dachbegruenung
# % guisection: Input buildings analysis
# %end

# %option G_OPT_F_INPUT
Expand All @@ -63,6 +124,7 @@
# % multiple: no
# % label: Vector file (e.g. GPKG or Shapefile format) of the building outlines data
# % description: Required inside the processing of dachbegruenung
# % guisection: Input buildings analysis
# %end

# %option G_OPT_F_INPUT
Expand All @@ -71,6 +133,7 @@
# % multiple: no
# % label: Vector file (e.g. GPKG or Shapefile format) of the tree data
# % description: The tree data can be used inside the processing of dachbegruenung
# % guisection: Input buildings analysis
# %end

# %option G_OPT_M_DIR
Expand All @@ -79,6 +142,7 @@
# % multiple: no
# % label: Directory where the digital orthophots (DOPs) are stored as GeoTiffs
# % description: The DOPs are required for the processing of gebaeudedetektion and dachbegruenung
# % guisection: Input buildings analysis
# %end

# %option G_OPT_F_INPUT
Expand All @@ -87,6 +151,7 @@
# % multiple: no
# % label: Name of the DOP tindex which should be used or created
# % description: If this is set the tindex needs a column <location> with the absolute path to the DOP files
# % guisection: Input buildings analysis
# %end

# %option G_OPT_M_DIR
Expand All @@ -95,6 +160,7 @@
# % multiple: no
# % label: Directory where the true digital orthophots (TOPs) are stored as GeoTiffs
# % description: The TOPs are required for the processing of einzelbaumerkennung
# % guisection: Input trees analysis
# %end

# %option G_OPT_F_INPUT
Expand All @@ -103,74 +169,31 @@
# % multiple: no
# % label: Name of the TOP tindex which should be used or created
# % description: If this is set the tindex needs a column location with the absolute path to the TOP files
# % guisection: Input trees analysis
# %end

# %option G_OPT_M_DIR
# % key: dsm_dir
# % required: yes
# % multiple: no
# % label: Directory where the digital surface model (DSM) is stored as laz files
# % description: The DSM is required for the processing of gebaeudedetektion, dachbegruenung and einzelbaumerkennung
# %end

# %option G_OPT_F_INPUT
# % key: dsm_tindex
# % required: no
# % multiple: no
# % label: Name of the DSM tindex which should be used or created
# % description: If this is set the tindex needs a column <location> with the absolute path to the DSM files
# %end

# %option
# % key: dtm_file
# % required: no
# % multiple: no
# % label: Raster file or directory where XYZ files of the digital terrain model (DTM)
# % description: The DTM is required for the processing of gebaeudedetektion, dachbegruenung and einzelbaumerkennung
# %end

# %option G_OPT_F_INPUT
# % key: dtm_tindex
# % required: no
# % multiple: no
# % label: Name of the DTM tindex which should be used or created
# % description: If this is set the tindex needs a column <location> with the absolute path to the DTM files
# %end

# %option
# % key: dtm_resolution
# % type: double
# % required: no
# % multiple: yes
# % label: Resolution of the source DTM XYZ file
# %end

# %option
# % key: type
# % type: string
# % required: yes
# % multiple: yes
# % label: Type of processing for which the data should be imported
# % options: gebaeudedetektion,dachbegruenung,einzelbaumerkennung
# % answer: gebaeudedetektion,dachbegruenung,einzelbaumerkennung
# %option G_OPT_MEMORYMB
# % guisection: Parallel processing
# %end

# %option G_OPT_M_NPROCS
# % description: Number of cores for multiprocessing, -2 is the number of available cores - 1
# % label: Number of cores for multiprocessing, -2 is the number of available cores - 1
# % answer: -2
# % guisection: Parallel processing
# %end

# %flag
# % key: c
# % label: Only check input parameters
# % guisection: General input
# %end

# %flag
# % key: b
# % label: Download buildings for reference buildings or building outlines from openNRW if files are not set
# % guisection: General input
# %end


import atexit
import os
import psutil
Expand Down

0 comments on commit c587315

Please sign in to comment.