Skip to content

Commit 54f5118

Browse files
committed
updated deps, adding support for NaN
1 parent 2106691 commit 54f5118

File tree

3 files changed

+52
-14
lines changed

3 files changed

+52
-14
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,22 @@
5353
"geotiff-epsg-code": "^0.3.1",
5454
"geotiff-no-data": "^0.2.0",
5555
"geotiff-read-bbox": "^2.2.0",
56-
"geowarp": "^1.23.1",
56+
"geowarp": "^1.26.0",
5757
"pixel-utils": "^0.9.0",
58-
"proj4": "^2.9.2",
58+
"proj4": "^2.10.0",
5959
"proj4-fully-loaded": "^0.2.0",
60-
"reproject-bbox": "^0.12.0"
60+
"reproject-bbox": "^0.13.1"
6161
},
6262
"devDependencies": {
63-
"@babel/cli": "^7.23.0",
64-
"@babel/core": "^7.23.3",
65-
"@babel/plugin-transform-export-namespace-from": "^7.23.3",
63+
"@babel/cli": "^7.23.4",
64+
"@babel/core": "^7.23.7",
65+
"@babel/plugin-transform-export-namespace-from": "^7.23.4",
6666
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
6767
"@babel/preset-typescript": "^7.23.3",
6868
"chroma-js": "^2.4.2",
6969
"envisage": "^0.1.0",
70-
"flug": "^2.6.0",
71-
"geotiff": "^2.1.0",
70+
"flug": "^2.7.2",
71+
"geotiff": "^2.1.1",
7272
"rimraf": "^5.0.5",
7373
"snap-bbox": "^0.5.0",
7474
"srvd": "^0.6.0",

src/index.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export default async function createTile({
8080
const start_time = timed ? performance.now() : 0;
8181

8282
if (!bbox) throw new Error("[geotiff-tile] you must provide bbox");
83+
if (isNaN(tile_height)) throw new Error("[geotiff-tile] tile_height is NaN");
84+
if (isNaN(tile_width)) throw new Error("[geotiff-tile] tile_width is NaN");
8385

8486
const image = await geotiff.getImage(0);
8587
const image_height = image.getHeight();
@@ -325,12 +327,12 @@ export default async function createTile({
325327
};
326328
} catch (error) {
327329
console.log("[geotiff-tile] failed to create tile");
328-
console.log("[geotiff-tile] bbox_in_tile_srs", bbox_in_tile_srs);
329-
console.log("[geotiff-tile] tile_height", tile_height);
330-
console.log("[geotiff-tile] tile_width", tile_width);
331-
console.log("[geotiff-tile] tile_srs", tile_srs);
332-
console.log("[geotiff-tile] use_overview", use_overview);
333-
console.error("[geotiff-tile]", error);
330+
console.log("[geotiff-tile] bbox_in_tile_srs: ", bbox_in_tile_srs);
331+
console.log("[geotiff-tile] tile_height:", tile_height);
332+
console.log("[geotiff-tile] tile_width;", tile_width);
333+
console.log("[geotiff-tile] tile_srs:", tile_srs);
334+
console.log("[geotiff-tile] use_overview:", use_overview);
335+
console.error("[geotiff-tile] error:", error);
334336
throw error;
335337
}
336338
}

test.mjs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,39 @@ test("simple again", async ({ eq }) => {
7878

7979
writeResult({ data: tile }, "simple-again-tile");
8080
});
81+
82+
test("antarctica with NaN", async ({ eq }) => {
83+
const port = 8081;
84+
const { server } = srvd.serve({ port });
85+
86+
const geotiff = await fromUrl(`http://localhost:${port}/data/bremen_sea_ice_conc_2022_9_9.tif`);
87+
88+
const image = await geotiff.getImage();
89+
90+
// [ -3950000, -3943750, 3950000, 4350000 ]
91+
const bbox = image.getBoundingBox();
92+
93+
const params = {
94+
bbox,
95+
bbox_srs: 3031,
96+
debug_level: 3,
97+
geotiff,
98+
method: "near-vectorize",
99+
round: true,
100+
tile_array_types: ["Array", "Array", "Array"],
101+
tile_height: 256,
102+
tile_srs: "EPSG:3031",
103+
tile_layout: "[band][row][column]",
104+
timed: true,
105+
tile_width: 256,
106+
use_overview: true
107+
};
108+
109+
const { height, width, tile, extra } = await createTile(params);
110+
111+
server.close();
112+
113+
const { readResult } = extra;
114+
115+
writeResult(readResult, "bremen_sea_ice_conc_2022_9_9");
116+
});

0 commit comments

Comments
 (0)