Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getHistogram = (raster, geometry, options) => {
const { scaleType, numClasses } = options;
// make sure parameters are valid
if (numClasses % 1 !== 0) {
throw new Error('Please make sure the number of classes is an integer.');
}
if (!geometry) {
throw new Error('Please make sure to select a geography to run the tool on.');
}
// convert to list because react doesn't like storing objects in state
const geojson = geometry.toGeoJSON();
const results = geoblaze.histogram(raster, geojson, options);
return setResults(results);
}