Skip to content

Commit 6d664e1

Browse files
committed
Merge remote-tracking branch 'radiant/dev' into master-radiant, v2.0.0-rc.2
2 parents ca80331 + 8c504b0 commit 6d664e1

File tree

6 files changed

+117
-104
lines changed

6 files changed

+117
-104
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ implemented as a single page application (SPA) for ease of development and to
88
limit the overall number of catalog reads necessary when browsing (as catalogs
99
may be nested and do not necessarily contain references to their parents).
1010

11-
<a href="https://www.netlify.com">
12-
<img src="https://www.netlify.com/img/global/badges/netlify-light.svg"/>
13-
</a>
11+
Version: 2.0.0-rc.2 (supports all STAC versions between 0.6.0 and 1.0.0-rc.4)
1412

1513
## Examples
1614

17-
* [planet.stac.cloud](https://planet.stac.cloud) ([catalog on GitHub](https://github.com/cholmes/pdd-stac/))
18-
* [CBERS](https://cbers.stac.cloud) ([catalog tools on GitHub](https://github.com/fredliporace/cbers-2-stac))
19-
* [Google Earth Engine](https://gee.stac.cloud)
20-
* [sat-api.stac.cloud](https://sat-api.stac.cloud) ([sat-api on GitHub](https://github.com/sat-utils/sat-api))
15+
* [FedEO Clearinghouse](https://geo.spacebel.be/)
16+
* [radarsat-1](https://www.radarstac.com/)
2117

22-
For a longer list of examples, checkout out [stac.cloud](http://stac.cloud).
18+
For a longer list of examples, checkout out [STAC Index](https://stac-index.org).
2319

2420
## Running
2521

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@radiantearth/stac-browser",
3-
"version": "2.0.0-rc.1",
3+
"version": "2.0.0-rc.2",
44
"description": "A Vue-based STAC browser intended for static + dynamic deployment",
55
"main": "src/main.js",
66
"scripts": {
@@ -30,14 +30,13 @@
3030
"license": "ISC",
3131
"dependencies": {
3232
"@babel/core": "^7.12.10",
33-
"@radiantearth/stac-fields": "1.0.0-beta.6",
34-
"@radiantearth/stac-migrate": "1.0.0-rc.3",
33+
"@radiantearth/stac-fields": "1.0.0-beta.7",
34+
"@radiantearth/stac-migrate": "1.0.0-rc.4",
3535
"bootstrap-vue": "^2.21.2",
3636
"bs58": "^4.0.1",
3737
"commonmark": "^0.29.3",
3838
"core-js": "^3.6.5",
3939
"d3-scale-chromatic": "^1.5.0",
40-
"json-query": "^2.2.2",
4140
"leaflet": "^1.7.1",
4241
"leaflet-easybutton": "^2.4.0",
4342
"lodash.escape": "^4.0.1",

src/components/Catalog.vue

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
<b-card bg-variant="light">
142142
<div v-if="spatialExtent.length > 0" id="locator-map" />
143143
<MetadataSidebar
144-
:properties="properties"
145144
:summaries="summaries"
146145
:stacVersion="stacVersion"
147146
:keywords="keywords"
@@ -156,10 +155,7 @@
156155
<footer class="footer">
157156
<b-container>
158157
<span class="poweredby text-muted">
159-
Powered by
160-
<a href="https://github.com/radiantearth/stac-browser"
161-
>STAC Browser</a
162-
>
158+
Powered by <a href="https://github.com/radiantearth/stac-browser">STAC Browser</a> v{{ browserVersion }}
163159
</span>
164160
</b-container>
165161
</footer>
@@ -320,14 +316,6 @@ export default {
320316
});
321317
});
322318
323-
// Set to collection tab manually if tab has not been changed by user
324-
// Otherwise due to async nature non-async tab is selected by default
325-
window.setTimeout(() => {
326-
if (!this.tabsChanged && (!this.$route.query.t || this.$route.query.t === "0")) {
327-
this.selectTab(0);
328-
}
329-
}, 250);
330-
331319
return collections;
332320
} catch (err) {
333321
console.warn(err);
@@ -379,14 +367,6 @@ export default {
379367
dateAcquired: item.properties.datetime
380368
}));
381369
382-
// Set to items tab manually if tab has not been changed by user
383-
// Otherwise due to async nature non-async tab is selected by default
384-
window.setTimeout(() => {
385-
if (!this.tabsChanged && (!this.$route.query.t || this.$route.query.t === "2")) {
386-
this.selectTab(2);
387-
}
388-
}, 250);
389-
390370
return features;
391371
} catch (err) {
392372
console.warn(err);
@@ -401,6 +381,9 @@ export default {
401381
...mapGetters(["getEntity"]),
402382
_entity() {
403383
let object = this.getEntity(this.url);
384+
if (object instanceof Error) {
385+
return object;
386+
}
404387
this.stacVersion = object.stac_version; // Store the original stac_version as it gets replaced by the migration
405388
let cloned = JSON.parse(JSON.stringify(object)); // Clone to avoid changing the vuex store, remove once migration is done directly in vuex
406389
return Migrate.stac(cloned);
@@ -421,14 +404,7 @@ export default {
421404
},
422405
bands() {
423406
// ToDo: Merge all bands from assets
424-
return (
425-
this._properties["eo:bands"] ||
426-
this.summaries['eo:bands'] ||
427-
(this.rootCatalog &&
428-
this.rootCatalog.properties &&
429-
this.rootCatalog.properties["eo:bands"]) ||
430-
[]
431-
);
407+
return Array.isArray(this.summaries['eo:bands']) ? this.summaries['eo:bands'] : [];
432408
},
433409
catalog() {
434410
return this.entity;
@@ -584,14 +560,14 @@ export default {
584560
name: this.title,
585561
description: this.description,
586562
// recommended
587-
citation: this._properties["sci:citation"],
588-
identifier: this._properties["sci:doi"] || this.catalog.id,
563+
citation: this.catalog["sci:citation"],
564+
identifier: this.catalog["sci:doi"] || this.catalog.id,
589565
keywords: this.keywords,
590566
license: this.licenseUrl,
591567
isBasedOn: this.url,
592568
version: this.version,
593569
url: this.path,
594-
workExample: (this._properties["sci:publications"] || []).map(p => ({
570+
workExample: (this.catalog["sci:publications"] || []).map(p => ({
595571
identifier: p.doi,
596572
citation: p.citation
597573
})),
@@ -626,22 +602,17 @@ export default {
626602
"@type": "Place",
627603
geo: {
628604
"@type": "GeoShape",
629-
// ToDo: compute min and max values from multiple extents
630605
box: this.spatialExtent[0].join(" ")
631606
}
632607
};
633608
}
634609
635-
if (this.temporalExtent.length > 0) {
636-
// ToDo: compute min and max values from multiple extents
610+
if (!this.isTemporalExtentUnbounded) {
637611
dataCatalog.temporalCoverage = this.temporalExtent[0].map(x => x || "..").join("/");
638612
}
639613
640614
return dataCatalog;
641615
},
642-
properties() {
643-
return this._properties;
644-
},
645616
spatialExtent() {
646617
const { spatial } = this.extent;
647618
if (!spatial || typeof spatial !== 'object' || !Array.isArray(spatial.bbox)) {
@@ -659,7 +630,13 @@ export default {
659630
return [];
660631
}
661632
662-
return temporal.interval.filter(box => Array.isArray(box) && box.length === 2);
633+
return temporal.interval.filter(interval => Array.isArray(interval) && interval.length === 2);
634+
},
635+
isTemporalExtentUnbounded() {
636+
if (this.temporalExtent.length > 0) {
637+
return this.temporalExtent[0].findIndex(interval => (typeof interval === 'string')) >= 0;
638+
}
639+
return true;
663640
},
664641
version() {
665642
return this.catalog.version;
@@ -680,6 +657,16 @@ export default {
680657
ip: to
681658
});
682659
}
660+
},
661+
collections() {
662+
if (!this.tabsChanged && (!this.$route.query.t || this.$route.query.t === "0") && this.collections.length > 0) {
663+
this.selectTab(0);
664+
}
665+
},
666+
externalItems() {
667+
if (!this.tabsChanged && (!this.$route.query.t || this.$route.query.t === "2") && this.externalItems.length > 0) {
668+
this.selectTab(2);
669+
}
683670
}
684671
},
685672
methods: {
@@ -725,7 +712,16 @@ export default {
725712
}
726713
).addTo(this.locatorMap);
727714
728-
const coordinates = [this.spatialExtent.map(extent => {
715+
let spatialExtent;
716+
if (this.spatialExtent.length > 1) {
717+
// Remove union bbox in favor of more concrete bboxes
718+
spatialExtent = this.spatialExtent.slice(1);
719+
}
720+
else {
721+
spatialExtent = this.spatialExtent;
722+
}
723+
724+
const coordinates = [spatialExtent.map(extent => {
729725
const [minX, minY, maxX, maxY] = extent;
730726
return [[minX, minY], [minX, maxY], [maxX, maxY], [maxX, minY], [minX, minY]];
731727
})];

src/components/Item.vue

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@
8181
<footer class="footer">
8282
<b-container>
8383
<span class="poweredby text-muted">
84-
Powered by
85-
<a href="https://github.com/radiantearth/stac-browser"
86-
>STAC Browser</a
87-
>
84+
Powered by <a href="https://github.com/radiantearth/stac-browser">STAC Browser</a> v{{ browserVersion }}
8885
</span>
8986
</b-container>
9087
</footer>
@@ -182,7 +179,10 @@ export default {
182179
...mapGetters(["getEntity"]),
183180
_entity() {
184181
let object = this.getEntity(this.url);
185-
if (object.type === "FeatureCollection") {
182+
if (object instanceof Error) {
183+
return object;
184+
}
185+
else if (object.type === "FeatureCollection") {
186186
const { hash } = url.parse(this.url);
187187
const idx = hash.slice(1);
188188
object = object.features[idx];
@@ -195,7 +195,7 @@ export default {
195195
return this.links.filter(x => x.rel === "collection");
196196
},
197197
_description() {
198-
return this._properties.description;
198+
return this.properties.description;
199199
},
200200
keywords() {
201201
if (this.collection && Array.isArray(this.collection.keywords)) {
@@ -207,32 +207,32 @@ export default {
207207
},
208208
_license() {
209209
return (
210-
this._properties["license"] ||
210+
this.properties.license ||
211211
(this.collection && this.collection.license) ||
212212
(this.rootCatalog && this.rootCatalog.license)
213213
);
214214
},
215215
providers() {
216216
return (
217-
this._properties["providers"] ||
217+
this.properties.providers ||
218218
(this.collection && this.collection.providers) ||
219219
common.computed.providers.apply(this)
220220
);
221221
},
222222
_temporalCoverage() {
223-
if (this._properties["start_datetime"] != null) {
223+
if (this.properties.start_datetime != null) {
224224
return [
225-
this._properties["start_datetime"],
226-
this._properties["end_datetime"]
225+
this.properties.start_datetime,
226+
this.properties.end_datetime
227227
]
228228
.map(x => x || "..")
229229
.join("/");
230230
}
231231
232-
return this._properties.datetime;
232+
return this.properties.datetime;
233233
},
234234
_title() {
235-
return this._properties.title;
235+
return this.properties.title;
236236
},
237237
attribution() {
238238
if (this.license != null || this.licensor != null) {
@@ -242,14 +242,12 @@ export default {
242242
return null;
243243
},
244244
bands() {
245+
// ToDo: Merge all bands from assets
245246
return (
246-
this._properties["eo:bands"] ||
247+
this.properties["eo:bands"] ||
247248
(this.collection &&
248249
this.collection.properties &&
249250
this.collection.properties["eo:bands"]) ||
250-
(this.rootCatalog &&
251-
this.rootCatalog.properties &&
252-
this.rootCatalog.properties["eo:bands"]) ||
253251
[]
254252
);
255253
},
@@ -324,13 +322,13 @@ export default {
324322
name: this.title,
325323
description: this.description || `${this.title} STAC Item`,
326324
// recommended
327-
citation: this._properties["sci:citation"],
328-
identifier: this._properties["sci:doi"] || this.item.id,
325+
citation: this.properties["sci:citation"],
326+
identifier: this.properties["sci:doi"] || this.item.id,
329327
keywords: this.keywords,
330328
license: this.licenseUrl,
331329
isBasedOn: this.url,
332330
url: this.path,
333-
workExample: (this._properties["sci:publications"] || []).map(p => ({
331+
workExample: (this.properties["sci:publications"] || []).map(p => ({
334332
identifier: p.doi,
335333
citation: p.citation
336334
})),
@@ -381,10 +379,7 @@ export default {
381379
.pop();
382380
},
383381
properties() {
384-
return {
385-
...this._collectionProperties,
386-
...this._properties
387-
};
382+
return this.entity.properties || {};
388383
},
389384
tileSource() {
390385
if (this.selectedImage == null) {
@@ -493,7 +488,7 @@ export default {
493488
layer.bindPopup(() => {
494489
const el = document.createElement("table");
495490
496-
const labelProperties = this._properties["label:properties"] || [];
491+
const labelProperties = this.properties["label:properties"] || [];
497492
498493
el.innerHTML = Object.entries(feature.properties)
499494
.filter(([k]) =>
@@ -508,7 +503,7 @@ export default {
508503
return el;
509504
}),
510505
style: feature => {
511-
const labelClasses = this._properties["label:classes"];
506+
const labelClasses = this.properties["label:classes"];
512507
const classes = (labelClasses || [])
513508
.map(x => x.classes.map(c => `${x.name}-${c}`))
514509
.flat();

0 commit comments

Comments
 (0)