Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

add image-download test #1576

Benjamin Kingc4ebb018c53b
diff --git a/web/js/modules/image-download/util.js b/web/js/modules/image-download/util.js
index d0d5950e6..fb5e51306 100644
--- a/web/js/modules/image-download/util.js
+++ b/web/js/modules/image-download/util.js
@@ -68,7 +68,7 @@ export function imageUtilCalculateResolution(
}
/*
- * Retieves avtive layers by day
+ * Retieves active layers by day
*
* @method getLayersForDay
* @private
@@ -125,8 +125,8 @@ export function imageUtilEstimateResolution(resolution, isGeoProjection) {
: resolution / GEO_ESTIMATION_CONSTANT;
}
export function imageUtilGetConversionFactor(proj) {
- if (proj === 'geographic') return 0.002197;
- return 256;
+ if (proj === 'geographic') return POLAR_ESTIMATION_CONSTANT;
+ return GEO_ESTIMATION_CONSTANT;
}
/*
diff --git a/web/js/modules/image-download/util.test.js b/web/js/modules/image-download/util.test.js
index af9ef30de..595376d10 100644
--- a/web/js/modules/image-download/util.test.js
+++ b/web/js/modules/image-download/util.test.js
@@ -1,4 +1,19 @@
-import { bboxWMS13 } from './util';
+import { bboxWMS13, imageUtilCalculateResolution } from './util';
+
+const geoResolutions = [
+ 0.5625,
+ 0.28125,
+ 0.140625,
+ 0.0703125,
+ 0.03515625,
+ 0.017578125,
+ 0.0087890625,
+ 0.00439453125,
+ 0.002197265625,
+ 0.0010986328125,
+ 0.00054931640625,
+ 0.00027465820313
+];
test('bboxWMS13', () => {
let coords = [[11, 22], [33, 44]];
@@ -7,3 +22,9 @@ test('bboxWMS13', () => {
let bboxArctic = bboxWMS13(coords, 'EPSG:3413');
expect(bboxArctic).toBe('11,22,33,44');
});
+
+test('Default km resolution Calculation', () => {
+ const zoom = 5;
+ const isGeo = true;
+ expect(imageUtilCalculateResolution(zoom, isGeo, geoResolutions)).toBe('4');
+});
diff --git a/web/js/modules/layers/constants.js b/web/js/modules/layers/constants.js
index 2ab30bab3..e69de29bb 100644
--- a/web/js/modules/layers/constants.js
+++ b/web/js/modules/layers/constants.js
@@ -1,8 +0,0 @@
-export const LAYER_PARAM_SETUP = {
- stateKey: 'legacy.layers.active',
- initialState: null,
- type: 'array',
- options: {
- delimiter: ','
- }
-};