2 Commits

Author SHA1 Message Date
  vincent 21645289fc Corrige les liens pifo* 2 months ago
  vincent f8539138de Corrige une coquille 2 months ago
3 changed files with 22 additions and 4 deletions
Split View
  1. +20
    -3
      assets/controllers/map_controller.js
  2. +1
    -1
      src/Form/TaskType.php
  3. +1
    -0
      templates/macro.html.twig

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

@ -178,12 +178,25 @@ export default class extends Controller {
window.open(url, '_blank');
}
openInPifomap() {
const self = this, url1 = "https://geo.api.gouv.fr/communes?lat="+this.mapInstance.getCenter().lat+"&lon="+this.mapInstance.getCenter().lng+"&fields=code,nom";
fetch(url1).then(function (response) { return response.json(); }).then(function (json) {
const hasInsee = (Array.isArray(json) && (json.length > 0) && json[0].hasOwnProperty('code'));
if (hasInsee) {
const url2 = "https://bano.openstreetmap.fr/pifometre/pifomap.html?insee="+json[0].code;
window.open(url2, '_blank');
} else {
window.alert('Impossible de trouver le code INSEE de la commune…');
}
});
}
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";
const self = this, url1 = "https://geo.api.gouv.fr/communes?lat="+this.mapInstance.getCenter().lat+"&lon="+this.mapInstance.getCenter().lng+"&fields=code,nom";
fetch(url1).then(function (response) { return response.json(); }).then(function (json) {
const hasInsee = ((typeof json.extratags === 'undefined') || (json.extratags.hasOwnProperty('ref:INSEE')));
const hasInsee = (Array.isArray(json) && (json.length > 0) && json[0].hasOwnProperty('code'));
if (hasInsee) {
const url2 = "https://bano.openstreetmap.fr/pifometre/?insee="+json.extratags['ref:INSEE'];
const url2 = "https://bano.openstreetmap.fr/pifometre/?insee="+json[0].code;
window.open(url2, '_blank');
} else {
window.alert('Impossible de trouver le code INSEE de la commune…');
@ -216,4 +229,8 @@ export default class extends Controller {
window.open(url, '_blank');
}
openInF4Map() {
const url = "https://demo.f4map.com/#lat="+this.mapInstance.getCenter().lat+"&lon="+this.mapInstance.getCenter().lng+"&zoom="+this.mapInstance.getZoom();
}
}

+ 1
- 1
src/Form/TaskType.php View File

@ -23,7 +23,7 @@ class TaskType extends AbstractType
'label' => 'GeoJSON',
'required' => false,
'help_html' => true,
'help' => 'Ce qu’il faut dessiner sur la carte au format <a href="https://fr.wikipedia.org/wiki/GeoJSON" target="_blank">GeoJSON</a> et mettre à disposition à l’export sous forme de <a href="https://fr.wikipedia.org/wiki/GPX_(format_de_fichier)" target="_blank">GPX</a> pour l’import dans JOSM. Outil pratique&nbsp;: <a href="ttps://geojson.io/" target="_blank">geojson.io</a>.',
'help' => 'Ce qu’il faut dessiner sur la carte au format <a href="https://fr.wikipedia.org/wiki/GeoJSON" target="_blank">GeoJSON</a> et mettre à disposition à l’export sous forme de <a href="https://fr.wikipedia.org/wiki/GPX_(format_de_fichier)" target="_blank">GPX</a> pour l’import dans JOSM. Outil pratique&nbsp;: <a href="https://geojson.io/" target="_blank">geojson.io</a>.',
])
->add('osm', TextareaType::class, [
'label' => 'OSM',


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

@ -60,6 +60,7 @@ Où :
<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#openInGeoportail">GéoPortail</button>
<button class="btn btn-sm btn-link" data-action="map#openInF4Map">F4Map</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#openInGoogleMaps">Google Maps</button>
<button class="btn btn-sm btn-link ça-pue-c’est-pas-libre" data-action="map#openInBing">Bing</button>


Loading…
Cancel
Save