@radiantearth/stac-migrate 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/migrate.js +21 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A library to update STAC files to the latest version (**1.0.0** at the moment of writing). Supports updating **STAC versions 0.6.0 and later**.
|
|
4
4
|
|
|
5
|
-
Version of this library: **1.0.
|
|
5
|
+
Version of this library: **1.0.3**
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ Import the library: `const Migrate = require('@radiantearth/stac-migrate');`
|
|
|
21
21
|
|
|
22
22
|
## Supported Extensions
|
|
23
23
|
|
|
24
|
-
* Checksum
|
|
24
|
+
* Checksum
|
|
25
25
|
* Collection Assets 1.0.0
|
|
26
26
|
* Commons
|
|
27
27
|
* Data Cube 1.0.0
|
package/migrate.js
CHANGED
|
@@ -345,7 +345,15 @@ var Catalog = {
|
|
|
345
345
|
|
|
346
346
|
_.ensure(catalog, 'stac_extensions', []) && DONE;
|
|
347
347
|
V.before('0.8.0') && _.populateExtensions(catalog, 'catalog') && DONE;
|
|
348
|
-
}
|
|
348
|
+
},
|
|
349
|
+
|
|
350
|
+
openeo(obj) {
|
|
351
|
+
_.rename(obj, 'api_version', 'openeo:api_version') && DONE;
|
|
352
|
+
_.rename(obj, 'backend_version', 'openeo:backend_version') && DONE;
|
|
353
|
+
_.rename(obj, 'production', 'openeo:production') && DONE;
|
|
354
|
+
_.rename(obj, 'endpoints', 'openeo:endpoints') && DONE;
|
|
355
|
+
_.rename(obj, 'billing', 'openeo:billing') && DONE;
|
|
356
|
+
},
|
|
349
357
|
|
|
350
358
|
};
|
|
351
359
|
|
|
@@ -359,10 +367,10 @@ var Collection = {
|
|
|
359
367
|
_.ensure(collection, 'license', 'proprietary') && DONE;
|
|
360
368
|
_.ensure(collection, 'extent', {
|
|
361
369
|
spatial: {
|
|
362
|
-
|
|
370
|
+
bbox: []
|
|
363
371
|
},
|
|
364
372
|
temporal: {
|
|
365
|
-
|
|
373
|
+
interval: []
|
|
366
374
|
}
|
|
367
375
|
}) && DONE;
|
|
368
376
|
|
|
@@ -379,6 +387,8 @@ var Collection = {
|
|
|
379
387
|
},
|
|
380
388
|
|
|
381
389
|
extent(collection) {
|
|
390
|
+
_.ensure(collection, "extent", {});
|
|
391
|
+
|
|
382
392
|
if (V.before('0.8.0')) {
|
|
383
393
|
// Restructure spatial extent
|
|
384
394
|
if (Array.isArray(collection.extent.spatial)) {
|
|
@@ -398,9 +408,14 @@ var Collection = {
|
|
|
398
408
|
}
|
|
399
409
|
}
|
|
400
410
|
|
|
411
|
+
_.ensure(collection.extent, "spatial", {});
|
|
412
|
+
_.ensure(collection.extent.spatial, "bbox", []);
|
|
413
|
+
_.ensure(collection.extent, "temporal", {});
|
|
414
|
+
_.ensure(collection.extent.temporal, "interval", []);
|
|
415
|
+
|
|
401
416
|
if (V.before('1.0.0-rc.3')) {
|
|
402
417
|
// The first extent in a Collection is always the overall extent, followed by more specific extents.
|
|
403
|
-
if (
|
|
418
|
+
if (collection.extent.temporal.interval.length > 1) {
|
|
404
419
|
let min, max;
|
|
405
420
|
for(let interval of collection.extent.temporal.interval) {
|
|
406
421
|
if (interval[0] === null) {
|
|
@@ -432,7 +447,7 @@ var Collection = {
|
|
|
432
447
|
max ? _.toISOString(max) : null
|
|
433
448
|
]);
|
|
434
449
|
}
|
|
435
|
-
if (
|
|
450
|
+
if (collection.extent.spatial.bbox.length > 1) {
|
|
436
451
|
let count = collection.extent.spatial.bbox.reduce((val, bbox) => Array.isArray(bbox) ? Math.max(bbox.length, val) : val, 4);
|
|
437
452
|
if (count >= 4) {
|
|
438
453
|
let union = new Array(count).fill(null);
|
|
@@ -596,7 +611,7 @@ var Asset = {
|
|
|
596
611
|
},
|
|
597
612
|
|
|
598
613
|
mediaTypes(asset) {
|
|
599
|
-
_.is(asset.type, 'string') &&
|
|
614
|
+
_.is(asset.type, 'string') && _.mapValues(
|
|
600
615
|
asset, 'type',
|
|
601
616
|
['image/vnd.stac.geotiff', 'image/vnd.stac.geotiff; cloud-optimized=true'],
|
|
602
617
|
['image/tiff; application=geotiff', 'image/tiff; application=geotiff; profile=cloud-optimized']
|