Skip to content

Commit

Permalink
bug in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr Martian committed Jan 27, 2025
1 parent 43dc921 commit 196237f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ cargo add gis-tools
| Main Modules | Size | Description |
| ------------------------ | ----------------------------- | ---------------------------------------------------------------- |
| [cache] | ![Cache Badge][cacheBadge] | A KV cache for values with a max size. Least used dropped first. |
| [pointGrid] | ![PG Badge][pgBadge] | Point cluster tool with indexing. |
| [pointGrid] | ![PG Badge][pgBadge] | Point grid tiling for number or raster data. |
| [pointCluster] | ![PC Badge][pcBadge] | Point cluster tool with indexing. |
| [pointIndex] | ![PI Badge][piBadge] | Point indexing with range/radius queries. |
| [pointIndexFast] | ![PIF Badge][pifBadge] | Faster point indexing with range/radius queries. |
Expand Down
29 changes: 24 additions & 5 deletions tests/readers/tile/elevation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,41 @@ test('read in wm terrarium2x', async () => {
expect(y).toEqual(2);
expect(tmsStyle).toEqual(false);
const tileData = await Array.fromAsync(tile);
// @ts-expect-error - for testing
expect(tileData[0].geometry.coordinates.slice(0, 5)).toEqual([
// expect(tileData[0].geometry.coordinates.slice(0, 5)).toEqual([
// { m: { elev: 346 }, x: 90.04394531249999, y: 66.49574045702329 },
// { m: { elev: 280 }, x: 90.13183593749999, y: 66.49574045702329 },
// { m: { elev: 392 }, x: 90.21972656249999, y: 66.49574045702329 },
// { m: { elev: 520 }, x: 90.30761718749999, y: 66.49574045702329 },
// { m: { elev: 549 }, x: 90.39550781249999, y: 66.49574045702329 },
// ]);
const actualPoints = [
{ m: { elev: 346 }, x: 90.04394531249999, y: 66.49574045702329 },
{ m: { elev: 280 }, x: 90.13183593749999, y: 66.49574045702329 },
{ m: { elev: 392 }, x: 90.21972656249999, y: 66.49574045702329 },
{ m: { elev: 520 }, x: 90.30761718749999, y: 66.49574045702329 },
{ m: { elev: 549 }, x: 90.39550781249999, y: 66.49574045702329 },
]);
];
// @ts-expect-error - for testing
expect(tileData[0].geometry.coordinates.slice(-5)).toEqual([
for (const point of tileData[0].geometry.coordinates.slice(0, 5)) {
const { x, y, m } = actualPoints.shift()!;
expect(point.x).toBeCloseTo(x);
expect(point.y).toBeCloseTo(y);
expect(point.m.elev).toEqual(m.elev);
}
const actual2 = [
{ m: { elev: -3568 }, x: 134.6044921875, y: 41.01306578700628 },
{ m: { elev: -3576 }, x: 134.69238281250003, y: 41.01306578700628 },
{ m: { elev: -3568 }, x: 134.7802734375, y: 41.01306578700628 },
{ m: { elev: -3550 }, x: 134.8681640625, y: 41.01306578700628 },
{ m: { elev: -3539 }, x: 134.9560546875, y: 41.01306578700628 },
]);
];
// @ts-expect-error - for testing
for (const point of tileData[0].geometry.coordinates.slice(-5)) {
const { x, y, m } = actual2.shift()!;
expect(point.x).toBeCloseTo(x);
expect(point.y).toBeCloseTo(y);
expect(point.m.elev).toEqual(m.elev);
}

const tiles = await Array.fromAsync(reader);
expect(tiles.length).toEqual(4);
Expand Down

0 comments on commit 196237f

Please sign in to comment.