Skip to content

Commit af4912e

Browse files
danpejoboDaniel
andauthored
V3.0.0 (#9)
* Configure and dd dev-environment * try to get testing to work * testfile * add workflow_dispatch to action * add pycodestyle to makefile * remove qgis 3_22 * trying tests again * test * update action * try another pth * update path in github action * edit path * edit variable * add debug step * add directory * edit paths * edit paths * update import statement and tests * update tests * add _init__ to submodule in github action * edit path * update test paths * edit paths * add submodule * tests update * update test * edit test * tests * test import error * update tests * edit test * update test * test case * short only * test case * run test on main/dev on push/pull-req * add test calls * error in yml file * edit tests * update testcase * edit test case * try cp testfiles * edit steps * edit test and settings * edit test * update test * restructure repo * restructure repo * update readme * update readme * edit readme * update readme * edit makefile to reflect new repo structure * update paths in github actions * edit action and test * change name on utils to utilities * edit github action * edit check plugin load * edit tests, add badge to readme * edit tests * update test * try to fix import. relative to absolute * edit docstring * update docstring * update docstring * update test * edit test * update test * update test * update test * update test * update test * update testing * update test * test update * update test, add feedback if exception * change to absolute import * edit test * edit test * update text for output feature name variable * update test * update test and add test badge to readme * add issue templates * update test * change testcase CRS * exclude long-term from test * update test * remove redundant logger * edit util reproject raster "TARGET_CRS" * edit test * edit test * add context to temp folder * add prefix to logging and feedback in @reproject_layers * try to use postprocessing * edit test * remove intermediate option * remove intermediate laayers #2 * edit algorithm to postprocess * add QgsProcessingException * edit param input for reproject * edit reproject * edit begrensskade * update test * edit post-process * try to edit the addlayerstask * edit test and log values to reproject * edit reproject * is child added * try with reproject raster change input and source_crs * try postprocess with addlayerstask class * add tests and test data * format code * edit add layers class * add docstring to postprocess * edit tests for excavation module * update testcase * remove tricky "lower()" call to raster path. * edit wrong testnumber * add tests to impact map * edit tests * update test. error in calling alg. * update parameters - test for tunnel * update readme * update readme * update testcase * edit copyright dates * edit sub-processes parameters * v.3.0.0 --------- Co-authored-by: Daniel <[email protected]>
1 parent 7a6414c commit af4912e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4606
-2486
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is. If you hit some error please paste the entire Python stacktrace message.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
21+
**Screenshots**
22+
If applicable, add screenshots to help explain your problem.
23+
24+
**Desktop (please complete the following information):**
25+
- OS: [e.g. iOS]
26+
- QGIS release [e.g. QGIS 3.28]
27+
- geovita_processing_provider release [e.g. 2.0.2]
28+
29+
**Additional context**
30+
Add any other context about the problem here.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the solution you'd like**
11+
A clear and concise description of what you want to happen.
12+
13+
**Describe alternatives you've considered**
14+
A clear and concise description of any alternative solutions or features you've considered.
15+
16+
**Additional context**
17+
Add any other context or screenshots and URL about the feature request here.

.github/workflows/test_plugin.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Test plugin
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
paths:
9+
- "geovita_processing_plugin/**"
10+
- ".github/workflows/test_plugin.yml"
11+
pull_request:
12+
branches:
13+
- main
14+
- dev
15+
paths:
16+
- "geovita_processing_plugin/**"
17+
- ".github/workflows/test_plugin.yml"
18+
workflow_dispatch:
19+
20+
env:
21+
# plugin name/directory where the code for the plugin is stored
22+
PLUGIN_NAME: geovita_processing_plugin
23+
# python notation to test running inside plugin
24+
TESTS_RUN_FUNCTION: geovita_processing_plugin.test_suite.test_package
25+
# Docker settings
26+
DOCKER_IMAGE: qgis/qgis
27+
28+
jobs:
29+
30+
Test-geovita_processing_plugin:
31+
32+
runs-on: ubuntu-latest
33+
34+
strategy:
35+
matrix:
36+
docker_tags: [release-3_28, latest]
37+
38+
steps:
39+
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
submodules: 'recursive'
44+
45+
- name: Docker pull and create qgis-testing-environment
46+
run: |
47+
docker pull "$DOCKER_IMAGE":${{ matrix.docker_tags }}
48+
docker run -d -e XDG_RUNTIME_DIR=/tmp/runtime-root --name qgis-testing-environment -v ${{ github.workspace }}:/tests_directory -e DISPLAY=:99 "$DOCKER_IMAGE":${{ matrix.docker_tags }}
49+
50+
- name: List mounted directory contents
51+
run: |
52+
docker exec qgis-testing-environment ls -la /tests_directory
53+
docker exec qgis-testing-environment ls -la /tests_directory/$PLUGIN_NAME
54+
55+
- name: Docker set up QGIS
56+
run: |
57+
docker exec qgis-testing-environment sh -c "qgis_setup.sh $PLUGIN_NAME"
58+
docker exec qgis-testing-environment sh -c "cat /root/.local/share/QGIS/QGIS3/profiles/default/QGIS/QGIS3.ini"
59+
docker exec qgis-testing-environment sh -c "rm -f /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
60+
docker exec qgis-testing-environment sh -c "ln -s /tests_directory/$PLUGIN_NAME /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
61+
docker exec qgis-testing-environment sh -c "pip3 install -r /tests_directory/REQUIREMENTS_TESTING.txt"
62+
63+
docker exec qgis-testing-environment sh -c "ls -l /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/"
64+
docker exec qgis-testing-environment sh -c "ls -l /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
65+
66+
- name: Prepare REMEDY_GIS_RiskTool submodule
67+
run: |
68+
docker exec qgis-testing-environment sh -c "touch /tests_directory/$PLUGIN_NAME/REMEDY_GIS_RiskTool/__init__.py"
69+
docker exec qgis-testing-environment ls -la /tests_directory/$PLUGIN_NAME/REMEDY_GIS_RiskTool
70+
71+
- name: Docker run plugin tests
72+
run: |
73+
docker exec qgis-testing-environment sh -c "export PYTHONPATH=/root/.local/share/QGIS/QGIS3/profiles/default/python/plugins:$PYTHONPATH && qgis_testrunner.sh $TESTS_RUN_FUNCTION"
74+
75+
Check-code-quality:
76+
runs-on: ubuntu-latest
77+
steps:
78+
79+
- name: Install Python
80+
uses: actions/setup-python@v5
81+
with:
82+
python-version: '3.9'
83+
architecture: 'x64'
84+
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
88+
- name: Install packages
89+
run: |
90+
pip install -r REQUIREMENTS_TESTING.txt
91+
pip install pylint pycodestyle
92+
93+
- name: Pylint
94+
run: make pylint
95+
96+
- name: Pycodestyle
97+
run: make pycodestyle

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,7 @@ cython_debug/
155155
zip_build/
156156

157157
#VSCode stuff
158-
.vscode/
158+
.vscode/
159+
160+
#Ruff
161+
.ruff*

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "REMEDY_GIS_RiskTool"]
22
path = REMEDY_GIS_RiskTool
33
url = https://github.com/norwegian-geotechnical-institute/REMEDY_GIS_RiskTool.git
4+
[submodule "geovita_processing_plugin/REMEDY_GIS_RiskTool"]
5+
path = geovita_processing_plugin/REMEDY_GIS_RiskTool
6+
url = https://github.com/norwegian-geotechnical-institute/REMEDY_GIS_RiskTool.git

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ PEP8EXCLUDE=pydev,resources.py,conf.py,third_party,ui
6565
# * Windows:
6666
# AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins'
6767

68-
QGISDIR=C:\Users\dpe\AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins
68+
QGISDIR=.local/share/QGIS/QGIS3/profiles/default/python/plugins/
6969

7070
#################################################
7171
# Normally you would not need to edit below here
@@ -222,7 +222,7 @@ pylint:
222222
@echo "-----------------"
223223
@echo "Pylint violations"
224224
@echo "-----------------"
225-
@pylint --reports=n --rcfile=pylintrc . || true
225+
@pylint --reports=n --rcfile=pylintrc geovita_processing_plugin || true
226226
@echo
227227
@echo "----------------------"
228228
@echo "If you get a 'no module named qgis.core' error, try sourcing"
@@ -231,14 +231,14 @@ pylint:
231231
@echo "----------------------"
232232

233233

234-
# Run pep8 style checking
234+
# Run pep8/pycodestyle style checking
235235
#http://pypi.python.org/pypi/pep8
236-
pep8:
236+
pycodestyle:
237237
@echo
238238
@echo "-----------"
239-
@echo "PEP8 issues"
239+
@echo "pycodestyle PEP8 issues"
240240
@echo "-----------"
241-
@pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude $(PEP8EXCLUDE) . || true
241+
@pycodestyle --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude $(PEP8EXCLUDE) geovita_processing_plugin || true
242242
@echo "-----------"
243243
@echo "Ignored in PEP8 check:"
244244
@echo $(PEP8EXCLUDE)

README.md

Lines changed: 14 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,33 @@
1-
![Geovita Logo](icons/geovita.ico)
1+
![Geovita Logo](geovita_processing_plugin/icons/geovita.ico)
22

3-
# Geovita Processing Provider
3+
Geovita Processing Provider
4+
===========================
5+
[![Static Badge](https://img.shields.io/badge/plugins.QGIS.org-published-green)](https://plugins.qgis.org/plugins/geovita_processing_plugin/)
6+
[![Test plugin](https://github.com/danpejobo/geovita_processing_plugin/actions/workflows/test_plugin.yml/badge.svg)](https://github.com/danpejobo/geovita_processing_plugin/actions/workflows/test_plugin.yml)
7+
[![GitHub Release](https://img.shields.io/github/v/release/danpejobo/geovita_processing_plugin)](https://github.com/danpejobo/geovita_processing_plugin/releases)
48

5-
A QGIS plugin for different Geovita custom processing algorithms. This plugin is currently under development, so new features may be expected!
9+
The Geovita processing provider for QGIS!
610

7-
**New algorithms are added to this repo as they are developed, and new releases published!**
8-
9-
Status and Limitations
10-
=====
11-
12-
- Implemented [REMEDY GIS RiskTool](https://github.com/norwegian-geotechnical-institute/REMEDY_GIS_RiskTool) to run from QGIS processing
13-
- It is important to read the manual for this project. Especially if you want to perform `vulnerability analysis`. This will require you to edit the polygon layers containing the `building` features (see specifications section below).
14-
- Supported filetypes: `.shp`
15-
- If you have an "in memory" layer or other fileformats you will need to save it to a `.shp` file. This is a restriction imposed by the underlaying submodule.
16-
- Projection of layers:
17-
- All layers `need the same projection` before you can run the algorithms
18-
- The algorithm does not (yet) reproject layers. This means you have to do it manually first.
19-
20-
Tools
21-
=====
22-
- **REMEDY GIS RiskTool** - These algorithms create a log directory in this location `%user%/Downloads/REMEDY`. For the moment this is hardcoded.
23-
- `Begrens Skade - Excavation` The Begrens Skade - Excavation algorithm provides a comprehensive analysis of building settlements and risks associated with subsidence and inclination.
24-
- `Begrens Skade - ImpactMap` The BegrensSkade ImpactMap alorithm calculates both short-term and long-term settlements that occur due to the establishment of a construction pit (this alg. takes a bit of time to run, open the log and refresh it to see the logged progress).
25-
- `Begrens Skade - Tunnel` The BegrensSkade Tunnel alorithm provides a comprehensive analysis of building settlements and risks associated with subsidence and inclination due to tunnel excavation.
11+
**New algorithms are added to the provider as they are developed**
2612

2713
QGIS Plugin
2814
===========
2915

30-
This provider functions as a QGIS plugin (for QGIS >= 3.4) and is available via the standard QGIS plugins repository, so you can install it directly from within QGIS itself.
16+
This provider functions as a QGIS plugin (for QGIS >= 3.28) and is available via the standard QGIS plugins repository, so you can install it directly from within QGIS itself.
3117

3218
The plugin adds a new group to the Processing Toolbox for "Geovita", containing sub-groups with tools and algorithms to perform different tasks.
3319

3420
If you enconter bugs of any sort, PLEASE consider reporting them through [the bugtracker at GitHub](https://github.com/danpejobo/geovita_processing_plugin/issues). Everyone benefits!
3521

36-
Specifications
37-
==============
38-
39-
It is crucial to understand the limitations of the [REMEDY GIS RiskTool](https://github.com/norwegian-geotechnical-institute/REMEDY_GIS_RiskTool) calculation methods. I would highly suggest reading the paper and the manual within the REMEDY repository.
22+
Check it out [here!](/geovita_processing_plugin/)
4023

41-
If you want to enable `vulnerability analysis` you will need some information on the buildings near the excavation/tunnel. You will need to add text fields to each feature in the building polygon layer for `Foundation`, `Structure` and `Condition`. See below for the allowed values!
42-
- Class A is the best and D the worst.
43-
- If i cell contains `-` it only means that this field only have 2 possible values.
44-
- Copy/paste the values so they match!
45-
46-
| Class | Foundation | Structure | Condition |
47-
|-------|---------------------------------------------------------|----------------------------------|------------------------|
48-
| A | To bedrock | Steel | Excellent |
49-
| A | Peler | A - Stål | A - Meget god tilstand |
50-
| A | A - Til berg - Direktefundamentert, peler | - | - |
51-
| B | Raft | Reinforced concrete | Good |
52-
| B | Betong | B - Armert betong | B - God tilstand |
53-
| B | B - På løsmasser - Hel plate (betong, såle) | - | - |
54-
| C | Strip | Mixed | Medium |
55-
| C | Grunnmur | C - Tre eller varierende | C - Brukbar tilstand |
56-
| C | C - På løsmasser - Stripefundament (heller) | - | - |
57-
| D | Wooden piles | Masonry | Bad |
58-
| D | Trepeler | D - Murstein eller spesiell type | D - Dårlig |
59-
| D | D - På løsmasser - Punkt- og trefundamenter (banketter) | - | - |
24+
Overview
25+
========
26+
- Implemented [REMEDY GIS RiskTool](https://github.com/norwegian-geotechnical-institute/REMEDY_GIS_RiskTool) to run from QGIS processing
6027

61-
## Results
28+
## Example results from the REMEDY GIS RiskTool
6229
The following images show some example results. Both the excavation and the tunnel algorithm produces results for short and/or longterm settlements, but uses different calculation methods. The impact map calculates and illustrate total settlements in the impaced soil around the excavation.
6330

6431
| Loaded Layers | Short term | Long term | Impact map |
6532
|---------------|------------|-----------|------------|
6633
| ![Loaded layers](resources/example-short-term-layers.png) <br><br> The symbology of the loaded layers | ![Short term](resources/example-short-term.png) <br><br> Blue hatch is the excavation. Status of corners, walls and buildings | ![Long term](resources/example-long-short-term.png) <br><br> Blue hatch is the excavation. Dark background is the depth to bedrock raster used for long term settlements. | ![Impact map](resources/example-impact-map.png) <br><br> Red hatch is the excavation. The impact map for total settlements around the excavation. |
67-
68-

REMEDY_GIS_RiskTool

Submodule REMEDY_GIS_RiskTool deleted from df37af9

REQUIREMENTS_TESTING.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# For tests execution:
2+
deepdiff
3+
mock
4+
flake8
5+
pep257
6+
pylint

0 commit comments

Comments
 (0)