Skip to content

Commit

Permalink
debugging fetching of geojson
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Jul 23, 2023
1 parent 83a2da1 commit 87c0739
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/intersect-polygon/intersect-polygon.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ import parse from "../parse";
import { convertMultiPolygon } from "../convert-geometry";
import intersectPolygon from "../intersect-polygon";

async function fetch_json(url) {
let res;
let text;
try {
res = await fetch(url);
text = await res.text();
return JSON.parse(text);
} catch (error) {
console.log("text:", text);
throw error;
}
}

serve({ debug: true, max: 11, port: 3000, wait: 60 });

const urlToGeojson = "http://localhost:3000/data/gadm/geojsons/Akrotiri and Dhekelia.geojson";
Expand Down Expand Up @@ -134,7 +147,7 @@ test("Hole Test", async ({ eq }) => {

test("antimerdian #1", async ({ eq }) => {
const georaster = await parse(urlToData + "gfwfiji_6933_COG.tiff");
const geojson = await fetch(urlToData + "antimeridian/right-edge.geojson").then(res => res.json());
const geojson = await fetch_json(urlToData + "antimeridian/right-edge.geojson");
let numberOfIntersectingPixels = 0;
let geom = convertMultiPolygon(geojson);
// reproject geometry to projection of raster
Expand Down

0 comments on commit 87c0739

Please sign in to comment.