How to use the geoblaze.histogram function in geoblaze

To help you get started, we’ve selected a few geoblaze examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GeoTIFF / geotiff.io / src / components / tools / histogram / histogram.container.js View on Github external
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);
}