Skip to content

Commit

Permalink
Merge remote-tracking branch 'radiant/dev' into master-radiant, v2.0.…
Browse files Browse the repository at this point in the history
…0-rc.2
  • Loading branch information
m-mohr committed May 13, 2021
2 parents ca80331 + 8c504b0 commit 6d664e1
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 104 deletions.
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ implemented as a single page application (SPA) for ease of development and to
limit the overall number of catalog reads necessary when browsing (as catalogs
may be nested and do not necessarily contain references to their parents).

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

## Examples

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

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

## Running

Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@radiantearth/stac-browser",
"version": "2.0.0-rc.1",
"version": "2.0.0-rc.2",
"description": "A Vue-based STAC browser intended for static + dynamic deployment",
"main": "src/main.js",
"scripts": {
Expand Down Expand Up @@ -30,14 +30,13 @@
"license": "ISC",
"dependencies": {
"@babel/core": "^7.12.10",
"@radiantearth/stac-fields": "1.0.0-beta.6",
"@radiantearth/stac-migrate": "1.0.0-rc.3",
"@radiantearth/stac-fields": "1.0.0-beta.7",
"@radiantearth/stac-migrate": "1.0.0-rc.4",
"bootstrap-vue": "^2.21.2",
"bs58": "^4.0.1",
"commonmark": "^0.29.3",
"core-js": "^3.6.5",
"d3-scale-chromatic": "^1.5.0",
"json-query": "^2.2.2",
"leaflet": "^1.7.1",
"leaflet-easybutton": "^2.4.0",
"lodash.escape": "^4.0.1",
Expand Down
76 changes: 36 additions & 40 deletions src/components/Catalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
<b-card bg-variant="light">
<div v-if="spatialExtent.length > 0" id="locator-map" />
<MetadataSidebar
:properties="properties"
:summaries="summaries"
:stacVersion="stacVersion"
:keywords="keywords"
Expand All @@ -156,10 +155,7 @@
<footer class="footer">
<b-container>
<span class="poweredby text-muted">
Powered by
<a href="https://github.com/radiantearth/stac-browser"
>STAC Browser</a
>
Powered by <a href="https://github.com/radiantearth/stac-browser">STAC Browser</a> v{{ browserVersion }}
</span>
</b-container>
</footer>
Expand Down Expand Up @@ -320,14 +316,6 @@ export default {
});
});
// Set to collection tab manually if tab has not been changed by user
// Otherwise due to async nature non-async tab is selected by default
window.setTimeout(() => {
if (!this.tabsChanged && (!this.$route.query.t || this.$route.query.t === "0")) {
this.selectTab(0);
}
}, 250);
return collections;
} catch (err) {
console.warn(err);
Expand Down Expand Up @@ -379,14 +367,6 @@ export default {
dateAcquired: item.properties.datetime
}));
// Set to items tab manually if tab has not been changed by user
// Otherwise due to async nature non-async tab is selected by default
window.setTimeout(() => {
if (!this.tabsChanged && (!this.$route.query.t || this.$route.query.t === "2")) {
this.selectTab(2);
}
}, 250);
return features;
} catch (err) {
console.warn(err);
Expand All @@ -401,6 +381,9 @@ export default {
...mapGetters(["getEntity"]),
_entity() {
let object = this.getEntity(this.url);
if (object instanceof Error) {
return object;
}
this.stacVersion = object.stac_version; // Store the original stac_version as it gets replaced by the migration
let cloned = JSON.parse(JSON.stringify(object)); // Clone to avoid changing the vuex store, remove once migration is done directly in vuex
return Migrate.stac(cloned);
Expand All @@ -421,14 +404,7 @@ export default {
},
bands() {
// ToDo: Merge all bands from assets
return (
this._properties["eo:bands"] ||
this.summaries['eo:bands'] ||
(this.rootCatalog &&
this.rootCatalog.properties &&
this.rootCatalog.properties["eo:bands"]) ||
[]
);
return Array.isArray(this.summaries['eo:bands']) ? this.summaries['eo:bands'] : [];
},
catalog() {
return this.entity;
Expand Down Expand Up @@ -584,14 +560,14 @@ export default {
name: this.title,
description: this.description,
// recommended
citation: this._properties["sci:citation"],
identifier: this._properties["sci:doi"] || this.catalog.id,
citation: this.catalog["sci:citation"],
identifier: this.catalog["sci:doi"] || this.catalog.id,
keywords: this.keywords,
license: this.licenseUrl,
isBasedOn: this.url,
version: this.version,
url: this.path,
workExample: (this._properties["sci:publications"] || []).map(p => ({
workExample: (this.catalog["sci:publications"] || []).map(p => ({
identifier: p.doi,
citation: p.citation
})),
Expand Down Expand Up @@ -626,22 +602,17 @@ export default {
"@type": "Place",
geo: {
"@type": "GeoShape",
// ToDo: compute min and max values from multiple extents
box: this.spatialExtent[0].join(" ")
}
};
}
if (this.temporalExtent.length > 0) {
// ToDo: compute min and max values from multiple extents
if (!this.isTemporalExtentUnbounded) {
dataCatalog.temporalCoverage = this.temporalExtent[0].map(x => x || "..").join("/");
}
return dataCatalog;
},
properties() {
return this._properties;
},
spatialExtent() {
const { spatial } = this.extent;
if (!spatial || typeof spatial !== 'object' || !Array.isArray(spatial.bbox)) {
Expand All @@ -659,7 +630,13 @@ export default {
return [];
}
return temporal.interval.filter(box => Array.isArray(box) && box.length === 2);
return temporal.interval.filter(interval => Array.isArray(interval) && interval.length === 2);
},
isTemporalExtentUnbounded() {
if (this.temporalExtent.length > 0) {
return this.temporalExtent[0].findIndex(interval => (typeof interval === 'string')) >= 0;
}
return true;
},
version() {
return this.catalog.version;
Expand All @@ -680,6 +657,16 @@ export default {
ip: to
});
}
},
collections() {
if (!this.tabsChanged && (!this.$route.query.t || this.$route.query.t === "0") && this.collections.length > 0) {
this.selectTab(0);
}
},
externalItems() {
if (!this.tabsChanged && (!this.$route.query.t || this.$route.query.t === "2") && this.externalItems.length > 0) {
this.selectTab(2);
}
}
},
methods: {
Expand Down Expand Up @@ -725,7 +712,16 @@ export default {
}
).addTo(this.locatorMap);
const coordinates = [this.spatialExtent.map(extent => {
let spatialExtent;
if (this.spatialExtent.length > 1) {
// Remove union bbox in favor of more concrete bboxes
spatialExtent = this.spatialExtent.slice(1);
}
else {
spatialExtent = this.spatialExtent;
}
const coordinates = [spatialExtent.map(extent => {
const [minX, minY, maxX, maxY] = extent;
return [[minX, minY], [minX, maxY], [maxX, maxY], [maxX, minY], [minX, minY]];
})];
Expand Down
47 changes: 21 additions & 26 deletions src/components/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@
<footer class="footer">
<b-container>
<span class="poweredby text-muted">
Powered by
<a href="https://github.com/radiantearth/stac-browser"
>STAC Browser</a
>
Powered by <a href="https://github.com/radiantearth/stac-browser">STAC Browser</a> v{{ browserVersion }}
</span>
</b-container>
</footer>
Expand Down Expand Up @@ -182,7 +179,10 @@ export default {
...mapGetters(["getEntity"]),
_entity() {
let object = this.getEntity(this.url);
if (object.type === "FeatureCollection") {
if (object instanceof Error) {
return object;
}
else if (object.type === "FeatureCollection") {
const { hash } = url.parse(this.url);
const idx = hash.slice(1);
object = object.features[idx];
Expand All @@ -195,7 +195,7 @@ export default {
return this.links.filter(x => x.rel === "collection");
},
_description() {
return this._properties.description;
return this.properties.description;
},
keywords() {
if (this.collection && Array.isArray(this.collection.keywords)) {
Expand All @@ -207,32 +207,32 @@ export default {
},
_license() {
return (
this._properties["license"] ||
this.properties.license ||
(this.collection && this.collection.license) ||
(this.rootCatalog && this.rootCatalog.license)
);
},
providers() {
return (
this._properties["providers"] ||
this.properties.providers ||
(this.collection && this.collection.providers) ||
common.computed.providers.apply(this)
);
},
_temporalCoverage() {
if (this._properties["start_datetime"] != null) {
if (this.properties.start_datetime != null) {
return [
this._properties["start_datetime"],
this._properties["end_datetime"]
this.properties.start_datetime,
this.properties.end_datetime
]
.map(x => x || "..")
.join("/");
}
return this._properties.datetime;
return this.properties.datetime;
},
_title() {
return this._properties.title;
return this.properties.title;
},
attribution() {
if (this.license != null || this.licensor != null) {
Expand All @@ -242,14 +242,12 @@ export default {
return null;
},
bands() {
// ToDo: Merge all bands from assets
return (
this._properties["eo:bands"] ||
this.properties["eo:bands"] ||
(this.collection &&
this.collection.properties &&
this.collection.properties["eo:bands"]) ||
(this.rootCatalog &&
this.rootCatalog.properties &&
this.rootCatalog.properties["eo:bands"]) ||
[]
);
},
Expand Down Expand Up @@ -324,13 +322,13 @@ export default {
name: this.title,
description: this.description || `${this.title} STAC Item`,
// recommended
citation: this._properties["sci:citation"],
identifier: this._properties["sci:doi"] || this.item.id,
citation: this.properties["sci:citation"],
identifier: this.properties["sci:doi"] || this.item.id,
keywords: this.keywords,
license: this.licenseUrl,
isBasedOn: this.url,
url: this.path,
workExample: (this._properties["sci:publications"] || []).map(p => ({
workExample: (this.properties["sci:publications"] || []).map(p => ({
identifier: p.doi,
citation: p.citation
})),
Expand Down Expand Up @@ -381,10 +379,7 @@ export default {
.pop();
},
properties() {
return {
...this._collectionProperties,
...this._properties
};
return this.entity.properties || {};
},
tileSource() {
if (this.selectedImage == null) {
Expand Down Expand Up @@ -493,7 +488,7 @@ export default {
layer.bindPopup(() => {
const el = document.createElement("table");
const labelProperties = this._properties["label:properties"] || [];
const labelProperties = this.properties["label:properties"] || [];
el.innerHTML = Object.entries(feature.properties)
.filter(([k]) =>
Expand All @@ -508,7 +503,7 @@ export default {
return el;
}),
style: feature => {
const labelClasses = this._properties["label:classes"];
const labelClasses = this.properties["label:classes"];
const classes = (labelClasses || [])
.map(x => x.classes.map(c => `${x.name}-${c}`))
.flat();
Expand Down
Loading

0 comments on commit 6d664e1

Please sign in to comment.