{% include "header.html" %}

<nav aria-label="breadcrumb">
  <ol class="breadcrumb bg-light">
    {% for crumb in crumbs %}
      {% if not loop.last %}
    <li class="breadcrumb-item"><a href="{{ crumb.url }}/">{{ crumb.part }}</a></li>
      {% else %}<li class="breadcrumb-item active" aria-current="page">{{ crumb.part }}</li>
      {% endif %}
    {% endfor %}

    <li class="ml-auto json-link"><a target="_blank" href="{{ url }}?f=geojson">GeoJSON</a></li>
  </ol>
</nav>

<h1>Collection Item: {{ response.id }}</h1>

<div class="row">
  <div class="col-sm">
    <h2>Properties</h2>
    <ul>
      <li><strong>ID:</strong> {{ response.id }}</li>
      {% for key, value in response.properties.items() %}
      <li><strong>{{ key }}:</strong> {{ value }}</li>
      {% endfor %}
    </ul>
  </div>
  <div class="col-sm">
    <div id="map" class="rounded" style="width:100%;height:400px;">Loading...</div>
  </div>
</div>

<script>
  var geojson = {{ response|tojson }};
  var map = L.map('map').setView([0, 0], 1);
  map.addLayer(new L.TileLayer(
    'https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
      maxZoom: 18,
      attribution: 'Map data &copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
    }
  ));
  var features = L.geoJSON(geojson).addTo(map);
  map.fitBounds(features.getBounds());
</script>

{% include "footer.html" %}
