Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 4.x][Fixes #961 & #1011] Show an error if dataset as a ll_bbox_polygon is greater then the WGS84 max extent #1031

Merged
merged 3 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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