geocode/templates/detail.html

119 lines
3.1 KiB
HTML
Raw Normal View History

2023-10-13 16:50:27 +01:00
{% extends "base.html" %}
{% block title %}Geocode to Commons{% endblock %}
{% block link %}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
{% endblock %}
{% block script %}
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<script>
var map = L.map('map').setView([{{ lat }}, {{ lon }}], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var marker = L.marker([{{ lat }} , {{ lon }}]).addTo(map);
{% if geojson %}
L.geoJSON({{ geojson | safe }}).addTo(map);
{% endif %}
</script>
{% endblock %}
{% block style %}
<style>
/*
#map {
width: 600px;
height: 600px;
}
*/
/* Styles for the map */
#map {
position: fixed; /* This keeps the map in place when the page is scrolled */
top: 0; /* Starting from the top edge of the browser window */
right: 0; /* Positioned on the right side */
width: 50%; /* Half the screen width */
height: 100%; /* Full height of the browser window */
}
#main {
width: 48%
}
{{ css | safe }}
</style>
{% endblock %}
2023-10-13 16:50:27 +01:00
{% block content %}
<div id="map"></div>
<div class="m-3" id="main">
2021-04-15 12:27:28 +01:00
<h1>Geocode coordinates to Commons Category</h1>
2019-08-18 15:56:53 +01:00
2023-11-25 13:58:13 +00:00
<p>
<a href="{{ url_for('index') }}">home</a>
|
<a href="{{ url_for('index', lat=lat, lon=lon) }}">visit endpoint</a>
2021-04-15 12:27:28 +01:00
| <a href="https://www.openstreetmap.org/#map=17/{{lat }}/{{ lon }}">view in OSM</a>
{% if result.commons_cat %}
| <a href="{{ result.commons_cat.url }}">Commons category</a>
{% endif %}
{% if result.wikidata %}
| <a href="https://www.wikidata.org/wiki/{{ result.wikidata }}">{{ result.wikidata }}</a>
{% endif %}
| <a href="{{ url_for('detail_page', lat=lat, lon=lon) }}">#</a>
</p>
2019-08-18 15:56:53 +01:00
2023-10-13 16:50:27 +01:00
<h4>API returns</h4>
<pre>{{ result | tojson(indent=2) }}</pre>
{% if result.wikidata %}
<p><strong>Wikidata item</strong>: <a href="https://www.wikidata.org/wiki/{{ result.wikidata }}">{{ result.wikidata }}</a></p>
{% endif %}
2019-08-18 15:56:53 +01:00
2021-04-15 12:27:28 +01:00
{% if result.commons_cat %}
2023-10-13 16:50:27 +01:00
<p><strong>Commons category</strong>: <a href="{{ result.commons_cat.url }}">{{result.commons_cat.title }}</a></p>
{% endif %}
{% if elements %}
<p>{{ elements.count() }} surrounding elements found</p>
{% else %}
<p>No elements found</p>
2021-04-15 12:27:28 +01:00
{% endif %}
2019-08-18 15:56:53 +01:00
{% if query %}
<p>Searching for Wikimedia Commons categories using this SPARQL query. <a href="https://query.wikidata.org/#{{ query | urlencode }}">Wikidata Query service</a></p>
<div>
{{ query | highlight_sparql | safe }}
</div>
{% endif %}
2019-08-18 15:56:53 +01:00
{% for element in elements %}
2021-04-15 12:27:28 +01:00
{% set tags = element.tags %}
2023-10-13 16:50:27 +01:00
<div class="rounded border border-4 p-1 my-2{% if element_id == element.osm_id %} bg-primary-subtle{% endif %}">
{% for key, value in element.tags.items() if not (key == "way_area" or "name:" in key or key.startswith("source")) %}
<div><strong>{{ key }}</strong>: {{ value }}</div>
{% endfor %}
</div>
2019-08-18 15:56:53 +01:00
{% endfor %}
2023-10-13 16:50:27 +01:00
</div>
{% endblock %}