@radiantearth/stac-migrate 1.0.1 → 1.0.4
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 +1 -1
- package/migrate.js +20 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/migrate.js
CHANGED
|
@@ -250,6 +250,7 @@ var _ = {
|
|
|
250
250
|
},
|
|
251
251
|
|
|
252
252
|
moveTo(obj, key, context, fromSummary = false, mergedSummary = false) {
|
|
253
|
+
let condition;
|
|
253
254
|
if (fromSummary) {
|
|
254
255
|
if (mergedSummary) {
|
|
255
256
|
condition = val => Array.isArray(val);
|
|
@@ -345,7 +346,15 @@ var Catalog = {
|
|
|
345
346
|
|
|
346
347
|
_.ensure(catalog, 'stac_extensions', []) && DONE;
|
|
347
348
|
V.before('0.8.0') && _.populateExtensions(catalog, 'catalog') && DONE;
|
|
348
|
-
}
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
openeo(obj) {
|
|
352
|
+
_.rename(obj, 'api_version', 'openeo:api_version') && DONE;
|
|
353
|
+
_.rename(obj, 'backend_version', 'openeo:backend_version') && DONE;
|
|
354
|
+
_.rename(obj, 'production', 'openeo:production') && DONE;
|
|
355
|
+
_.rename(obj, 'endpoints', 'openeo:endpoints') && DONE;
|
|
356
|
+
_.rename(obj, 'billing', 'openeo:billing') && DONE;
|
|
357
|
+
},
|
|
349
358
|
|
|
350
359
|
};
|
|
351
360
|
|
|
@@ -379,6 +388,8 @@ var Collection = {
|
|
|
379
388
|
},
|
|
380
389
|
|
|
381
390
|
extent(collection) {
|
|
391
|
+
_.ensure(collection, "extent", {});
|
|
392
|
+
|
|
382
393
|
if (V.before('0.8.0')) {
|
|
383
394
|
// Restructure spatial extent
|
|
384
395
|
if (Array.isArray(collection.extent.spatial)) {
|
|
@@ -398,9 +409,14 @@ var Collection = {
|
|
|
398
409
|
}
|
|
399
410
|
}
|
|
400
411
|
|
|
412
|
+
_.ensure(collection.extent, "spatial", {});
|
|
413
|
+
_.ensure(collection.extent.spatial, "bbox", []);
|
|
414
|
+
_.ensure(collection.extent, "temporal", {});
|
|
415
|
+
_.ensure(collection.extent.temporal, "interval", []);
|
|
416
|
+
|
|
401
417
|
if (V.before('1.0.0-rc.3')) {
|
|
402
418
|
// The first extent in a Collection is always the overall extent, followed by more specific extents.
|
|
403
|
-
if (
|
|
419
|
+
if (collection.extent.temporal.interval.length > 1) {
|
|
404
420
|
let min, max;
|
|
405
421
|
for(let interval of collection.extent.temporal.interval) {
|
|
406
422
|
if (interval[0] === null) {
|
|
@@ -432,7 +448,7 @@ var Collection = {
|
|
|
432
448
|
max ? _.toISOString(max) : null
|
|
433
449
|
]);
|
|
434
450
|
}
|
|
435
|
-
if (
|
|
451
|
+
if (collection.extent.spatial.bbox.length > 1) {
|
|
436
452
|
let count = collection.extent.spatial.bbox.reduce((val, bbox) => Array.isArray(bbox) ? Math.max(bbox.length, val) : val, 4);
|
|
437
453
|
if (count >= 4) {
|
|
438
454
|
let union = new Array(count).fill(null);
|
|
@@ -596,7 +612,7 @@ var Asset = {
|
|
|
596
612
|
},
|
|
597
613
|
|
|
598
614
|
mediaTypes(asset) {
|
|
599
|
-
_.is(asset.type, 'string') &&
|
|
615
|
+
_.is(asset.type, 'string') && _.mapValues(
|
|
600
616
|
asset, 'type',
|
|
601
617
|
['image/vnd.stac.geotiff', 'image/vnd.stac.geotiff; cloud-optimized=true'],
|
|
602
618
|
['image/tiff; application=geotiff', 'image/tiff; application=geotiff; profile=cloud-optimized']
|