Skip to content

Commit

Permalink
[Fixes #961 & #1011] Show an error if dataset as a ll_bbox_polygon is…
Browse files Browse the repository at this point in the history
… greater then the WGS84 max extent (#1031)
  • Loading branch information
DavidQuartz authored Jun 21, 2022
1 parent 824e6c9 commit 81b455b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion 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,6 +162,9 @@ 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

0 comments on commit 81b455b

Please sign in to comment.