Browse Source

Ajoute le lien vers Pifometre

master
vincent 2 weeks ago
parent
commit
d1aeb6044e
2 changed files with 12 additions and 3 deletions
  1. +11
    -3
      assets/controllers/map_controller.js
  2. +1
    -0
      templates/macro.html.twig

+ 11
- 3
assets/controllers/map_controller.js View File

@ -178,9 +178,17 @@ export default class extends Controller {
window.open(url, '_blank'); window.open(url, '_blank');
} }
openInPifomap() {
const url = "https://bano.openstreetmap.fr/pifometre/pifomap.html?ratio=N#map="+this.mapInstance.getZoom()+"/"+this.mapInstance.getCenter().lat+"/"+this.mapInstance.getCenter().lng;
window.open(url, '_blank');
openInPifometre() {
const self = this, url1 = "https://nominatim.openstreetmap.org/reverse?format=json&lat="+this.mapInstance.getCenter().lat+"&lon="+this.mapInstance.getCenter().lng+"&zoom="+this.mapInstance.getZoom()+"&extratags=1";
fetch(url1).then(function (response) { return response.json(); }).then(function (json) {
const hasInsee = ((typeof json.extratags === 'undefined') || (json.extratags.hasOwnProperty('ref:INSEE')));
if (hasInsee) {
const url2 = "https://bano.openstreetmap.fr/pifometre/?insee="+json.extratags['ref:INSEE'];
window.open(url2, '_blank');
} else {
window.alert('Impossible de trouver le code INSEE de la commune…');
}
});
} }
openInGeohack() { openInGeohack() {


+ 1
- 0
templates/macro.html.twig View File

@ -57,6 +57,7 @@ Où :
<button class="btn btn-sm btn-link" data-action="map#openInOsm">OSM</button> <button class="btn btn-sm btn-link" data-action="map#openInOsm">OSM</button>
<button class="btn btn-sm btn-link" data-action="map#openInPanoramax">Panoramax</button> <button class="btn btn-sm btn-link" data-action="map#openInPanoramax">Panoramax</button>
<button class="btn btn-sm btn-link" data-action="map#openInPifomap">Pifomap</button> <button class="btn btn-sm btn-link" data-action="map#openInPifomap">Pifomap</button>
<button class="btn btn-sm btn-link" data-action="map#openInPifometre">Pifomètre</button>
<button class="btn btn-sm btn-link" data-action="map#openInGeohack">GeoHack</button> <button class="btn btn-sm btn-link" data-action="map#openInGeohack">GeoHack</button>
<button class="btn btn-sm btn-link" data-action="map#openInGeoportail">GéoPortail</button> <button class="btn btn-sm btn-link" data-action="map#openInGeoportail">GéoPortail</button>
<button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInMapillary">Mapillary</button> <button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInMapillary">Mapillary</button>


Loading…
Cancel
Save