forked from radiantearth/stac-browser
-
Notifications
You must be signed in to change notification settings - Fork 3
/
fields.config.js
57 lines (47 loc) · 1.86 KB
/
fields.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { Registry, Helper } from '@radiantearth/stac-fields';
// Please consult https://github.com/radiantearth/stac-browser/blob/main/README.md#additional-metadata-fields for details.
// Registry.addExtension('radiant', 'Radiant Earth');
// Registry.addMetadataField('radiant:public_access', {
// label: "Data Access",
// formatter: value => value ? "Public" : "Private"
// });
Registry.addExtension('osc', 'Open Science Catalog');
Registry.addMetadataField('themes', {
label: "Themes",
ext: "osc",
formatter: value => Helper.toList(value.find(v => v.scheme === "OSC:SCHEME:THEMES").concepts, true, (i) => i.id, false)
// check in value if thema is correct (themes)
});
Registry.addMetadataField('contacts', {
label: "Contacts",
ext: "osc",
});
const formatLink = (type, value, links, jsonName) => {
const link = links.find(link => link.rel === 'related' && link.href.includes(value));
return Helper.toLink(`/stac-browser/#/${type}/${value}/${jsonName}.json`, link.title.split(":")[1], "", "_self");
}
Registry.addMetadataField('osc:project', {
label: "Project",
ext: "osc",
formatter: (value, field, spec, { links }) => {
return formatLink("projects", value, links, "collection")
}
});
Registry.addMetadataField('osc:themes', {
label: "Themes",
ext: "osc",
formatter: (value, field, spec, { links }) =>
value.map(theme => formatLink("themes", theme, links, "catalog")).join(", ")
});
Registry.addMetadataField('osc:variables', {
label: "Variables",
ext: "osc",
formatter: (value, field, spec, { links }) =>
value.map(variable => formatLink("variables", variable, links, "catalog")).join(", ")
});
Registry.addMetadataField('osc:missions', {
label: "Missions",
ext: "osc",
formatter: (value, field, spec, { links }) =>
value.map(mission => formatLink("eo-missions", mission, links, "catalog")).join(", ")
});