Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions GeoFilter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2026 Dataport AöR

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
13 changes: 6 additions & 7 deletions GeoFilter/doc/config.json.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#### Portalconfig.menu.tool.geoFilter

The geofilter allows to filter a WFS Layer (target layer) with another layer, WFS or imported, that contains polygon features (filter layer). As a result all features that lie within or intersect the polygons on the filter layer will be returned on a new layer. The name of the new layer can be configured under `highlightedFeatures.layerName` (**[highlightedFeatures](#portalconfigtreehighlightedfeatures)**).
To use Imported layers the importerAddon for the v3 has to be configured as well (to be found here: https://github.com/terrestris/masterportal-addons/tree/main).


This addon uses the importer and exporter addon which must be configured as well to use the geoFilter addon. They can be found here https://github.com/terrestris/masterportal-addons/tree/main. The importer addon configuration should include geojson, shapezip and/or geopackage as supported import formats. WMS and WFS will be not useful in this context.

|Name|Required|Type|Default|Description|Expert|
|----|--------|----|-------|-----------|------|
|name|no|string|additional:modules.tools.geoFilter.title|Will be displayed as name for the addon|false|
|description|no|string|additional:modules.tools.geoFilter.description|Will be displayed as description for the addon|false|
|targetLayerIds|no|Array|[]|List of layer ids of layers that can be used as target layers.|false|
|filterLayerTypes|no|Array|["GeoJSON", "WFS"]|List of layer types that can be used as filter layers.|false|
|icon|no|string|bi-filter|CSS class of the Bootstrap Icon. Will be displayed in front of the tool name.|false|
|name|no|string|additional:modules.tools.geoFilter.title|Will be displayed as name for the addon|false|
|targetLayerIds|no|Array|[]|List of layer ids of layers that can be used as target layers.|false|
|type|yes|string||ID of the addon|false|



**Example:**

```json
{
Expand Down
21 changes: 21 additions & 0 deletions WfstUploader/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2026 Dataport AöR

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
10 changes: 6 additions & 4 deletions WfstUploader/components/WfstUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ export default {
properties = await wfs.receivePossibleProperties(url, version, featureType, isSecured ?? false);

if (Array.isArray(properties)) {
properties.forEach((propertie) => {
if (propertie.key === "uuid") {
propertie.value = this.uuid || propertie.value;
const uuidProp = this.getUrlParamValue("UUIDPROPERTY") || "uuid";

properties.forEach((property) => {
if (property.key === uuidProp) {
property.value = this.uuid || property.value;
}
});
}
Expand Down Expand Up @@ -197,7 +199,7 @@ export default {
const params = new URL(location).searchParams,
keyName = Array.from(params.keys()).find((key) => key.toLowerCase() === paramName.toLowerCase());

return params.get(keyName);
return keyName ? params.get(keyName) : null;
},
getUuid () {
return this.getUrlParamValue("UUID");
Expand Down
28 changes: 24 additions & 4 deletions WfstUploader/doc/config.json.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
#### Portalconfig.menu.tool.wfstUploader

Addon that enables user to upload features on configured wfst layer by selecting features from vector layers. Intended use case is to upload features from imported geopackages or shapefile, so the importer addon is integrated in this addon and must be configured as well.
The importer addon can be found here https://github.com/terrestris/masterportal-addons/tree/main. The importer addon configuration should include geojson, shapezip and/or geopackage as supported import formats. WMS and WFS will be not useful in this context.

|Name|Required|Type|Default|Description|Expert|
|----|--------|----|-------|-----------|------|
|||||||

|description|no|string|additional:modules.tools.wfstUploader.description|Will be displayed as description for the addon|false|
|icon|no|string|bi-upload|CSS class of the Bootstrap Icon. Will be displayed in front of the tool name.|false|
|name|no|string|additional:modules.tools.wfstUploader.title|Will be displayed as name for the addon|false|
|type|yes|string||ID of the addon|false|
|wfstLayers|yes||List of wfst layers that can be chosen for a feature upload|false|

**Example:**

```json
{

"type": "wfstUploader",
"name": "Neues Objekt hochladen",
"description": "Speichern von hochgeladenen Geometrien als Objekte",
"wfstLayers": ["ensemble_elemente", "fundplatz_elemente", "polygon_wfst"],
"wfstAttributesForInput": ["kategorie", "uuid"]
}

```
```

**URL Parameters**

Some parameters can be preset for this addon via the URL.

|Name|Description|Example|
|-|-|-|
|UPLOADLAYERID|The id of the layer that should be preset as upload layer in the input formular. The upload layer must be visible in the portal. |`&UPLOADLAYERID=layer_id`|
|UUIDPROPERTY|The identifier attribute name for the feature that will be uploaded. If not set, "uuid" will be assumed as property name.|`&UUIDPROPERTY=UUID`|
|UUID|The value that will be set as preset for the uuid property in the input field.|`&UUIDVALUE=123-abc-456`|
16 changes: 15 additions & 1 deletion exporter/doc/config.json.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,19 @@ The basic tool configurations apply. Following additional properties can be set

|Name|Required|Type|Default|Description|Expert|
|----|--------|----|-------|-----------|------|
|supportedExportFormats|no|String[]|["geojson", "gml", "shp", "gpkg"]|List of supported export formats. Only formats that appear in this list will be provided as option. Currently supported formats: "geojson", "gml", "shp", "gpkg".|false|
|downloadProjection|no|String|"EPSG:4326"|Optional projection mode used only for "shp" and "gpkg" download output. Supported values: "mapProjection" and "EPSG:4326". If omitted or invalid, EPSG:4326 is used.|false|
|icon|no|string|bi-download|CSS class of the Bootstrap Icon. Will be displayed in front of the tool name.|false|
|name|no|string|additional:modules.tools.exporter.title|Will be displayed as name for the addon|false|
|supportedExportFormats|no|String[]|["geojson", "gml", "shp", "gpkg"]|List of supported export formats. Only formats that appear in this list will be provided as option. Currently supported formats: "geojson", "gml", "shp", "gpkg".|false|
|type|yes|string||ID of the addon|false|

**Example:**

```json
{
"type": "exporter",
"downloadProjection": "mapProjection",
"name":"additional:modules.tools.exporter.title",
"icon":"bi-download"
}
```
221 changes: 221 additions & 0 deletions exporter/tests/unit/components/ExporterAddon.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
import {createStore} from "vuex";
import {expect} from "chai";
import sinon from "sinon";
import {shallowMount} from "@vue/test-utils";
import ExporterAddon from "../../../components/ExporterAddon.vue";
import ExporterStore from "../../../store/ExporterAddon.js";
import {DEFAULT_VALUES} from "../../../store/stateExporterAddon.js";
import STEPS from "../../../constants/steps.js";
import * as downloadModule from "../../../utils/download.js";

describe("addons/exporter/components/ExporterAddon.vue", () => {
let store, wrapper;

/**
* Helper function to create a wrapper with optional store overrides.
*
* @param {Object} storeOverrides Additional state values to override defaults.
* @returns {VueWrapper} Mounted component wrapper.
*/
function createWrapper (storeOverrides = {}) {
store = createStore({
modules: {
Modules: {
namespaced: true,
modules: {
Exporter: {
...ExporterStore,
state: {
...ExporterStore.state,
...DEFAULT_VALUES,
active: true,
...storeOverrides
}
}
}
},
Alerting: {
namespaced: true,
actions: {
addSingleAlert: sinon.stub()
}
}
}
});

return shallowMount(ExporterAddon, {
global: {
plugins: [store],
mocks: {
$t: key => key
}
}
});
}

afterEach(() => {
if (wrapper) {
wrapper.unmount();
}
sinon.restore();
});

describe("rendering", () => {
it("renders the exporter root element", () => {
wrapper = createWrapper();
expect(wrapper.find("#exporter").exists()).to.be.true;
});

it("shows loading text and hides content when isLoading is true", async () => {
wrapper = createWrapper();
await wrapper.setData({isLoading: true});
expect(wrapper.text()).to.include("additional:modules.tools.exporter.loadingText");
expect(wrapper.find(".exporter-addon-wizard-content").exists()).to.be.false;
});

it("shows LayerSelection on selectLayer step", () => {
wrapper = createWrapper({currentStep: STEPS.selectLayer});
expect(wrapper.findComponent({name: "LayerSelection"}).exists()).to.be.true;
});

it("shows LayerDownloadOptions on downloadLayer step", () => {
wrapper = createWrapper({currentStep: STEPS.downloadLayer});
expect(wrapper.findComponent({name: "LayerDownloadOptions"}).exists()).to.be.true;
});

it("shows next button when not on last step", () => {
wrapper = createWrapper({currentStep: STEPS.selectLayer});
const buttons = wrapper.findAllComponents({name: "FlatButton"});
const texts = buttons.map(b => b.props("text"));

expect(texts).to.include("additional:modules.tools.exporter.next");
});

it("shows finish button on last step", () => {
wrapper = createWrapper({currentStep: STEPS.downloadLayer});
const buttons = wrapper.findAllComponents({name: "FlatButton"});
const texts = buttons.map(b => b.props("text"));

expect(texts).to.include("additional:modules.tools.exporter.finish");
});

it("hides prev button on first step", () => {
wrapper = createWrapper({currentStep: STEPS.selectLayer});
const buttons = wrapper.findAllComponents({name: "FlatButton"});
const texts = buttons.map(b => b.props("text"));

expect(texts).to.not.include("additional:modules.tools.exporter.prev");
});

it("shows prev button on second step", () => {
wrapper = createWrapper({currentStep: STEPS.downloadLayer});
const buttons = wrapper.findAllComponents({name: "FlatButton"});
const texts = buttons.map(b => b.props("text"));

expect(texts).to.include("additional:modules.tools.exporter.prev");
});
});

describe("onNextClick", () => {
it("advances to downloadLayer step", async () => {
wrapper = createWrapper({currentStep: STEPS.selectLayer, currentFormValid: true});
await wrapper.vm.onNextClick();
expect(wrapper.vm.currentStep).to.equal(STEPS.downloadLayer);
});
});

describe("onPrevClick", () => {
it("goes back to selectLayer step", async () => {
wrapper = createWrapper({currentStep: STEPS.downloadLayer});
await wrapper.vm.onPrevClick();
expect(wrapper.vm.currentStep).to.equal(STEPS.selectLayer);
});
});

describe("onFinishClick", () => {
it("executes download, manages loading state, and calls callback", async () => {
let resolveDownload;

sinon.stub(downloadModule, "downloadLayer").returns(
new Promise(resolve => {
resolveDownload = resolve;
})
);
const onExportFinished = sinon.stub();

wrapper = createWrapper({
currentStep: STEPS.downloadLayer,
selectedLayer: {id: "layer1"},
selectedExportFormat: "geoJson",
downloadProjection: "EPSG:4326",
onExportFinished
});

const finishPromise = wrapper.vm.onFinishClick();

// Verify loading state starts
expect(wrapper.vm.isLoading).to.be.true;

resolveDownload();
await finishPromise;

// Verify loading state ends and callbacks executed
expect(wrapper.vm.isLoading).to.be.false;
expect(onExportFinished.calledOnce).to.be.true;
expect(wrapper.vm.active).to.be.false;
});

it("dispatches alert on download error", async () => {
const error = new Error("download failed");

sinon.stub(downloadModule, "downloadLayer").rejects(error);
global.i18next = {t: key => key};

const addSingleAlertStub = sinon.stub();

store = createStore({
modules: {
Modules: {
namespaced: true,
modules: {
Exporter: {
...ExporterStore,
state: {
...ExporterStore.state,
...DEFAULT_VALUES,
active: true,
currentStep: STEPS.downloadLayer
}
}
}
},
Alerting: {
namespaced: true,
actions: {
addSingleAlert: addSingleAlertStub
}
}
}
});

wrapper = shallowMount(ExporterAddon, {
global: {
plugins: [store],
mocks: {$t: key => key}
}
});

await wrapper.vm.onFinishClick();

expect(addSingleAlertStub.calledOnce).to.be.true;
});
});

describe("close", () => {
it("sets active to false when close is called", () => {
wrapper = createWrapper();
wrapper.vm.close();
expect(wrapper.vm.active).to.be.false;
});
});
});
8 changes: 8 additions & 0 deletions exporter/tests/unit/store/actionsExporterAddon.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {expect} from "chai";
import actions from "../../../store/actionsExporterAddon.js";

describe("addons/exporter/store/actionsExporterAddon.js", () => {
it("exports actions object", () => {
expect(actions).to.be.an("object");
});
});
8 changes: 8 additions & 0 deletions exporter/tests/unit/store/gettersExporterAddon.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {expect} from "chai";
import getters from "../../../store/gettersExporterAddon.js";

describe("addons/exporter/store/gettersExporterAddon.js", () => {
it("exports getters object", () => {
expect(getters).to.be.an("object");
});
});
Loading