Skip to content

Commit

Permalink
added stalling anti-meridian test
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Aug 24, 2023
1 parent dd2cbec commit f7ec999
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
35 changes: 35 additions & 0 deletions data/antimeridian/across.geojson
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates":
[
[
[
-182,
-18
],
[
-178,
-18
],
[
-178,
-20
],
[
-182,
-20
],
[
-182,
-18
]
]
]
},
"properties": {
"description": "rectangular polygon that cross the anti-meridian (on the left side), technically same area as split.geojson"
},
"srs": 4326
}
11 changes: 11 additions & 0 deletions src/stats/stats.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ test("antimerdian #2 (split at antimeridian)", async ({ eq }) => {
eq(results, [{ count: 327_972, min: 1, max: 1, sum: 327_972 }]);
});

test("antimerdian #3 (across antimeridian on left-side)", async ({ eq }) => {
// converted GeoTIFF to all 1's
const georaster = await parse("http://localhost:3000/data/gfwfiji_6933_COG_Binary.tif");
const geojson = JSON.parse(readFileSync("./data/antimeridian/across.geojson", "utf-8"));
// geom = reprojectGeoJSON(geom, { from: 4326, to: georaster.projection });
// console.dir(geom.geometry.coordinates, { depth: null });
const geom = { geometry: geojson, srs: 4326 };
const results = await stats(georaster, geom, { stats: ["count", "min", "max", "sum"] });
eq(results, [{ count: 327_972, min: 1, max: 1, sum: 327_972 }]);
});

test("edge", async ({ eq }) => {
// converted GeoTIFF to all 1's
const georaster = await parse("http://localhost:3000/data/geotiff-test-data/gfw-azores.tif");
Expand Down

0 comments on commit f7ec999

Please sign in to comment.