From 8cdabb8f3bbdde15b8df40653f45ab228dce1ea7 Mon Sep 17 00:00:00 2001 From: DavidQuartz Date: Mon, 30 May 2022 13:24:33 +0000 Subject: [PATCH 1/2] handling invalid bbox --- geonode_mapstore_client/client/js/epics/gnresource.js | 6 ++++-- geonode_mapstore_client/client/js/utils/ResourceUtils.js | 8 +++++++- .../client/static/mapstore/translations/data.de-DE.json | 4 +++- .../client/static/mapstore/translations/data.en-US.json | 4 +++- .../client/static/mapstore/translations/data.es-ES.json | 4 +++- .../client/static/mapstore/translations/data.fr-FR.json | 4 +++- .../client/static/mapstore/translations/data.it-IT.json | 4 +++- 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/geonode_mapstore_client/client/js/epics/gnresource.js b/geonode_mapstore_client/client/js/epics/gnresource.js index 5c4194c7f9..6e0de9dcf9 100644 --- a/geonode_mapstore_client/client/js/epics/gnresource.js +++ b/geonode_mapstore_client/client/js/epics/gnresource.js @@ -79,7 +79,8 @@ import { CLICK_ON_MAP, resizeMap } from '@mapstore/framework/actions/map'; import { saveError } from '@js/actions/gnsave'; import { error as errorNotification, - success as successNotification + success as successNotification, + warning as warningNotification } from '@mapstore/framework/actions/notifications'; import { getStyleProperties } from '@js/api/geonode/style'; @@ -161,7 +162,8 @@ const resourceTypes = { updateStatus('edit'), resizeMap() ] - : []) + : []), + newLayer?.bboxError && warningNotification({ title: "gnviewer.invalidBbox", message: "gnviewer.invalidBboxMsg" }) ); }); } diff --git a/geonode_mapstore_client/client/js/utils/ResourceUtils.js b/geonode_mapstore_client/client/js/utils/ResourceUtils.js index 142235738f..eada14b33f 100644 --- a/geonode_mapstore_client/client/js/utils/ResourceUtils.js +++ b/geonode_mapstore_client/client/js/utils/ResourceUtils.js @@ -33,6 +33,12 @@ function getExtentFromResource({ ll_bbox_polygon: llBboxPolygon }) { geometry: llBboxPolygon }); const [minx, miny, maxx, maxy] = extent; + + // if the extent is greater than the max extent of the WGS84 return null + const WGS84_MAX_EXTENT = [-180, -90, 180, 90]; + if (minx < WGS84_MAX_EXTENT[0] || miny < WGS84_MAX_EXTENT[1] || maxx > WGS84_MAX_EXTENT[2] || maxy > WGS84_MAX_EXTENT[3]) { + return null; + } const bbox = { crs: 'EPSG:4326', bounds: { minx, miny, maxx, maxy } @@ -138,7 +144,7 @@ export const resourceToLayerConfig = (resource) => { url: wfsUrl } }), - ...(bbox && { bbox }), + ...(bbox ? { bbox } : { bboxError: true }), ...(template && { featureInfo: { format: 'TEMPLATE', diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json b/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json index 5d79d7ea43..88640f41e0 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json @@ -278,7 +278,9 @@ "cancelUpload": "Hochladen abbrechen", "parallelUploadLimit": "Die ausgewählte Anzahl von Dateien überschreitet das zulässige Limit von {limit} Dateien. Bitte entfernen Sie einige Dateien aus der Liste.", "parallelLimitError": "Die Anzahl aktiver paralleler Uploads überschreitet {limit}. Warten Sie, bis die ausstehenden abgeschlossen sind.", - "thisPage": "Diese Seite" + "thisPage": "Diese Seite", + "invalidBbox": "Ungültige BBox", + "invalidBboxMsg": "Die bereitgestellte BBox ist ungültig" } } } diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json b/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json index e2a475dad6..4c5b9793bf 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json @@ -278,7 +278,9 @@ "cancelUpload": "Cancel upload", "parallelUploadLimit": "The selected number of files exceeds the allowed limit of {limit} files. Please remove some files from the list.", "parallelLimitError": "The number of active parallel uploads exceeds {limit}. Wait for the pending ones to finish.", - "thisPage": "This page" + "thisPage": "This page", + "invalidBbox": "Invalid BBox", + "invalidBboxMsg": "The provided BBox is invalid" } } } diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json b/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json index c91b87693e..49a791334f 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json @@ -277,7 +277,9 @@ "cancelUpload": "Cancelar carga", "parallelUploadLimit": "El número de archivos seleccionado supera el límite permitido de {limit} archivos. Elimine algunos archivos de la lista.", "parallelLimitError": "El número de subidas paralelas activas supera {limit}. Espera a que terminen las pendientes.", - "thisPage": "Esta página" + "thisPage": "Esta página", + "invalidBbox": "BBox no válido", + "invalidBboxMsg": "Bl BBox proporcionado no es válido" } } } diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json b/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json index adcb47eddf..a713663655 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json @@ -278,7 +278,9 @@ "cancelUpload": "Annuler le téléchargement", "parallelUploadLimit": "Le nombre de fichiers sélectionné dépasse la limite autorisée de {limit} fichiers. Veuillez supprimer certains fichiers de la liste.", "parallelLimitError": "Le nombre de téléchargements parallèles actifs dépasse {limit}. Attendez que ceux en attente se terminent.", - "thisPage": "Cette page" + "thisPage": "Cette page", + "invalidBbox": "BBox invalide", + "invalidBboxMsg": "La bBBox fournie est invalide" } } } diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json b/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json index 339d2ccd87..aad5af0d23 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json @@ -280,7 +280,9 @@ "cancelUpload": "Annulla caricamento", "parallelUploadLimit": "Il numero selezionato di file supera il limite consentito di {limit} file. Si prega di rimuovere alcuni file dall'elenco.", "parallelLimitError": "Il numero di caricamenti paralleli attivi supera {limit}. Aspetta che quelli in sospeso finiscano.", - "thisPage": "Questa pagina" + "thisPage": "Questa pagina", + "invalidBbox": "BBox non valido", + "invalidBboxMsg": "La BBox fornita non è valida" } } } From c0ae2b5eff853198975da38a6fbca69a00a16c34 Mon Sep 17 00:00:00 2001 From: DavidQuartz Date: Wed, 1 Jun 2022 10:45:17 +0000 Subject: [PATCH 2/2] Improved bbox error translations --- .../client/static/mapstore/translations/data.de-DE.json | 4 ++-- .../client/static/mapstore/translations/data.en-US.json | 4 ++-- .../client/static/mapstore/translations/data.es-ES.json | 4 ++-- .../client/static/mapstore/translations/data.fr-FR.json | 4 ++-- .../client/static/mapstore/translations/data.it-IT.json | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json b/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json index 88640f41e0..769ac44799 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.de-DE.json @@ -279,8 +279,8 @@ "parallelUploadLimit": "Die ausgewählte Anzahl von Dateien überschreitet das zulässige Limit von {limit} Dateien. Bitte entfernen Sie einige Dateien aus der Liste.", "parallelLimitError": "Die Anzahl aktiver paralleler Uploads überschreitet {limit}. Warten Sie, bis die ausstehenden abgeschlossen sind.", "thisPage": "Diese Seite", - "invalidBbox": "Ungültige BBox", - "invalidBboxMsg": "Die bereitgestellte BBox ist ungültig" + "invalidBbox": "Ungültige Datensatzerweiterung", + "invalidBboxMsg": "Die Datensatzerweiterung überschreitet die maximale WGS84-Ausdehnung [-180, -90, 180, 90]" } } } diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json b/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json index 4c5b9793bf..2c23136487 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.en-US.json @@ -279,8 +279,8 @@ "parallelUploadLimit": "The selected number of files exceeds the allowed limit of {limit} files. Please remove some files from the list.", "parallelLimitError": "The number of active parallel uploads exceeds {limit}. Wait for the pending ones to finish.", "thisPage": "This page", - "invalidBbox": "Invalid BBox", - "invalidBboxMsg": "The provided BBox is invalid" + "invalidBbox": "Invalid dataset extension", + "invalidBboxMsg": "The dataset extension exceed the WGS84 maximum extent [-180, -90, 180, 90]" } } } diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json b/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json index 49a791334f..418100a009 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.es-ES.json @@ -278,8 +278,8 @@ "parallelUploadLimit": "El número de archivos seleccionado supera el límite permitido de {limit} archivos. Elimine algunos archivos de la lista.", "parallelLimitError": "El número de subidas paralelas activas supera {limit}. Espera a que terminen las pendientes.", "thisPage": "Esta página", - "invalidBbox": "BBox no válido", - "invalidBboxMsg": "Bl BBox proporcionado no es válido" + "invalidBbox": "Extensión de conjunto de datos no válida", + "invalidBboxMsg": "La extensión del conjunto de datos supera la extensión máxima de WGS84 [-180, -90, 180, 90]" } } } diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json b/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json index a713663655..fa9969c458 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.fr-FR.json @@ -279,8 +279,8 @@ "parallelUploadLimit": "Le nombre de fichiers sélectionné dépasse la limite autorisée de {limit} fichiers. Veuillez supprimer certains fichiers de la liste.", "parallelLimitError": "Le nombre de téléchargements parallèles actifs dépasse {limit}. Attendez que ceux en attente se terminent.", "thisPage": "Cette page", - "invalidBbox": "BBox invalide", - "invalidBboxMsg": "La bBBox fournie est invalide" + "invalidBbox": "Extension d'ensemble de données non valide", + "invalidBboxMsg": "L'extension du jeu de données dépasse l'étendue maximale du WGS84 [-180, -90, 180, 90]" } } } diff --git a/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json b/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json index aad5af0d23..00ed92652d 100644 --- a/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json +++ b/geonode_mapstore_client/client/static/mapstore/translations/data.it-IT.json @@ -281,8 +281,8 @@ "parallelUploadLimit": "Il numero selezionato di file supera il limite consentito di {limit} file. Si prega di rimuovere alcuni file dall'elenco.", "parallelLimitError": "Il numero di caricamenti paralleli attivi supera {limit}. Aspetta che quelli in sospeso finiscano.", "thisPage": "Questa pagina", - "invalidBbox": "BBox non valido", - "invalidBboxMsg": "La BBox fornita non è valida" + "invalidBbox": "Estensione del dataset non valida", + "invalidBboxMsg": "L'estensione del dataset è maggiore del'estensione massima supportata della proiezione WGS84 [-180, -90, 180, 90]" } } }