How to use geoblaze - 10 common examples

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);
}
github GeoTIFF / geotiff.io / src / Map.js View on Github external
map.on('click', e => {
      store.dispatch(unfocusMenu());
      if (self.drawingPoints) {
        store.dispatch(removeGeometry());
        store.dispatch(addGeometry(e.latlng, 'point'));

        // temporary - setting results for identify here since
        // i can't find a good way of getting it in to the identify
        // tool while using leaflet for mapping
        const latlng = [e.latlng.lng, e.latlng.lat];
        const results = geoblaze.identify(self.raster.georaster, latlng);
        store.dispatch(setResults(results));
      }
    });
github GeoTIFF / geotiff.io / src / components / tools / band-arithmetic / band-arithmetic.container.js View on Github external
runBandArithmetic: (raster, bandArithmetic) => {
    if (!raster) return dispatch(showAlert('Please add a raster before running this tool.'));
    if (!bandArithmetic) return dispatch(showAlert('Please add an arithmetic operation before running this tool.'));
    try {
      dispatch(startLoading('Running Band Arithmetic'));
      return geoblaze.bandArithmetic(raster, bandArithmetic).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`));
    }
  }
});
github GeoTIFF / geotiff.io / src / services / RasterService.js View on Github external
return new Promise((resolve, reject) => {
      geoblaze.load(input)
        .then(georaster => {
          let options = {
            georaster: georaster,
            opacity: 0.7,
            resolution: getResolution()
          };
          const raster = new GeoRasterLayer(options);
          resolve(raster);
        }, error => {
          reject(error);
        });
    });
  },
github GeoTIFF / geotiff.io / src / components / tools / max / max.container.js View on Github external
const calculateMax = (raster, coors) => {
  return geoblaze.max(raster, coors)
    .map(value => value.toFixed(2)).join(', ');
}
github GeoTIFF / geotiff.io / src / components / tools / mean / mean.container.js View on Github external
const calculateMean = (raster, coors) => {
  return geoblaze.mean(raster, coors)
    .map(value => value.toFixed(2)).join(', ');
}
github GeoTIFF / geotiff.io / src / components / tools / median / median.container.js View on Github external
const calculateMedian = (raster, coors) => {
  return geoblaze.median(raster, coors)
    .map(value => value.toFixed(2)).join(', ');
}
github GeoTIFF / geotiff.io / src / components / tools / min / min.container.js View on Github external
const calculateMin = (raster, coors) => {
  return geoblaze.min(raster, coors)
    .map(value => value.toFixed(2)).join(', ');
}
github GeoTIFF / geotiff.io / src / components / tools / mode / mode.container.js View on Github external
const calculateMode = (raster, coors) => {
  const modes = geoblaze.mode(raster, coors);
  return modes.map(band => {
    if (typeof band === 'number') return band;
    return band.join(", ");
  });
}
github GeoTIFF / geotiff.io / src / components / tools / raster-calculator / raster-calculator.container.js View on Github external
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`));
    }
  }
});