add overpass query and josm

This commit is contained in:
Tykayn 2025-06-29 17:23:54 +02:00 committed by tykayn
parent 0cdb2f9ae9
commit afc120ef2a
4 changed files with 108 additions and 2 deletions

View file

@ -19,11 +19,34 @@
'defibrillator': 'Défibrillateurs',
'camera': 'Caméras de surveillance',
'recycling': 'Points de recyclage',
'substation': 'Sous-stations électriques'
'substation': 'Sous-stations électriques',
'laboratory': "Laboratoires d'analyse",
'school': 'Écoles'
} %}
{% for type in type_labels|keys %}
<h2 id="title-{{ type }}">{{ type_labels[type] }}</h2>
<canvas id="{{ type }}Chart" width="600" height="300"></canvas>
<div class="mb-3">
{% set overpass_queries = {
'fire_hydrant': 'nwr["emergency"="fire_hydrant"](area.searchArea);',
'charging_station': 'nwr["amenity"="charging_station"](area.searchArea);',
'toilets': 'nwr["amenity"="toilets"](area.searchArea);',
'bus_stop': 'nwr["highway"="bus_stop"](area.searchArea);',
'defibrillator': 'nwr["emergency"="defibrillator"](area.searchArea);',
'camera': 'nwr["man_made"="surveillance"](area.searchArea);',
'recycling': 'nwr["amenity"="recycling"](area.searchArea);',
'substation': 'nwr["power"="substation"](area.searchArea);',
'laboratory': 'nwr["healthcare"="laboratory"](area.searchArea);',
'school': 'nwr["amenity"="school"](area.searchArea);'
} %}
{% set overpass_query = '[out:json][timeout:60];\narea["ref:INSEE"="' ~ stats.zone ~ '"]->.searchArea;\n(' ~ overpass_queries[type]|default('') ~ ');\n\n(._;>;);\n\nout meta;\n>;' %}
<a href="https://overpass-turbo.eu/?Q={{ overpass_query|url_encode }}" target="_blank" class="btn btn-sm btn-outline-primary me-2">
<i class="bi bi-geo"></i> Voir sur Overpass Turbo
</a>
<a href="http://127.0.0.1:8111/import?url=https://overpass-api.de/api/interpreter?data={{ overpass_query|url_encode }}" target="_blank" class="btn btn-sm btn-outline-success">
<i class="bi bi-box-arrow-in-up-right"></i> Ouvrir dans JOSM
</a>
</div>
{% endfor %}
<h2 class="mt-4">Données brutes</h2>
<table class="table table-bordered table-striped">
@ -66,7 +89,9 @@
defibrillator: 'Défibrillateurs',
camera: 'Caméras de surveillance',
recycling: 'Points de recyclage',
substation: 'Sous-stations électriques'
substation: 'Sous-stations électriques',
laboratory: "Laboratoires d'analyse",
school: 'Écoles'
};
function formatDelta(val) {
if (val === null) return '-';