Skip to content

Commit 104fdc3

Browse files
authored
Add HUC tiles (#40)
* Add MVT for hu02 hu04 hu06 * Condense pygeoapi config * Update tile HTML
1 parent d6bb876 commit 104fdc3

File tree

2 files changed

+668
-832
lines changed

2 files changed

+668
-832
lines changed

pygeoapi-skin-dashboard/templates/collections/tiles/index.html

Lines changed: 41 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,63 @@
44
/ <a href="{{ data['collections_path'] }}">{% trans %}Collections{% endtrans %}</a>
55
/ <a href="../{{ data['id'] }}">{{ data['title'] }}</a>
66
/ <a href="../{{ data['id'] }}/tiles">{% trans %}Tiles{% endtrans %}</a>
7-
{% endblock %}
8-
{% block extrahead %}
7+
{%- endblock %}
8+
{%- block extrahead %}
99
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
1010
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.1/leaflet.js"></script>
1111
<script src="https://unpkg.com/leaflet.vectorgrid@latest/dist/Leaflet.VectorGrid.bundled.js"></script>
1212
<style>
1313
.leaflet-popup-content {
14-
width: 200px;
15-
height: 100px;
14+
width: 300px;
15+
height: 64px;
16+
}
17+
18+
#items-map {
19+
max-height: 500px;
20+
height: 500px;
21+
max-width: 1000px;
1622
}
23+
.metadata-link {
24+
display: inline-block;
25+
padding: 8px 16px;
26+
background-color: #1B335F;
27+
color: white;
28+
text-decoration: none;
29+
border-radius: 4px;
30+
font-weight: 500;
31+
margin-top: 12px;
32+
transition: background-color 0.2s ease;
33+
}
34+
35+
.metadata-link:hover {
36+
background-color: #55677F;
37+
text-decoration: none;
38+
}
39+
40+
.metadata-link:focus {
41+
outline: 2px solid #55677F;
42+
outline-offset: 2px;
43+
}
1744
</style>
18-
{% endblock %}
45+
{%- endblock %}
1946

20-
{% block body %}
47+
{%- block body %}
2148
<section id="collection">
2249
<h1>{{ data['title'] }}</h1>
23-
<p>{{ data['description'] }}</p>
24-
<p>
25-
{% for kw in data['keywords'] %}
26-
<span class="badge text-bg-primary bg-primary">{{ kw }}</span>
27-
{% endfor %}
28-
</p>
29-
<h3>Tiles</h3>
3050
<div class="row">
31-
<div class="col-md-2 col-sm-12">{% trans %}Tile Matrix Set{% endtrans %}</div>
32-
<div class="col-md-8">
33-
<select id="tilingScheme">
34-
{% for tileset in data['tilesets'] %}
35-
<option value="{{ tileset }}">{{ tileset }}</option>
36-
{% endfor %}
37-
</select>
38-
</div>
39-
</div>
40-
<br/>
41-
<div class="row">
42-
<div class="col-md-2 col-sm-12">{% trans %}Metadata{% endtrans %}</div>
43-
<div class="col-md-8"><a id="metadata_link" href="" target="_blank">Metadata</a></div>
44-
</div>
45-
<script>
46-
var select = document.getElementById('tilingScheme');
47-
let params = (new URL(document.location)).searchParams;
48-
var scheme = params.get('scheme') ?? select.value;
49-
if (scheme) {
50-
select.value = scheme;
51-
document.getElementById("metadata_link").href = "{{ config['server']['url'] }}/collections/{{ data['id'] }}/tiles/" + scheme + "/metadata";
52-
}
53-
select.addEventListener('change', ev => {
54-
var scheme = ev.target.value;
55-
console.log(scheme);
56-
document.location.search = `scheme=${scheme}`;
57-
document.getElementById("metadata_link").href = "{{ config['server']['url'] }}/collections/{{ data['id'] }}/tiles/" + scheme + "/metadata";
58-
});
59-
</script>
60-
<br/>
61-
<div class="row">
62-
<div class="col-md-2 col-sm-12">Map</div>
63-
<div class="col-md-8">
51+
<div class="col-md-10">
6452
<div id="items-map"></div>
6553
</div>
54+
<div class="col-md-1">
55+
<a id="metadata_link" class="metadata-link" href="{{ config['server']['url'] }}/collections/{{ data['id'] }}/tiles/{{ data['tilesets'][0] }}/metadata" target="_blank">{% trans %}Metadata{% endtrans %}</a>
56+
</div>
6657
</div>
6758
</section>
68-
{% endblock %}
59+
{%- endblock %}
6960

70-
{% block extrafoot %}
61+
{%- block extrafoot %}
7162
<script>
63+
var scheme = "{{ data['tilesets'][0] }}";
7264
var map = L.map('items-map').setView([{{ 45 }}, {{ -75 }}], 10);
7365

7466
map.addLayer(new L.TileLayer(
@@ -131,7 +123,7 @@ <h3>Tiles</h3>
131123
var tilesPbfLayer = L.vectorGrid.protobuf(url, VectorTileOptions)
132124
.on('click', function(e) { // The .on method attaches an event handler
133125
var uri = e.layer.properties.uri;
134-
L.popup({minWidth: 300, maxHeight: 50})
126+
L.popup()
135127
.setContent(`<b>URI</b>: <a href="${uri}">${uri}</a>`)
136128
.setLatLng(e.latlng)
137129
.openOn(map);

0 commit comments

Comments
 (0)