Skip to content

Commit 74ed15f

Browse files
committed
removed old code
1 parent f458f23 commit 74ed15f

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

Diff for: index.js

-54
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,6 @@ const xpath = require('xpath');
22
const { getDecoder } = require('geotiff/dist/compression');
33
const { parseXml } = require('geotiff/dist/globals');
44

5-
/*
6-
async function getStats(image, options) {
7-
options = options || {};
8-
const maxBufferSize = options.maxBufferSize || 800; // this is 1 KB
9-
const debug = options.debug || false;
10-
11-
if (debug) console.log("image:", image);
12-
13-
const { fileDirectory } = image;
14-
15-
const numBands = fileDirectory.SamplesPerPixel;
16-
17-
const noDataValue = fileDirectory.GDAL_NODATA ? parseFloat(fileDirectory.GDAL_NODATA) : null;
18-
if (debug) console.log("noDataValue:", noDataValue);
19-
20-
const bitsPerSample = Array.from(image.fileDirectory.BitsPerSample);
21-
console.log("bitsPerSample:", bitsPerSample);
22-
const chunkSizeInPixels = bitsPerSample.map(nbits => {
23-
return maxBufferSize / nbits;
24-
});
25-
console.log("chunkSizeInPixels:", chunkSizeInPixels);
26-
const sides = chunkSizeInPixels.map(size => Math.round(Math.sqrt(size)));
27-
if (debug) console.log("sides:", sides);
28-
const chunkHeights = sides.map(side => side);
29-
const chunkWidths = sides.map(side => side);
30-
console.log("width:", image.getWidth());
31-
const numRowsOfChunks = chunkHeights.map(chunkHeight => Math.ceil(image.getHeight() / chunkHeight));
32-
const numColumnsOfChunks = chunkWidths.map(chunkWidth => Math.ceil(image.getWidth() / chunkWidth));
33-
34-
const maxes = [];
35-
const mins = [];
36-
37-
for (let bandIndex = 0; bandIndex < numBands; bandIndex++) {
38-
const chunkHeight = chunkHeights[bandIndex];
39-
const chunkWidth = chunkWidths[bandIndex];
40-
for (let rowIndex = 0; rowIndex < numRowsOfChunks; rowIndex++) {
41-
for (let columnIndex = 0; columnIndex < numColumnsOfChunks; columnIndex++) {
42-
const top = rowIndex * chunkHeight;
43-
const left = columnIndex * chunkWidth;
44-
const right = left + chunkWidth;
45-
const bottom = top + chunkHeight;
46-
const params = {
47-
samples: [bandIndex],
48-
window: [left, top, right, bottom]
49-
};
50-
console.log("params:", params);
51-
const chunk = await image.readRasters(options);
52-
console.log("chunk:", chunk);
53-
}
54-
}
55-
}
56-
}
57-
*/
58-
595
function sum(array, start, end) {
606
let s = 0;
617
for (let i = start; i < end; ++i) {

0 commit comments

Comments
 (0)