Skip to content

Commit 3560a04

Browse files
Merge pull request #46 from developmentseed/collection-metadata
Collection metadata
2 parents e7d59d1 + b1630e2 commit 3560a04

File tree

1 file changed

+67
-21
lines changed

1 file changed

+67
-21
lines changed

runtimes/eoapi/stac/eoapi/stac/templates/collection.html

Lines changed: 67 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ <h1 class="my-4">
3232
{% if response.description %}
3333
<p>{{ response.description }}</p>
3434
{% endif %}
35+
{% if response.license %}
36+
<div class="d-flex align-items-center mb-2">
37+
{% include "icons/license.html" %}
38+
<p class="mb-0 pl-2">{{ response.license }}</p>
39+
</div>
40+
{% endif %}
41+
{% if response.extent and response.extent.temporal %}
42+
<div class="d-flex align-items-center mb-4">
43+
{% include "icons/clock.html" %}
44+
<p class="mb-0 pl-2">{{ response.extent.temporal.interval.0.0 or "..." }} — {{ response.extent.temporal.interval.0.1 or "..." }}</p>
45+
</div>
46+
{% endif %}
3547
{% if "keywords" in response and response.keywords|length > 0 %}
3648
<div class="d-flex align-items-center mb-4">
3749
{% include "icons/tag.html" %}
@@ -43,6 +55,52 @@ <h1 class="my-4">
4355
</div>
4456
{% endif %}
4557

58+
{% if response.item_assets and response.item_assets.items()|length > 0 %}
59+
<h2>Item Assets</h2>
60+
<ul class="list-unstyled">
61+
{% for key, asset in response.item_assets.items() %}
62+
<li class="mb-2">
63+
<p class="small text-monospace text-muted mb-0">{{ key }}</p>
64+
<p class="mb-0"><b>{{ asset.title }}</b></p>
65+
<p class="mb-0">{{ asset.type }}</p>
66+
{% if asset.roles|length > 0 %}
67+
<ul class="list-inline">
68+
{% for role in asset.roles %}
69+
<li class="list-inline-item badge badge-light">{{ role }}</li>
70+
{% endfor %}
71+
</ul>
72+
{% endif %}
73+
</li>
74+
{% endfor %}
75+
</ul>
76+
{% endif %}
77+
78+
{% if response.renders and response.renders.items()|length > 0 %}
79+
<h2>Render Options</h2>
80+
<ul class="list-unstyled">
81+
{% for key, option in response.renders.items() %}
82+
<li class="mb-2">
83+
<p class="small text-monospace text-muted mb-0">{{ key }}</p>
84+
{% if option.title %}<p class="mb-0"><b>{{ option.title }}</b></p>{% endif %}
85+
86+
<div class="row">
87+
<div class="col-3">assets</div>
88+
<div class="col-9">{% for asset in option.assets %}{{ asset }}{% if not loop.last %}, {% endif%}{% endfor %}</div>
89+
</div>
90+
91+
{% for render_key, render_opt in option.items() %}
92+
{% if render_key != 'title' and render_key != 'assets' %}
93+
<div class="row">
94+
<div class="col-3">{{ render_key }}</div>
95+
<div class="col-9">{{ render_opt }}</div>
96+
</div>
97+
{% endif %}
98+
{% endfor %}
99+
</li>
100+
{% endfor %}
101+
</ul>
102+
{% endif %}
103+
46104
<h2>Links</h2>
47105
<ul>
48106
{% for link in response.links %}
@@ -51,18 +109,6 @@ <h2>Links</h2>
51109
</ul>
52110
</div>
53111
<div class="col-md-5">
54-
{% if response.license %}
55-
<div class="d-flex align-items-center mb-2">
56-
{% include "icons/license.html" %}
57-
<p class="mb-0 pl-2">{{ response.license }}</p>
58-
</div>
59-
{% endif %}
60-
{% if response.extent and response.extent.temporal %}
61-
<div class="d-flex align-items-center mb-2">
62-
{% include "icons/clock.html" %}
63-
<p class="mb-0 pl-2">{{ response.extent.temporal.interval.0.0 or "..." }} — {{ response.extent.temporal.interval.0.1 or "..." }}</p>
64-
</div>
65-
{% endif %}
66112
{% if response.extent and response.extent.spatial %}
67113
<div id="map" class="rounded" style="width: 100%; height: 400px">
68114
Loading...
@@ -89,7 +135,7 @@ <h2>Links</h2>
89135
content: '<i class="fa fa-expand"></i>' // You can customize this icon
90136
}
91137
}).setView([0, 0], 1);
92-
138+
93139
var osmLayer = new L.TileLayer(
94140
'https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
95141
maxZoom: 18,
@@ -122,12 +168,12 @@ <h2>Links</h2>
122168
map.fitBounds(bbox_polygon.getBounds());
123169
}
124170
}
125-
171+
126172
// Add any tilejson links as layers to the map
127173
const tileJsonLinks = collection.links.filter(link => link.rel === "tiles");
128-
174+
129175
const overlayLayers = {};
130-
176+
131177
if (tileJsonLinks.length > 0) {
132178
tileJsonLinks.forEach((link, index) => {
133179
fetch(link.href)
@@ -139,22 +185,22 @@ <h2>Links</h2>
139185
minZoom: tileJson.minzoom || 0,
140186
maxZoom: tileJson.maxzoom || 18
141187
});
142-
188+
143189
const layerName = link.title || `TileJSON Layer ${index + 1}`;
144190
overlayLayers[layerName] = tileLayer;
145-
191+
146192
// Add the first layer to the map by default
147193
if (index === 0) {
148194
tileLayer.addTo(map);
149195
}
150-
196+
151197
// Add layer control after all layers are processed
152198
if (index === tileJsonLinks.length - 1) {
153199
// Define the base layers
154200
const baseLayers = {
155201
"OpenStreetMap": osmLayer
156202
};
157-
203+
158204
// Add the layer control to the map
159205
L.control.layers(baseLayers, overlayLayers).addTo(map);
160206
}
@@ -164,7 +210,7 @@ <h2>Links</h2>
164210
});
165211
});
166212
}
167-
213+
168214
// Handle fullscreen change event to resize map
169215
map.on('fullscreenchange', function() {
170216
if (map.isFullscreen()) {

0 commit comments

Comments
 (0)