Skip to content

Commit

Permalink
replaced resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Dec 10, 2023
1 parent 177e3c7 commit 09e832c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"proj4": "^2.9.0",
"proj4-fully-loaded": "^0.2.0",
"quick-promise": "^0.1.0",
"quick-resolve": "^0.0.1",
"reproject-bbox": "^0.12.0",
"reproject-geojson": "^0.5.0",
"snap-bbox": "^0.5.0",
Expand Down
9 changes: 4 additions & 5 deletions src/histogram/histogram.core.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import _ from "underscore";
import fastMin from "fast-min";
import fastMax from "fast-max";
import QuickPromise from "quick-promise";

import get from "../get";
import utils from "../utils";
import wrap from "../wrap-parse";
import { convertBbox, convertMultiPolygon } from "../convert-geometry";
import intersectPolygon from "../intersect-polygon";

const { resolve } = utils;

const getEqualIntervalBins = (values, numClasses) => {
// get min and max values
const minValue = fastMin(values);
Expand Down Expand Up @@ -152,14 +151,14 @@ const getHistogramsForRaster = (georaster, geom, options) => {
if (geom === null || geom === undefined) {
const flat = true;
const values = get(georaster, null, flat);
return resolve(values).then(calc);
return QuickPromise.resolve(values).then(calc);
} else if (utils.isBbox(geom)) {
geom = convertBbox(geom);

// grab array of values by band
const flat = true;
const values = get(georaster, geom, flat);
return resolve(values).then(calc);
return QuickPromise.resolve(values).then(calc);
} else if (utils.isPolygonal(geom)) {
geom = convertMultiPolygon(geom);
const { noDataValue } = georaster;
Expand All @@ -174,7 +173,7 @@ const getHistogramsForRaster = (georaster, geom, options) => {
}
});

return resolve(done).then(() => values.map(band => band.filter(value => value !== noDataValue)).map(band => getHistogram(band, options)));
return QuickPromise.resolve(done).then(() => values.map(band => band.filter(value => value !== noDataValue)).map(band => getHistogram(band, options)));
} else {
throw "Only Bounding Box and Polygon geometries are currently supported.";
}
Expand Down

0 comments on commit 09e832c

Please sign in to comment.