Skip to content

Commit

Permalink
Cleanup for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgrowney committed Aug 6, 2023
1 parent 4527d80 commit 9019791
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 36 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"dependencies": {
"calc-image-stats": "^0.9.0",
"cross-fetch": "^3.0.4",
"follow-redirects": "^1.15.2",
"georaster-to-canvas": "0.2.0",
"geotiff": "1.0.0-beta.13",
"geotiff-palette": "0.0.0",
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class GeoRaster {
return urlExists(ovrURL).then(ovrExists => {
if (debug) console.log('overview exists:', ovrExists);
this._options = Object.assign({}, {cache: true, forceXHR: false}, this._options)

if (debug) console.log('options:', this._options);
if (ovrExists) {
return fromUrls(this._url, [ovrURL], this._options);
Expand Down
69 changes: 35 additions & 34 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,37 +213,38 @@ test('Parsing COG Raster', async({ eq }) => {
});
});

test('Parsing Private COG Raster', async({ eq }) => {
const raster_url = "https://api.maxar.com/discovery/v1/collections/wv01/items/10200100D33E5000/assets/collections/dg-archive/assets/browse/10200100D33E5000.browse.tif";
let requestOps = {
headers: {
Authorization: `Bearer ${process.env.API_TOKEN}`
},
redirect: 'follow',
forceHTTP: true
}
parseGeoraster(raster_url, null, true, requestOps).then(georaster => {
eq(georaster.numberOfRasters, 1);
eq(georaster.projection, 4326);
eq(georaster.noDataValue, null);

const options = {
left: 0,
top: 0,
right: 4000,
bottom: 4000,
width: 10,
height: 10
};
georaster.getValues(options).then(values => {
const numBands = values.length;
const numRows = values[0].length;
const numColumns = values[0][0].length;
eq(numBands, 1);
eq(numRows, 10);
eq(numColumns, 10);
const histogram = countIn2D(values[0]);
eq(histogram[0], 71);
});
});
});
// Enable if you want to test private authentication against the Maxar Discovery API
// test('Parsing Private COG Raster', async({ eq }) => {
// const raster_url = "https://api.maxar.com/discovery/v1/collections/wv01/items/10200100D33E5000/assets/collections/dg-archive/assets/browse/10200100D33E5000.browse.tif";
// let requestOps = {
// headers: {
// Authorization: `Bearer ${process.env.API_TOKEN}`
// },
// redirect: 'follow',
// forceHTTP: true
// }
// parseGeoraster(raster_url, null, true, requestOps).then(georaster => {
// eq(georaster.numberOfRasters, 1);
// eq(georaster.projection, 4326);
// eq(georaster.noDataValue, null);

// const options = {
// left: 0,
// top: 0,
// right: 4000,
// bottom: 4000,
// width: 10,
// height: 10
// };
// georaster.getValues(options).then(values => {
// const numBands = values.length;
// const numRows = values[0].length;
// const numColumns = values[0][0].length;
// eq(numBands, 1);
// eq(numRows, 10);
// eq(numColumns, 10);
// const histogram = countIn2D(values[0]);
// eq(histogram[0], 71);
// });
// });
// });

0 comments on commit 9019791

Please sign in to comment.