diff --git a/src/Controller/PublicController.php b/src/Controller/PublicController.php
index d2a771b..3746687 100644
--- a/src/Controller/PublicController.php
+++ b/src/Controller/PublicController.php
@@ -229,37 +229,35 @@ class PublicController extends AbstractController
// Récupérer les données POST
$request = Request::createFromGlobals();
+ $status = null;
+ $exception = false;
+ $exception_message = null;
+ $osm_kind = 'node';
// Vérifier si des données ont été soumises
if ($request->isMethod('POST')) {
$status = "non modifié";
-
- // Récupérer le type d'objet (node ou way)
$osm_kind = $request->request->get('osm_kind', 'node');
-
// Récupérer tous les tags du formulaire
$tags = [];
-
$request_post = $request->request->all();
-
$request_post = $this->motocultrice->map_post_values($request_post);
-
foreach ($request_post as $key => $value) {
if (strpos($key, 'commerce_tag_value__') === 0) {
$tagKey = str_replace('commerce_tag_value__', '', $key);
if (!empty($value)) {
-
$tags[$tagKey] = trim($value);
}
}
}
-
- var_dump($tags);
+ var_dump('POST brut', $_POST);
+ var_dump('request->request->all()', $request->request->all());
+ var_dump('tags extraits', $tags);
+ // DEBUG : enlever ce die après analyse
+ die('DEBUG avant envoi OSM');
// Récupérer le token OSM depuis les variables d'environnement
$osm_api_token = $_ENV['APP_OSM_BEARER'];
- $exception = false;
- $exception_message = "";
try {
$client = new Client();
diff --git a/src/Service/FollowUpService.php b/src/Service/FollowUpService.php
index 4928a5e..f7a6c1b 100644
--- a/src/Service/FollowUpService.php
+++ b/src/Service/FollowUpService.php
@@ -66,6 +66,8 @@ class FollowUpService
$objects = array_filter($elements, fn($el) => ($el['tags']['natural'] ?? null) === 'tree') ?? [];
} elseif ($type === 'places') {
$objects = [];
+ } elseif ($type === 'power_pole') {
+ $objects = array_filter($elements, fn($el) => ($el['tags']['power'] ?? null) === 'pole') ?? [];
} else {
$objects = [];
}
@@ -195,6 +197,14 @@ class FollowUpService
|| !empty($tags['leaf_fall'] ?? null);
return $hasTaxonomy && $hasLeaf;
});
+ } elseif ($type === 'power_pole') {
+ $completed = array_filter($data['objects'], function($el) {
+ $tags = $el['tags'] ?? [];
+ return !empty($tags['ref'] ?? null)
+ || !empty($tags['material'] ?? null)
+ || !empty($tags['height'] ?? null)
+ || !empty($tags['operator'] ?? null);
+ });
}
if ($type === 'places') {
$completion = $stats->getCompletionPercent();
@@ -360,7 +370,8 @@ class FollowUpService
'street_lamp' => 'Lampadaires',
'drinking_water' => 'Eau potable',
'tree' => 'Arbres',
- 'places' => 'Lieux'
+ 'places' => 'Lieux',
+ 'power_pole' => 'Poteaux électriques',
];
}
@@ -388,7 +399,8 @@ class FollowUpService
'street_lamp' => 'bi-lightbulb',
'drinking_water' => 'bi-droplet-half',
'tree' => 'bi-tree',
- 'places' => 'bi-geo-alt'
+ 'places' => 'bi-geo-alt',
+ 'power_pole' => 'bi-signpost',
];
}
diff --git a/src/Service/Motocultrice.php b/src/Service/Motocultrice.php
index 6339a69..909e0d6 100644
--- a/src/Service/Motocultrice.php
+++ b/src/Service/Motocultrice.php
@@ -592,6 +592,7 @@ area["ref:INSEE"="$zone"]->.searchArea;
nwr["highway"="street_lamp"](area.searchArea);
nwr["amenity"="drinking_water"](area.searchArea);
nwr["natural"="tree"](area.searchArea);
+ nw["power"="pole"](area.searchArea);
);
(._;>;);
out meta;
diff --git a/templates/admin/stats.html.twig b/templates/admin/stats.html.twig
index 061668e..84bc607 100644
--- a/templates/admin/stats.html.twig
+++ b/templates/admin/stats.html.twig
@@ -485,7 +485,7 @@
center: geojsonData.features[0].geometry.coordinates,
zoom: 14
});
-
+ window.mapInstance = map;
map.on('load', function() {
map_is_loaded = true;
document.getElementById('maploader').style.display = 'none';
@@ -814,8 +814,10 @@ if(dc ){
document.addEventListener('DOMContentLoaded', function() {
const btn = document.getElementById('btn-geolocate');
btn && btn.addEventListener('click', function() {
+ console.log('[GEOLOC] Bouton cliqué');
if (!navigator.geolocation) {
alert('La géolocalisation n\'est pas supportée par ce navigateur.');
+ console.error('[GEOLOC] navigator.geolocation non supporté');
return;
}
btn.disabled = true;
@@ -823,7 +825,9 @@ if(dc ){
navigator.geolocation.getCurrentPosition(function(pos) {
const lat = pos.coords.latitude;
const lon = pos.coords.longitude;
+ console.log('[GEOLOC] Position obtenue', lat, lon);
// MapLibre
+ console.log('[GEOLOC] mapInstance', window.mapInstance);
if (window.mapInstance && typeof window.mapInstance.flyTo === 'function') {
window.mapInstance.flyTo({center: [lon, lat], zoom: 15});
if (window._geoMarker) window.mapInstance.removeLayer('geo-marker');
@@ -840,15 +844,14 @@ if(dc ){
});
window._geoMarker = true;
window._geoMarkerSource = true;
- } else if (window.L && window.map) { // Leaflet
- window.map.setView([lat, lon], 15);
- if (window._geoMarker) window.map.removeLayer(window._geoMarker);
- window._geoMarker = window.L.marker([lat, lon], {icon: window.L.icon({iconUrl: 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/icons/geo-alt-fill.svg', iconSize: [32,32]})}).addTo(window.map);
+ } else {
+ console.error('[GEOLOC] mapInstance non défini ou flyTo non disponible', window.mapInstance);
}
btn.disabled = false;
btn.innerHTML = ' Me localiser';
}, function(err) {
alert('Impossible de vous localiser : ' + err.message);
+ console.error('[GEOLOC] Erreur de géolocalisation', err);
btn.disabled = false;
btn.innerHTML = ' Me localiser';
});