Skip to content

Commit 84f4412

Browse files
authored
HTML: set clear opacity if collection has a map (#2226)
1 parent 41011f1 commit 84f4412

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

pygeoapi/templates/collections/collection.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,23 @@ <h3>{% trans %}Storage CRS{% endtrans %}</h3>
147147
}
148148
));
149149

150-
{# if this collection has a map representation, add it to the map #}
151-
{% for link in data['links'] %}
152-
{% if link['rel'] == 'http://www.opengis.net/def/rel/ogc/1.0/map' and link['href'] %}
153-
L.imageOverlay.ogcapi("{{ data['base_url'] }}", {collection: "{{ data['id'] }}", "opacity": .7, "transparent": true}).addTo(map);
154-
{% endif %}
155-
{% endfor %}
156-
157150
var bbox_layer = L.polygon([
158151
['{{ data['extent']['spatial']['bbox'][0][1] }}', '{{ data['extent']['spatial']['bbox'][0][0] }}'],
159152
['{{ data['extent']['spatial']['bbox'][0][3] }}', '{{ data['extent']['spatial']['bbox'][0][0] }}'],
160153
['{{ data['extent']['spatial']['bbox'][0][3] }}', '{{ data['extent']['spatial']['bbox'][0][2] }}'],
161154
['{{ data['extent']['spatial']['bbox'][0][1] }}', '{{ data['extent']['spatial']['bbox'][0][2] }}']
162155
]);
163156

157+
{# if this collection has a map representation, add it to the map #}
158+
{% for link in data['links'] %}
159+
{% if link['rel'] == 'http://www.opengis.net/def/rel/ogc/1.0/map' and link['href'] %}
160+
L.imageOverlay.ogcapi("{{ data['base_url'] }}", {collection: "{{ data['id'] }}", "opacity": .7, "transparent": true}).addTo(map);
161+
bbox_layer.setStyle({
162+
fillOpacity: 0
163+
});
164+
{% endif %}
165+
{% endfor %}
166+
164167
map.addLayer(bbox_layer);
165168
map.fitBounds(bbox_layer.getBounds(), {maxZoom: 10});
166169

0 commit comments

Comments
 (0)