Skip to content

Commit

Permalink
fixed bug with caching
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Dec 3, 2023
1 parent 6394a2c commit 9638930
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class GeoRasterStack {
const entry = this.cache.find(it => it[0] === key);
if (entry) {
if (this.debug_level >= 1) console.log(`[georaster-stack] found cache entry "${key}"`);
return entry;
return entry[1];
}
}

Expand Down
10 changes: 8 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script src="https://unpkg.com/flug"></script>
<script src="http://unpkg.com/geo-extent"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="./dist/index.js"></script>
<script src="./dist/georaster-stack.js"></script>
</head>
<body>
<script>
Expand All @@ -13,6 +13,7 @@
// TEST_NAME: "diff projections + ab"
// TEST_NAME: "landsat stack",
// TEST_NAME: "umbra",
// TEST_NAME: "simple low-res",
TEST_TIMED: true
}
};
Expand Down Expand Up @@ -176,9 +177,11 @@
sources: [georaster]
});

const size = [256, 256];

const params = {
extent: new GeoExtent([128, 656, 144, 672], { srs: "simple" }),
size: [256, 256]
size
};

window.rerun = async () => await reader.read(params);
Expand All @@ -192,6 +195,9 @@
} = result;

display_three_band({ height, width, data: [data[0], data[0], data[0]] });

const reread = await reader.read(params);
eq(reread, { data, size });
});

test("simple high-res", async ({ eq }) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"unpkg": "./dist/georaster-stack.min.js",
"scripts": {
"build": "npx esbuild ./web/index.js --bundle --outfile=./dist/georaster-stack.min.js --sourcemap",
"build+watch": "npx esbuild ./web/index.js --bundle --outdir=dist --watch",
"build+watch": "npx esbuild ./web/index.js --bundle --outfile=./dist/georaster-stack.js --watch",
"clean": "npx rimraf dist",
"dev": "npx concurrently \"npm run build+watch\" \"npm run serve\"",
"format": "npx prettier --arrow-parens=avoid --print-width=200 --trailing-comma=none --write core/*.js web/*.js *.html",
Expand Down

0 comments on commit 9638930

Please sign in to comment.