Initial commit

This commit is contained in:
Edward Betts 2021-05-07 17:46:47 +02:00
commit c4aa27e8f4
14 changed files with 1172 additions and 0 deletions

24
templates/base.html Normal file
View file

@ -0,0 +1,24 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
{% block title %}{% endblock %} OSM ↔ Wikidata
</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css')}}">
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap4/css/bootstrap.css')}}">
<link rel="stylesheet" href="{{ url_for('static', filename='fork-awesome/css/fork-awesome.css')}}">
{% block style %}
{% endblock %}
</head>
<body>
<div class="container-fluid p-0">
{% block content %}{% endblock %}
</div>
{% block script %}{% endblock %}
</body>
</html>

View file

@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block title %}{% endblock %}
{% block content %}
<div class="container my-2">
</div>
{% endblock %}

View file

@ -0,0 +1,25 @@
{% extends "base.html" %}
{% block title %}{% endblock %}
{% block content %}
<div class="container my-2">
<table class="table">
{% for pid, osm_keys, label in property_map %}
<tr>
<td>
<a href="{{ url_for('identifier_page', pid=pid) }}">{{ label }}</a>
({{ pid }})
<a href="https://wikidata.org/wiki/Property:{{ pid }}" target="_blank">
<i class="fa fa-wikidata"></i>
<i class="fa fa-external-link-square"></i>
</a>
</td>
<td>{{ '/'.join(osm_keys) }}</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}

View file

@ -0,0 +1,29 @@
{% extends "base.html" %}
{% block title %}{% endblock %}
{% block content %}
<div class="container-fluid my-2">
<h1>{{ label }} ({{ pid }})</h1>
<p><a href="{{ url_for('identifier_index') }}">Back to identifier index</a></p>
<p>Total number of items: {{ total }}</p>
<p>OSM total: {{ osm_total }}</p>
<table class="table">
{% for item in items %}
<tr>
<td>{{ item.label() }} ({{ item.qid }})</td>
<td>{{ ' / '.join(item.get_claim(pid)) }}</td>
<td>
{% for point in osm_points[item.qid] %}
{{ point.identifier }}: {{ point.tags.name }}<br />
{% endfor %}
</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}

16
templates/index.html Normal file
View file

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block title %}{% endblock %}
{% block content %}
<div class="container-fluid my-2">
<h1>OSM/Wikidata</h1>
<ul>
<li><a href="{{ url_for('map_start_page') }}">map</a></li>
<li><a href="{{ url_for('search_map_page') }}">map with search</a></li>
<li><a href="{{ url_for('search_page') }}">search</a></li>
<li><a href="{{ url_for('identifier_index') }}">identifies</a></li>
</ul>
</div>
{% endblock %}

62
templates/map.html Normal file
View file

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Map showing Wikidata items linked to OSM</title>
<link rel="stylesheet" href="{{ url_for('static', filename='fork-awesome/css/fork-awesome.css')}}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/map.css') }}?time={{time}}" type="text/css" media="all" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.0/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin="anonymous" />
<link rel="stylesheet" href="{{ url_for('static', filename='Leaflet.ExtraMarkers/leaflet.extra-markers.min.css') }}" type="text/css" media="all" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
</head>
<body>
<div id="map"></div>
<div id="sidebar">
<div class="card bg-white" id="search-card">
<div class="card-body">
<form id="search-form">
<div>
<input id="search-text" placeholder="place">
<button type="submit" id="search-btn" class="btn btn-primary">search</button>
</div>
</form>
<div id="search-results">
</div>
</div>
</div>
<div class="card bg-white visually-hidden mt-3" id="isa-card">
<div class="card-body">
<div class="h5 card-title">item types</div>
<div id="isa-list">
</div>
</div>
</div>
</div>
<button id="load-btn" type="button" class="btn btn-primary btn-lg">
<span id="loading" class="visually-hidden">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
Loading ...
</span>
<span id="load-text">
Load Wikidata items
</span>
</button>
<script>
var start_lat = {{ lat | tojson }};
var start_lng = {{ lng | tojson }};
var zoom = {{ zoom | tojson }};
var bbox_list = {{ (bbox_list or []) | tojson }};
</script>
<script src="https://unpkg.com/axios@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
<script src="https://unpkg.com/leaflet@1.3.0/dist/leaflet.js" integrity="sha512-C7BBF9irt5R7hqbUm2uxtODlUVs+IsNu2UULGuZN7gM+k/mmeG4xvIEac01BtQa4YIkUpp23zZC4wIwuXaPMQA==" crossorigin="anonymous"></script>
<script type="text/javascript" src="{{ url_for('static', filename='Leaflet.ExtraMarkers/leaflet.extra-markers.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/map.js') }}?time={{time}}"></script>
</body>
</html>

62
templates/search.html Normal file
View file

@ -0,0 +1,62 @@
{% extends "base.html" %}
{% block title %}{% endblock %}
{% block style %}
<link rel="stylesheet" href="{{ url_for('static', filename='leaflet/leaflet.css') }}">
<style>
#map {
}
</style>
{% endblock %}
{% block script %}
<script src="https://unpkg.com/axios@latest"></script>
<script src="{{ url_for('static', filename='leaflet/leaflet.js') }}"></script>
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
<script>
bbox_list = {{ bbox_list | tojson }};
</script>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-2">
<form class="form-inline">
<input class="form-control m-2" name="q" value="{{ request.args.q or "" }}">
<button class="btn btn-primary m-2" type="submit">find</button>
</form>
{% if hits %}
{% for hit in hits %}
<div class="card">
<div class="card-body">
<p><a href="#" class="hit-link" id="hit-link-{{ loop.index0 }}" data-bounding-box="{{ hit.boundingbox }}">{{ hit.display_name }}</a></p>
<p>
{{ hit.category }}
{{ hit.osm_type }}
</p>
</div>
</div>
{% endfor %}
</div>
<div class="col-md-8">
<div id="map" class="w-100 vh-100">
</div>
</div>
<div class="col-md-2">
<p>Duration: <span id="duration"></span> seconds</p>
</div>
</div>
{% endif %}
</div>
{% endblock %}

51
templates/search_map.html Normal file
View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Map</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/map.css') }}" type="text/css" media="all" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.0/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin="anonymous" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
</head>
<body>
<div id="search">
<div class="p-3">
<h5>search</h5>
<div>
<form class="form-inline">
<input class="form-control m-2" name="q" value="{{ request.args.q or "" }}">
<button class="btn btn-primary m-2" type="submit">find</button>
</form>
{% if hits %}
{% for hit in hits %}
<div class="card mt-1">
<div class="card-body hit-card" id="hit-card-{{ loop.index0 }}">
<p><a href="#" class="hit-link" id="hit-link-{{ loop.index0 }}" data-bounding-box="{{ hit.boundingbox }}">{{ hit.display_name }}</a></p>
<p>
{{ hit.category }}
{{ hit.osm_type }}
</p>
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>
</div>
<div id="map"></div>
<script>
var user_lat = {{ user_lat | tojson }};
var user_lon = {{ user_lon | tojson }};
var bbox_list = {{ (bbox_list or []) | tojson }};
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
<script src="https://unpkg.com/leaflet@1.3.0/dist/leaflet.js" integrity="sha512-C7BBF9irt5R7hqbUm2uxtODlUVs+IsNu2UULGuZN7gM+k/mmeG4xvIEac01BtQa4YIkUpp23zZC4wIwuXaPMQA==" crossorigin="anonymous"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/search_map.js') }}"></script>
</body>
</html>