Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
runRasterCalculator: (raster, rasterCalculator) => {
if (!raster) return dispatch(showAlert('Please add a raster before running this tool.'));
if (!rasterCalculator) return dispatch(showAlert('Please add a raster calculator operation before running this tool.'));
try {
dispatch(startLoading('Running Raster Calculator'));
return geoblaze.rasterCalculator(raster, rasterCalculator).then(newRaster => {
dispatch(stopLoading());
dispatch(addRasterFromGeoraster(newRaster));
});
} catch(e) {
dispatch(stopLoading());
dispatch(showAlert(`${SITE_CONFIG.title} was unable to complete the operation. Please make sure you are using a multi-band raster and a valid arithmetic operation`));
}
}
});