Skip to content

Commit

Permalink
fix uploadArea: invalid geojson error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
NSUWAL123 committed Mar 20, 2024
1 parent f35842a commit 31db46a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ const VectorLayer = ({
declutter: true,
});

const vlFeature = vectorLyr?.getSource().getFeatures();
if (!vlFeature || (vlFeature && vlFeature?.length === 0)) return;

map.on('click', (evt) => {
var pixel = evt.pixel;
const feature = map.forEachFeatureAtPixel(pixel, function (feature, layer) {
Expand Down
11 changes: 11 additions & 0 deletions src/frontend/src/components/createnewproject/UploadArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@ const UploadArea = ({ flag, geojsonFile, setGeojsonFile, setCustomDataExtractUpl
};

useEffect(() => {
if (drawnGeojson && !valid(drawnGeojson)) {
dispatch(
CommonActions.SetSnackBar({
open: true,
message: 'File not a valid geojson',
variant: 'error',
duration: 4000,
}),
);
return;
}
if (drawnGeojson) {
const isWGS84 = () => {
if (uploadAreaSelection === 'upload_file') {
Expand Down

0 comments on commit 31db46a

Please sign in to comment.