From 12c791ce60c33eab5277bb4e47c688285235d480 Mon Sep 17 00:00:00 2001 From: MV88 Date: Wed, 18 Oct 2023 12:23:48 +0200 Subject: [PATCH 1/4] Fix #9620 better error handling of GeoProcessing --- web/client/epics/geoProcessing.js | 116 ++++++++++++++++++++---- web/client/observables/wfs.js | 4 +- web/client/translations/data.de-DE.json | 5 +- web/client/translations/data.en-US.json | 5 +- web/client/translations/data.es-ES.json | 5 +- web/client/translations/data.fr-FR.json | 5 +- web/client/translations/data.it-IT.json | 5 +- web/client/utils/DebugUtils.js | 12 ++- 8 files changed, 130 insertions(+), 27 deletions(-) diff --git a/web/client/epics/geoProcessing.js b/web/client/epics/geoProcessing.js index e5812825b7..db0e69f5a2 100644 --- a/web/client/epics/geoProcessing.js +++ b/web/client/epics/geoProcessing.js @@ -130,6 +130,7 @@ import { calculateDistance } from "../utils/CoordinatesUtils"; import {buildIdentifyRequest} from "../utils/MapInfoUtils"; +import {logError} from "../utils/DebugUtils"; import {getFeatureInfo} from "../api/identify"; import {getFeatureSimple} from '../api/WFS'; import {findNonGeometryProperty} from '../utils/ogc/WFS/base'; @@ -211,7 +212,7 @@ export const checkWPSAvailabilityGPTEpic = (action$, store) => action$ ); }) .catch((e) => { - console.error(e); + logError(e); return Rx.Observable.of( setWPSAvailability(layerId, false, source), checkingWPS(false) @@ -270,8 +271,18 @@ export const getFeaturesGPTEpic = (action$, store) => action$ } }, filterObj, options) .map(data => setFeatures(layerId, source, data, page)) - .catch(error => { - return Rx.Observable.of(setFeatures(layerId, source, error, page)); + .catch(e => { + logError(e); + return Rx.Observable.of( + setFeatures(layerId, source, e, page), + showErrorNotification({ + title: "errorTitleDefault", + message: "GeoProcessing.notifications.errorGettingFeaturesList", + autoDismiss: 6, + position: "tc", + values: {layerName: layer.name + " - " + layer.title} + }) + ); }) .startWith(setFeatureLoading(true)) .concat(Rx.Observable.of(setFeatureLoading(false)))); @@ -316,7 +327,8 @@ export const getFeatureDataGPTEpic = (action$, store) => action$ ]); }) - .catch(() => { + .catch((e) => { + logError(e); return Rx.Observable.of(showErrorNotification({ title: "errorTitleDefault", message: "GeoProcessing.notifications.errorGetFeature", @@ -364,7 +376,8 @@ export const getIntersectionFeatureDataGPTEpic = (action$, store) => action$ ]); }) - .catch(() => { + .catch((e) => { + logError(e); return Rx.Observable.of(showErrorNotification({ title: "errorTitleDefault", message: "GeoProcessing.notifications.errorGetFeature", @@ -486,7 +499,8 @@ export const runBufferProcessGPTEpic = (action$, store) => action$ ) ); }) - .catch(() => { + .catch((e) => { + logError(e); return Rx.Observable.of(showErrorNotification({ title: "errorTitleDefault", message: "GeoProcessing.notifications.errorBuffer", @@ -504,19 +518,34 @@ export const runBufferProcessGPTEpic = (action$, store) => action$ executeOptions, { headers: {'Content-Type': 'application/xml', 'Accept': `application/xml, application/json`} - }).catch(() => { - return Rx.Observable.of(showErrorNotification({ - title: "errorTitleDefault", - message: "GeoProcessing.notifications.errorBuffer", - autoDismiss: 6, - position: "tc" - })); - }); + }) + .catch((e) => { + logError(e); + return Rx.Observable.of({error: e, layerName: layer.name, layerTitle: layer.title}); + }); return executeCollectProcess$ - .switchMap((geom) => { + .switchMap((result) => { + if (result.error) { + if (result.error.message.includes("Failed to retrieve value for input features")) { + console.error("layerName " + result.layerName + " - " + result.layerTitle); + return Rx.Observable.of(showErrorNotification({ + title: "errorTitleDefault", + message: "GeoProcessing.notifications.errorGettingFC", + autoDismiss: 6, + position: "tc", + values: {layerName: result.layerName + " - " + result.layerTitle} + })); + } + return Rx.Observable.of(showErrorNotification({ + title: "errorTitleDefault", + message: "GeoProcessing.notifications.errorBuffer", + autoDismiss: 6, + position: "tc" + })); + } const ft = { type: "Feature", - geometry: geom + geometry: result }; const featureReprojected = reprojectGeoJson(ft, "EPSG:4326", "EPSG:3857"); const geometry3857 = toWKT(featureReprojected.geometry); @@ -574,6 +603,10 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$ executeOptions, { headers: {'Content-Type': 'application/xml', 'Accept': `application/xml, application/json`} + }) + .catch((e) => { + logError(e); + return Rx.Observable.of({error: e, layerName: layer.name, layerTitle: layer.title}); }); } else { sourceFC$ = Rx.Observable.of(sourceFeature.geometry); @@ -588,12 +621,46 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$ executeOptions, { headers: {'Content-Type': 'application/xml', 'Accept': `application/xml, application/json`} + }) + .catch((e) => { + logError(e); + return Rx.Observable.of({error: e, layerName: intersectionLayer.name, layerTitle: intersectionLayer.title}); }); } else { intersectionFC$ = Rx.Observable.of(intersectionFeature.geometry); } return Rx.Observable.forkJoin(sourceFC$, intersectionFC$) .switchMap(([firstGeom, secondGeom]) => { + if (firstGeom.error) { + const errorActions = []; + if (firstGeom.error.message.includes("Failed to retrieve value for input features")) { + logError(firstGeom.error); + errorActions.push(showErrorNotification({ + title: "errorTitleDefault", + message: "GeoProcessing.notifications.errorGettingFC", + autoDismiss: 6, + position: "tc", + values: {layerName: firstGeom.layerName + " - " + firstGeom.layerTitle} + })); + } + if (secondGeom.error.message.includes("Failed to retrieve value for input features")) { + logError(secondGeom.error); + errorActions.push(showErrorNotification({ + title: "errorTitleDefault", + message: "GeoProcessing.notifications.errorGettingFC", + autoDismiss: 6, + position: "tc", + values: {layerName: secondGeom.layerName + " - " + secondGeom.layerTitle} + })); + } + errorActions.push(showErrorNotification({ + title: "errorTitleDefault", + message: "GeoProcessing.notifications.errorBuffer", + autoDismiss: 6, + position: "tc" + })); + return Rx.Observable.from(errorActions); + } const executeProcess$ = executeProcess( layerUrl, @@ -616,7 +683,16 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$ .switchMap((featureCollection) => { const groups = groupsSelector(state); const groupExist = find(groups, (g) => g.id === GPT_INTERSECTION_GROUP_ID); - const extent = getGeoJSONExtent(featureCollection); + let extent = getGeoJSONExtent(featureCollection); + if (extent.some(coord => coord === Infinity )) { + // intersection is empty, return a message + return Rx.Observable.of(showErrorNotification({ + title: "errorTitleDefault", + message: "GeoProcessing.notifications.emptyIntersection", + autoDismiss: 6, + position: "tc" + })); + } return (!groupExist ? Rx.Observable.of( addGroup("Intersected Layers", null, {id: GPT_INTERSECTION_GROUP_ID}, true)) : Rx.Observable.empty()) .concat( Rx.Observable.of( @@ -665,7 +741,8 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$ }) )); }) - .catch(() => { + .catch((e) => { + logError(e); return Rx.Observable.of(showErrorNotification({ title: "errorTitleDefault", message: "GeoProcessing.notifications.errorIntersectGFI", @@ -804,7 +881,8 @@ export const clickToSelectFeatureGPTEpic = (action$, {getState}) => position: "tc" })); }) - .catch(() => { + .catch((e) => { + logError(e); return Rx.Observable.of(showErrorNotification({ title: "errorTitleDefault", message: "GeoProcessing.notifications.errorGFI", diff --git a/web/client/observables/wfs.js b/web/client/observables/wfs.js index 6a3e2250a0..f4ceb01995 100644 --- a/web/client/observables/wfs.js +++ b/web/client/observables/wfs.js @@ -8,7 +8,7 @@ import urlUtil from 'url'; -import { castArray, isNil, isObject } from 'lodash'; +import { isArray, castArray, isNil, isObject } from 'lodash'; import Rx from 'rxjs'; import { parseString } from 'xml2js'; import { stripPrefix } from 'xml2js/lib/processors'; @@ -259,7 +259,7 @@ export const getLayerJSONFeature = ({ search = {}, url, name } = {}, filter, {so } : getFeature( query(name, [ - sortBy(pn[0]), + sortBy(isArray(pn) ? pn[0] : pn), ...(pn ? [propertyName(pn)] : []), ...(filter ? castArray(filter) : []) ]), diff --git a/web/client/translations/data.de-DE.json b/web/client/translations/data.de-DE.json index 72d655d4c4..2155d76f0b 100644 --- a/web/client/translations/data.de-DE.json +++ b/web/client/translations/data.de-DE.json @@ -3977,7 +3977,10 @@ "noLayerSelected": "Bitte wählen Sie zuerst die Ebene aus.", "successfulIntersection": "Der Schnittvorgang war erfolgreich und ein neuer Layer wurde erstellt und dem Inhaltsverzeichnis hinzugefügt", "successfulBuffer": "Der Puffervorgang war erfolgreich und eine neue Ebene wurde erstellt und dem Inhaltsverzeichnis hinzugefügt", - "errorBuffer": "Der Puffervorgang ist fehlgeschlagen" + "errorBuffer": "Der Puffervorgang ist fehlgeschlagen", + "emptyIntersection": "Es gibt keine Schnittmenge zwischen den angegebenen Datensätzen.", + "errorGettingFC": "Es war nicht möglich, die Geometrie aus der Ebene zu erfassen {layerName}", + "errorGettingFeaturesList": "Es war nicht möglich, die Liste der Features aus dem Layer abzurufen {layerName}" }, "warningTitle": "Warnung", "warningBody": "Sie haben keine Funktion ausgewählt und dies kann die Leistung im Geoserver verlangsamen. Möchten Sie fortfahren?", diff --git a/web/client/translations/data.en-US.json b/web/client/translations/data.en-US.json index d7f1b70bc0..2a5f332d45 100644 --- a/web/client/translations/data.en-US.json +++ b/web/client/translations/data.en-US.json @@ -3951,7 +3951,10 @@ "noLayerSelected": "Please select layer first.", "successfulIntersection": "The intersection operation was successful and a new layer has ben created and added to the TOC", "successfulBuffer": "The Buffer operation was successful and a new layer has ben created and added to the TOC", - "errorBuffer": "The Buffer operation has failed" + "errorBuffer": "The Buffer operation has failed", + "emptyIntersection": "There is no intersection between the given datasets.", + "errorGettingFC": "It was not possible to collect the geometry from the layer {layerName}", + "errorGettingFeaturesList": "It was not possible to fetch the list of features from the layer {layerName}" }, "warningTitle": "Warning", "warningBody": "You have not selected a feature and this may slow down performances in geoserver. Do you want to continue?", diff --git a/web/client/translations/data.es-ES.json b/web/client/translations/data.es-ES.json index 344b80b0c5..5acf75b543 100644 --- a/web/client/translations/data.es-ES.json +++ b/web/client/translations/data.es-ES.json @@ -3940,7 +3940,10 @@ "noLayerSelected": "Por favor seleccione la capa primero.", "successfulIntersection": "La operación de intersección fue exitosa y se creó una nueva capa y se agregó a la tabla de contenido", "successfulBuffer": "La operación de búfer fue exitosa y se creó una nueva capa y se agregó a la tabla de contenido", - "errorBuffer": "La operación de búfer ha fallado" + "errorBuffer": "La operación de búfer ha fallado", + "emptyIntersection": "No hay intersección entre los conjuntos de datos dados.", + "errorGettingFC": "No fue posible recopilar la geometría de la capa {layerName}", + "errorGettingFeaturesList": "No fue posible recuperar la lista de entidades de la capa {layerName}" }, "warningTitle": "Advertencia", "warningBody": "No ha seleccionado una función y esto puede ralentizar el rendimiento en el geoservidor. ¿Desea continuar?", diff --git a/web/client/translations/data.fr-FR.json b/web/client/translations/data.fr-FR.json index bf60b12b8c..b1a8c52037 100644 --- a/web/client/translations/data.fr-FR.json +++ b/web/client/translations/data.fr-FR.json @@ -3940,7 +3940,10 @@ "noLayerSelected": "Veuillez d'abord sélectionner le calque.", "successfulIntersection": "L'opération d'intersection a réussi et une nouvelle couche a été créée et ajoutée à la table des matières", "successfulBuffer": "L'opération Buffer a réussi et une nouvelle couche a été créée et ajoutée à la table des matières", - "errorBuffer": "L'opération Buffer a échoué" + "errorBuffer": "L'opération Buffer a échoué", + "emptyIntersection": "Il n'y a pas d'intersection entre les ensembles de données donnés.", + "errorGettingFC": "Il n'a pas été possible de collecter la géométrie du calque {layerName}", + "errorGettingFeaturesList": "Il n'a pas été possible de récupérer la liste des entités de la couche {layerName}" }, "warningTitle": "Avertissement", "warningBody": "Vous n'avez pas sélectionné de fonctionnalité et cela peut ralentir les performances de geoserver. Voulez-vous continuer ?", diff --git a/web/client/translations/data.it-IT.json b/web/client/translations/data.it-IT.json index 8e0412c991..3b288287e3 100644 --- a/web/client/translations/data.it-IT.json +++ b/web/client/translations/data.it-IT.json @@ -3940,7 +3940,10 @@ "noLayerSelected": "Seleziona prima il livello.", "successfulIntersection": "L'operazione di intersezione è andata a buon fine e un nuovo livello è stato creato e aggiunto alla tabella dei contenuti", "successfulBuffer": "L'operazione Buffer è andata a buon fine e un nuovo livello è stato creato e aggiunto alla tabella dei contenuti", - "errorBuffer": "L'operazione Buffer è fallita" + "errorBuffer": "L'operazione Buffer è fallita", + "emptyIntersection": "Non c'è una interesezione tra i dati utilizzati.", + "errorGettingFC": "Non è stato possibile ottenere la collezione di geometrie dal layer {layerName}", + "errorGettingFeaturesList": "Non è stato possibile ottenere la lista di features dal layer {layerName}" }, "warningTitle": "Attenzione", "warningBody": "Non hai selezionato una funzione e questo potrebbe rallentare le prestazioni del geoserver. Vuoi continuare?", diff --git a/web/client/utils/DebugUtils.js b/web/client/utils/DebugUtils.js index fb6731d1c2..a7419faf7b 100644 --- a/web/client/utils/DebugUtils.js +++ b/web/client/utils/DebugUtils.js @@ -11,13 +11,23 @@ import url from 'url'; const urlQuery = url.parse(window.location.href, true).query; +export const isDebugMode = () => { + return urlQuery && urlQuery.debug && __DEVTOOLS__; +}; + +export const logError = (error) => { + if (isDebugMode) { + console.error(error.message); + } +}; + export function createDebugStore(reducer, initialState, userMiddlewares, enhancer) { return createStore({ rootReducer: reducer, state: initialState, middlewares: userMiddlewares, enhancer, - debug: urlQuery && urlQuery.debug && __DEVTOOLS__ + debug: isDebugMode() }); } From e63eb8512c66469fd4bda0c52d0a31f30d204e32 Mon Sep 17 00:00:00 2001 From: MV88 Date: Wed, 18 Oct 2023 17:29:08 +0200 Subject: [PATCH 2/4] various fixes --- .../actions/__tests__/geoProcessing-test.js | 6 +- web/client/actions/geoProcessing.js | 5 +- web/client/epics/geoProcessing.js | 15 ++--- web/client/plugins/GeoProcessing/processes.js | 7 ++- .../reducers/__tests__/geoProcessing-test.js | 1 - web/client/reducers/geoProcessing.js | 13 ++--- web/client/translations/data.de-DE.json | 1 + web/client/translations/data.en-US.json | 1 + web/client/translations/data.es-ES.json | 1 + web/client/translations/data.fr-FR.json | 1 + web/client/translations/data.it-IT.json | 1 + web/client/utils/GeoProcessingUtils.js | 25 --------- .../__tests__/GeoProcessingUtils-test.js | 55 ------------------- 13 files changed, 28 insertions(+), 104 deletions(-) delete mode 100644 web/client/utils/GeoProcessingUtils.js delete mode 100644 web/client/utils/__tests__/GeoProcessingUtils-test.js diff --git a/web/client/actions/__tests__/geoProcessing-test.js b/web/client/actions/__tests__/geoProcessing-test.js index cde8b35cde..2c25e213c8 100644 --- a/web/client/actions/__tests__/geoProcessing-test.js +++ b/web/client/actions/__tests__/geoProcessing-test.js @@ -164,14 +164,16 @@ describe('Test Geo Processing Tools related actions', () => { const source = ""; const data = {}; const nextPage = 2; + const geometryProperty = {}; - const action = setFeatures(layerId, source, data, nextPage); + const action = setFeatures(layerId, source, data, nextPage, geometryProperty); expect(action).toEqual({ type: SET_FEATURES, layerId, source, data, - nextPage + nextPage, + geometryProperty }); }); it('setFeatureSourceLoading', () => { diff --git a/web/client/actions/geoProcessing.js b/web/client/actions/geoProcessing.js index e54541be34..33c3c2e865 100644 --- a/web/client/actions/geoProcessing.js +++ b/web/client/actions/geoProcessing.js @@ -197,12 +197,13 @@ export const setBufferCapStyle = (capStyle) => ({ * @param {string} source can be "source" or "intersection" * @param {object[]|object} data list of features or error */ -export const setFeatures = (layerId, source, data, nextPage) => ({ +export const setFeatures = (layerId, source, data, nextPage, geometryProperty) => ({ type: SET_FEATURES, layerId, source, data, - nextPage + nextPage, + geometryProperty }); /** * action for the loading flag of the features diff --git a/web/client/epics/geoProcessing.js b/web/client/epics/geoProcessing.js index db0e69f5a2..1627ba6d6c 100644 --- a/web/client/epics/geoProcessing.js +++ b/web/client/epics/geoProcessing.js @@ -133,7 +133,7 @@ import {buildIdentifyRequest} from "../utils/MapInfoUtils"; import {logError} from "../utils/DebugUtils"; import {getFeatureInfo} from "../api/identify"; import {getFeatureSimple} from '../api/WFS'; -import {findNonGeometryProperty} from '../utils/ogc/WFS/base'; +import {findNonGeometryProperty, findGeometryProperty} from '../utils/ogc/WFS/base'; import toWKT from '../utils/ogc/WKT/toWKT'; const OFFSET = 550; @@ -261,6 +261,7 @@ export const getFeaturesGPTEpic = (action$, store) => action$ startIndex: page * maxFeatures, maxFeatures }; + const geometryProperty = findGeometryProperty(layer.describeFeatureType); return Rx.Observable.merge( getLayerJSONFeature({ ...layer, @@ -270,11 +271,11 @@ export const getFeaturesGPTEpic = (action$, store) => action$ url: layer.url } }, filterObj, options) - .map(data => setFeatures(layerId, source, data, page)) + .map(data => setFeatures(layerId, source, data, page, geometryProperty)) .catch(e => { logError(e); return Rx.Observable.of( - setFeatures(layerId, source, e, page), + setFeatures(layerId, source, e, page, geometryProperty), showErrorNotification({ title: "errorTitleDefault", message: "GeoProcessing.notifications.errorGettingFeaturesList", @@ -631,9 +632,9 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$ } return Rx.Observable.forkJoin(sourceFC$, intersectionFC$) .switchMap(([firstGeom, secondGeom]) => { - if (firstGeom.error) { + if (firstGeom?.error || secondGeom?.error) { const errorActions = []; - if (firstGeom.error.message.includes("Failed to retrieve value for input features")) { + if (firstGeom?.error?.message?.includes("Failed to retrieve value for input features")) { logError(firstGeom.error); errorActions.push(showErrorNotification({ title: "errorTitleDefault", @@ -643,7 +644,7 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$ values: {layerName: firstGeom.layerName + " - " + firstGeom.layerTitle} })); } - if (secondGeom.error.message.includes("Failed to retrieve value for input features")) { + if (secondGeom?.error?.message?.includes("Failed to retrieve value for input features")) { logError(secondGeom.error); errorActions.push(showErrorNotification({ title: "errorTitleDefault", @@ -655,7 +656,7 @@ export const runIntersectProcessGPTEpic = (action$, store) => action$ } errorActions.push(showErrorNotification({ title: "errorTitleDefault", - message: "GeoProcessing.notifications.errorBuffer", + message: "GeoProcessing.notifications.errorIntersectGFI", autoDismiss: 6, position: "tc" })); diff --git a/web/client/plugins/GeoProcessing/processes.js b/web/client/plugins/GeoProcessing/processes.js index 9b7feb7edc..918e02b5ec 100644 --- a/web/client/plugins/GeoProcessing/processes.js +++ b/web/client/plugins/GeoProcessing/processes.js @@ -115,10 +115,11 @@ export const processes = [ {props.runningProcess ? : null} ); diff --git a/web/client/reducers/__tests__/geoProcessing-test.js b/web/client/reducers/__tests__/geoProcessing-test.js index f84fc834a3..6610160011 100644 --- a/web/client/reducers/__tests__/geoProcessing-test.js +++ b/web/client/reducers/__tests__/geoProcessing-test.js @@ -288,7 +288,6 @@ describe('Test Geo Processing Tools reducer', () => { }, action); expect(state.source.feature).toEqual(feature); expect(state.source.features).toEqual([feature]); - expect(state.flags.isIntersectionEnabled).toEqual(true); }); it('SET_INTERSECTION_LAYER_ID', () => { const layerId = "id"; diff --git a/web/client/reducers/geoProcessing.js b/web/client/reducers/geoProcessing.js index d2254da865..b98623be84 100644 --- a/web/client/reducers/geoProcessing.js +++ b/web/client/reducers/geoProcessing.js @@ -46,7 +46,6 @@ import { RESET_CONTROLS } from '../actions/controls'; import { LOCATION_CHANGE } from 'connected-react-router'; -import { checkIfIntersectionIsPossible } from '../utils/GeoProcessingUtils'; /** * reducer for GeoProcessing @@ -208,6 +207,10 @@ function geoProcessing( state = { features: (state[action.source].features || []).concat(action.data.features || []), totalCount: action.data.totalFeatures, currentPage: action.nextPage + }, + flags: { + ...state.flags, + isIntersectionEnabled: action.source === "source" ? !action.geometryProperty?.type?.includes("Point") : state.flags.isIntersectionEnabled } } : { ...state, @@ -308,10 +311,6 @@ function geoProcessing( state = { ...state.source, feature: action.feature, features: find(state.source.features, ft => ft.id === action.feature.id) ? state.source.features : [action.feature] - }, - flags: { - ...state.flags, - isIntersectionEnabled: checkIfIntersectionIsPossible(action?.feature, state?.intersection?.feature) } }; } @@ -350,10 +349,6 @@ function geoProcessing( state = { ...state.intersection, feature: action.feature, features: find(state.intersection.features, ft => ft.id === action.feature.id) ? state.intersection.features : [action.feature] - }, - flags: { - ...state.flags, - isIntersectionEnabled: checkIfIntersectionIsPossible(state?.source?.feature, action?.feature) } }; } diff --git a/web/client/translations/data.de-DE.json b/web/client/translations/data.de-DE.json index 2155d76f0b..6a7adb3bf2 100644 --- a/web/client/translations/data.de-DE.json +++ b/web/client/translations/data.de-DE.json @@ -3991,6 +3991,7 @@ "invalidLayers": "Eine der von Ihnen ausgewählten Ebenen kann in diesem Prozess nicht verwendet werden", "fillRequiredDataIntersection": "Bitte wählen Sie mindestens den Quell-Layer und den Schnittpunkt-Layer aus", "fillRequiredDataBuffer": "Bitte wählen Sie mindestens die Quellebene aus", + "pointAndPolygon": "Sie können einen Punkt nur als Schnittpunkt-Feature auswählen, während der Quell-Layer ein Polygon-Layer ist", "siderBarBtn": "Geoverarbeitung", "selectFeature": "Bitte wählen Sie eine Funktion aus", "validFeature": "Diese Funktion ist gültig", diff --git a/web/client/translations/data.en-US.json b/web/client/translations/data.en-US.json index 2a5f332d45..f0494e3508 100644 --- a/web/client/translations/data.en-US.json +++ b/web/client/translations/data.en-US.json @@ -3965,6 +3965,7 @@ "invalidLayers": "One of the layers you have selected cannot be used within this process", "fillRequiredDataIntersection": "Please select at least the source layer and the intersection layer", "fillRequiredDataBuffer": "Please select at least the source layer", + "pointAndPolygon": "You can select a point only as an intersection feature, while the source layer must be a polygon layer", "siderBarBtn": "GeoProcessing", "selectFeature": "Please select a feature", "validFeature": "This feature is valid", diff --git a/web/client/translations/data.es-ES.json b/web/client/translations/data.es-ES.json index 5acf75b543..ad42affca3 100644 --- a/web/client/translations/data.es-ES.json +++ b/web/client/translations/data.es-ES.json @@ -3954,6 +3954,7 @@ "invalidLayers": "Una de las capas que ha seleccionado no se puede utilizar dentro de este proceso", "fillRequiredDataIntersection": "Seleccione al menos la capa de origen y la capa de intersección", "fillRequiredDataBuffer": "Seleccione al menos la capa de origen", + "pointAndPolygon": "Puede seleccionar un punto solo como una entidad de intersección, mientras que la capa de origen es una capa de polígono.", "siderBarBtn": "Geoprocesamiento", "selectFeature": "Seleccione una función", "validFeature": "Esta función es válida", diff --git a/web/client/translations/data.fr-FR.json b/web/client/translations/data.fr-FR.json index b1a8c52037..58f87181d4 100644 --- a/web/client/translations/data.fr-FR.json +++ b/web/client/translations/data.fr-FR.json @@ -3954,6 +3954,7 @@ "invalidLayers": "L'un des calques que vous avez sélectionnés ne peut pas être utilisé dans ce processus", "fillRequiredDataIntersection": "Veuillez sélectionner au moins la couche source et la couche d'intersection", "fillRequiredDataBuffer": "Veuillez sélectionner au moins la couche source", + "pointAndPolygon": "Vous pouvez sélectionner un point uniquement en tant qu'entité d'intersection, tandis que la couche source est une couche de polygones.", "siderBarBtn": "Géotraitement", "selectFeature": "Veuillez sélectionner une fonctionnalité", "validFeature": "Cette fonctionnalité est valide", diff --git a/web/client/translations/data.it-IT.json b/web/client/translations/data.it-IT.json index 3b288287e3..8d71310f7a 100644 --- a/web/client/translations/data.it-IT.json +++ b/web/client/translations/data.it-IT.json @@ -3954,6 +3954,7 @@ "invalidLayers": "Uno dei livelli che hai selezionato non può essere utilizzato all'interno di questo processo", "fillRequiredDataIntersection": "Seleziona almeno il livello di origine e il livello di intersezione", "fillRequiredDataBuffer": "Seleziona almeno il livello di origine", + "pointAndPolygon": "Puoi selezionare un punto solo come feature di intersezion, mentre il livello sorgente è un livello poligonale", "siderBarBtn": "Strumenti di geoelaborazione", "selectFeature": "Seleziona una funzione", "validFeature": "Questa feature è valida", diff --git a/web/client/utils/GeoProcessingUtils.js b/web/client/utils/GeoProcessingUtils.js deleted file mode 100644 index 32407a7a21..0000000000 --- a/web/client/utils/GeoProcessingUtils.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2023, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -/** - * check if intersection is possible between two features - * @param {object} sourceFeature the geojson feature - * @param {object} intersectionFeature the geojson feature - * @returns {string} the converted string in wkt - */ -export const checkIfIntersectionIsPossible = (sourceFeature = {}, intersectionFeature = {}) => { - - if ( - sourceFeature?.geometry?.type.includes("Point") || - intersectionFeature?.geometry?.type.includes("Point") - ) { - return (sourceFeature?.geometry?.type.includes("Point") && intersectionFeature?.geometry?.type.includes("Polygon")) || - (intersectionFeature?.geometry?.type.includes("Point") && sourceFeature?.geometry?.type.includes("Polygon") ); - } - return true; -}; diff --git a/web/client/utils/__tests__/GeoProcessingUtils-test.js b/web/client/utils/__tests__/GeoProcessingUtils-test.js deleted file mode 100644 index 41ae87d656..0000000000 --- a/web/client/utils/__tests__/GeoProcessingUtils-test.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2023, GeoSolutions Sas. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ -import expect from 'expect'; - -import { - checkIfIntersectionIsPossible -} from '../GeoProcessingUtils'; - - -describe('GeoProcessingUtils', () => { - const pointFT = { - type: "Feature", - geometry: { - coordinates: [1, 2], - type: "Point" - } - }; - const polygonFT = { - type: "Feature", - geometry: { - type: "Polygon" - } - }; - const lineStringFT = { - type: "Feature", - geometry: { - type: "LineString" - } - }; - describe('checkIfIntersectionIsPossible', () => { - - it('successful result', () => { - let result = checkIfIntersectionIsPossible(polygonFT, pointFT); - expect(result).toBeTruthy(); - result = checkIfIntersectionIsPossible(polygonFT, lineStringFT); - expect(result).toBeTruthy(); - result = checkIfIntersectionIsPossible(polygonFT, polygonFT); - expect(result).toBeTruthy(); - result = checkIfIntersectionIsPossible(lineStringFT, lineStringFT); - expect(result).toBeTruthy(); - }); - it(' failing result', () => { - let result = checkIfIntersectionIsPossible(lineStringFT, pointFT); - expect(result).toBeFalsy(); - result = checkIfIntersectionIsPossible(pointFT, pointFT); - expect(result).toBeFalsy(); - }); - }); - -}); From 52c39c669cd2d5e872cffa98eaa1f1614393d251 Mon Sep 17 00:00:00 2001 From: MV88 Date: Wed, 18 Oct 2023 17:30:50 +0200 Subject: [PATCH 3/4] adding missing fix for a test --- web/client/reducers/__tests__/geoProcessing-test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/web/client/reducers/__tests__/geoProcessing-test.js b/web/client/reducers/__tests__/geoProcessing-test.js index 6610160011..2ba78ba090 100644 --- a/web/client/reducers/__tests__/geoProcessing-test.js +++ b/web/client/reducers/__tests__/geoProcessing-test.js @@ -353,7 +353,6 @@ describe('Test Geo Processing Tools reducer', () => { } }, action); expect(state.intersection.feature).toEqual(feature); - expect(state.flags.isIntersectionEnabled).toEqual(true); }); it('SET_INTERSECTION_FIRST_ATTRIBUTE', () => { const firstAttributeToRetain = "attr"; From 241494e4a0499df8d52e4d618db4cdb34bde4689 Mon Sep 17 00:00:00 2001 From: MV88 Date: Thu, 19 Oct 2023 09:41:47 +0200 Subject: [PATCH 4/4] improve feedback message --- web/client/translations/data.de-DE.json | 2 +- web/client/translations/data.en-US.json | 2 +- web/client/translations/data.es-ES.json | 2 +- web/client/translations/data.fr-FR.json | 2 +- web/client/translations/data.it-IT.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web/client/translations/data.de-DE.json b/web/client/translations/data.de-DE.json index 6a7adb3bf2..4ad3042440 100644 --- a/web/client/translations/data.de-DE.json +++ b/web/client/translations/data.de-DE.json @@ -3991,7 +3991,7 @@ "invalidLayers": "Eine der von Ihnen ausgewählten Ebenen kann in diesem Prozess nicht verwendet werden", "fillRequiredDataIntersection": "Bitte wählen Sie mindestens den Quell-Layer und den Schnittpunkt-Layer aus", "fillRequiredDataBuffer": "Bitte wählen Sie mindestens die Quellebene aus", - "pointAndPolygon": "Sie können einen Punkt nur als Schnittpunkt-Feature auswählen, während der Quell-Layer ein Polygon-Layer ist", + "pointAndPolygon": "Sie können einen Punktlayer nur für den Schnittpunktlayer auswählen", "siderBarBtn": "Geoverarbeitung", "selectFeature": "Bitte wählen Sie eine Funktion aus", "validFeature": "Diese Funktion ist gültig", diff --git a/web/client/translations/data.en-US.json b/web/client/translations/data.en-US.json index f0494e3508..60946672d1 100644 --- a/web/client/translations/data.en-US.json +++ b/web/client/translations/data.en-US.json @@ -3965,7 +3965,7 @@ "invalidLayers": "One of the layers you have selected cannot be used within this process", "fillRequiredDataIntersection": "Please select at least the source layer and the intersection layer", "fillRequiredDataBuffer": "Please select at least the source layer", - "pointAndPolygon": "You can select a point only as an intersection feature, while the source layer must be a polygon layer", + "pointAndPolygon": "You can select a point layer only for the intersection layer", "siderBarBtn": "GeoProcessing", "selectFeature": "Please select a feature", "validFeature": "This feature is valid", diff --git a/web/client/translations/data.es-ES.json b/web/client/translations/data.es-ES.json index ad42affca3..7f12452db1 100644 --- a/web/client/translations/data.es-ES.json +++ b/web/client/translations/data.es-ES.json @@ -3954,7 +3954,7 @@ "invalidLayers": "Una de las capas que ha seleccionado no se puede utilizar dentro de este proceso", "fillRequiredDataIntersection": "Seleccione al menos la capa de origen y la capa de intersección", "fillRequiredDataBuffer": "Seleccione al menos la capa de origen", - "pointAndPolygon": "Puede seleccionar un punto solo como una entidad de intersección, mientras que la capa de origen es una capa de polígono.", + "pointAndPolygon": "Puede seleccionar una capa de puntos solo para la capa de intersección", "siderBarBtn": "Geoprocesamiento", "selectFeature": "Seleccione una función", "validFeature": "Esta función es válida", diff --git a/web/client/translations/data.fr-FR.json b/web/client/translations/data.fr-FR.json index 58f87181d4..2db57a5d68 100644 --- a/web/client/translations/data.fr-FR.json +++ b/web/client/translations/data.fr-FR.json @@ -3954,7 +3954,7 @@ "invalidLayers": "L'un des calques que vous avez sélectionnés ne peut pas être utilisé dans ce processus", "fillRequiredDataIntersection": "Veuillez sélectionner au moins la couche source et la couche d'intersection", "fillRequiredDataBuffer": "Veuillez sélectionner au moins la couche source", - "pointAndPolygon": "Vous pouvez sélectionner un point uniquement en tant qu'entité d'intersection, tandis que la couche source est une couche de polygones.", + "pointAndPolygon": "Vous pouvez sélectionner une couche de points uniquement pour la couche d'intersection", "siderBarBtn": "Géotraitement", "selectFeature": "Veuillez sélectionner une fonctionnalité", "validFeature": "Cette fonctionnalité est valide", diff --git a/web/client/translations/data.it-IT.json b/web/client/translations/data.it-IT.json index 8d71310f7a..94823d24dd 100644 --- a/web/client/translations/data.it-IT.json +++ b/web/client/translations/data.it-IT.json @@ -3954,7 +3954,7 @@ "invalidLayers": "Uno dei livelli che hai selezionato non può essere utilizzato all'interno di questo processo", "fillRequiredDataIntersection": "Seleziona almeno il livello di origine e il livello di intersezione", "fillRequiredDataBuffer": "Seleziona almeno il livello di origine", - "pointAndPolygon": "Puoi selezionare un punto solo come feature di intersezion, mentre il livello sorgente è un livello poligonale", + "pointAndPolygon": "Puoi selezionare un livello puntuale solo per il livello di intersezione", "siderBarBtn": "Strumenti di geoelaborazione", "selectFeature": "Seleziona una funzione", "validFeature": "Questa feature è valida",