Skip to content

Commit

Permalink
[Fixes #961] Show an error if dataset as a ll_bbox_polygon is greater…
Browse files Browse the repository at this point in the history
… then the WGS84 max extent (#1000)
  • Loading branch information
DavidQuartz authored Jun 6, 2022
1 parent 15a7456 commit c342350
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
6 changes: 4 additions & 2 deletions geonode_mapstore_client/client/js/epics/gnresource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -161,7 +162,8 @@ const resourceTypes = {
updateStatus('edit'),
resizeMap()
]
: [])
: []),
newLayer?.bboxError && warningNotification({ title: "gnviewer.invalidBbox", message: "gnviewer.invalidBboxMsg" })
);
});
}
Expand Down
8 changes: 7 additions & 1 deletion geonode_mapstore_client/client/js/utils/ResourceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -138,7 +144,7 @@ export const resourceToLayerConfig = (resource) => {
url: wfsUrl
}
}),
...(bbox && { bbox }),
...(bbox ? { bbox } : { bboxError: true }),
...(template && {
featureInfo: {
format: 'TEMPLATE',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 Datensatzerweiterung",
"invalidBboxMsg": "Die Datensatzerweiterung überschreitet die maximale WGS84-Ausdehnung [-180, -90, 180, 90]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 dataset extension",
"invalidBboxMsg": "The dataset extension exceed the WGS84 maximum extent [-180, -90, 180, 90]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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": "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]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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": "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]"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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": "Estensione del dataset non valida",
"invalidBboxMsg": "L'estensione del dataset è maggiore del'estensione massima supportata della proiezione WGS84 [-180, -90, 180, 90]"
}
}
}

0 comments on commit c342350

Please sign in to comment.