diff --git a/geonode_mapstore_client/client/js/epics/gnresource.js b/geonode_mapstore_client/client/js/epics/gnresource.js index 5c4194c7f9..923a86055a 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,6 +162,9 @@ 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',