{"id":219,"date":"2019-12-22T00:47:00","date_gmt":"2019-12-22T00:47:00","guid":{"rendered":"https:\/\/cc-coeurdefrance.fr\/?page_id=219"},"modified":"2026-03-05T10:30:22","modified_gmt":"2026-03-05T10:30:22","slug":"roads","status":"publish","type":"page","link":"https:\/\/cc-coeurdefrance.fr\/en\/rubrique\/voirie-eclairage-et-reseaux\/voirie\/","title":{"rendered":"Roads of community interest"},"content":{"rendered":"\n<p>Les cr\u00e9ations, am\u00e9nagements et l\u2019entretien de la voirie intercommunale sont g\u00e9r\u00e9s par C\u0153ur de France.<\/p>\n\n\n\n<p>Voici les voies d&rsquo;int\u00e9r\u00eat communautaire g\u00e9r\u00e9s par Coeur de France : <\/p>\n\n\n        <style>\n          .idweb-wrap{height:90vh;border:1px solid #e6ece9;border-radius:12px;overflow:hidden;position:relative;}\n          .leaflet-container{font:inherit;}\n          .idweb-tooltip {\n            overflow-y:auto;\n            max-height: 85vh;       \n            position:absolute;\n            top:15vh;\n            left:10px;\n            background:rgba(255,255,255,0.9);\n            padding:2%;\n            border-radius:8px;\n            box-shadow:0 2px 6px rgba(0,0,0,.15);\n            z-index:999;max-width:450px;font-size:1.2rem;color:#333;}\n\n          .idweb-tooltip ul{margin:.5rem 0;padding-left:1rem;}\n          .idweb-tooltip li{margin-bottom:.25rem;line-height:1.3;list-style:none;}\n          .idweb-tooltip li::before { \n            content: \"\";\n            border-color: transparent #fba531;\n            border-style: solid;\n            border-width: 0.35em 0 0.35em 0.45em;\n            display: block;\n            height: 0;\n            width: 0;\n            left: -1em;\n            top: 0.9em;\n            position: relative;\n          }\n\n        <\/style>\n\n        <div class=\"idweb-wrap\">\n          <div id=\"idweb-map\" style=\"height:100%;\"><\/div>\n          <div class=\"idweb-tooltip\" id=\"idweb-info\">Chargement de la carte...<\/div>\n        <\/div>\n\n<script>\ndocument.addEventListener('DOMContentLoaded', () => {\n  const map = L.map('idweb-map').setView([46.69, 2.5], 9);\n\n  \/\/ \ud83d\uddfa\ufe0f Fond clair CartoDB\n  L.tileLayer('https:\/\/{s}.basemaps.cartocdn.com\/light_all\/{z}\/{x}\/{y}{r}.png', {\n    attribution: '&copy; OpenStreetMap | &copy; CartoDB'\n  }).addTo(map);\n\n  const tooltip = document.getElementById('idweb-info');\n  tooltip.dataset.locked = 'false'; \/\/ verrouillage initial\n\n  const voiesUrl = 'https:\/\/opendata.cc-coeurdefrance.fr\/api\/explore\/v2.1\/catalog\/datasets\/voies-d-interet-communautaires-de-la-communaute-de-communes-coeur-de-france\/records?limit=100&timezone=UTC';\n\n  const voiesLayer = L.layerGroup().addTo(map);\n  let voies = [];\n\n  \/\/ Map: commune -> Set de codes postaux vus dans les voies (si dispo)\n  const postalByCommune = {};\n  voies.forEach(v => {\n    const c = (v.commune || '').trim();\n    const cp = v.code_postal || v.cp || v.codePostal || null;\n    if (!c) return;\n    if (!postalByCommune[c]) postalByCommune[c] = new Set();\n    if (cp) postalByCommune[c].add(String(cp));\n  });\n\n  \/\/ Normalise pour comparaison stricte (sans accents, casse, espaces\/hyphens)\nfunction normalizeName(s) {\n  return (s || '')\n    .normalize('NFD').replace(\/[\\u0300-\\u036f]\/g, '') \/\/ accents\n    .toLowerCase()\n    .replace(\/[-\u2019']\/g, ' ')   \/\/ tirets\/apostrophes => espace\n    .replace(\/\\s+\/g, ' ')     \/\/ espaces multiples\n    .trim();\n}\n\n\n  \/\/ Distance de Levenshtein (fallback s\u00e9lection du meilleur match)\nfunction levenshtein(a, b) {\n  if (a === b) return 0;\n  const m = [];\n  for (let i = 0; i <= b.length; i++) m[i] = [i];\n  for (let j = 0; j <= a.length; j++) m[0][j] = j;\n  for (let i = 1; i <= b.length; i++) {\n    for (let j = 1; j <= a.length; j++) {\n      m[i][j] = Math.min(\n        m[i-1][j] + 1,\n        m[i][j-1] + 1,\n        m[i-1][j-1] + (b.charAt(i-1) === a.charAt(j-1) ? 0 : 1)\n      );\n    }\n  }\n  return m[b.length][a.length];\n}\n\n\n  \/\/ \ud83d\udd39 Charger les voies\n  fetch(voiesUrl)\n    .then(r => r.json())\n    .then(data => {\n      voies = data.results || [];\n      tooltip.innerHTML = `Voies charg\u00e9es (${voies.length})... Chargement des communes...`;\n\n      const communesUniques = [...new Set(voies.map(v => v.commune).filter(Boolean))];\n      const groupCommunes = L.featureGroup().addTo(map);\n\n      communesUniques.forEach((nom) => {\n  const url = `https:\/\/geo.api.gouv.fr\/communes?nom=${encodeURIComponent(nom)}&codeDepartement=18&fields=code,nom,centre,contour,bbox,surface,mairie,codesPostaux,codeDepartement&boost=population&limit=10`;\n\n        fetch(url)\n          .then(r => r.json())\n          .then(res => {\n            if (!Array.isArray(res) || res.length === 0) return;\n\n            const target = normalizeName(nom);\n            const cps = postalByCommune[nom] ? Array.from(postalByCommune[nom]) : [];\n\n            let matches = res.filter(c => normalizeName(c.nom) === target);\n            if (cps.length && matches.length > 1) {\n              matches = matches.filter(c => {\n                const list = c.codesPostaux || [];\n                return list.some(cp => cps.includes(String(cp)));\n              });\n            }\n\n            const c = matches[0];\n            if (!c || !c.contour) return;\n\n\n            const bounds = L.latLngBounds(); \n\n            const communePoly = L.geoJSON(c.contour, {\n              style: { color:'#3c8054', weight:1.2, fillColor:'#E8F4EF', fillOpacity:0.4 }\n            }).addTo(map);\n\n            \/\/ \u2795 ajouter la commune au groupe\n            groupCommunes.addLayer(communePoly);\n\n            bounds.extend(communePoly.getBounds()); \/\/ \u2705 \u00e9tend les limites globales\n            map.fitBounds(bounds, { padding: [40, 40] });\n            map.setZoom(map.getZoom() + 1); \/\/ \u2705 for\u00e7age du zoom plus serr\u00e9\n\n            communePoly.on('mouseover', () => {\n              if (tooltip.dataset.locked === 'true') return;\n              communePoly.setStyle({ fillOpacity:0.7 });\n              afficherVoiesPourCommune(c.nom, c.codesPostaux || [], c);\n            });\n\n            communePoly.on('click', () => {\n              if (tooltip.dataset.locked === 'true') {\n                tooltip.dataset.locked = 'false';\n                tooltip.innerHTML = 'Survolez une commune pour afficher ses voiries...';\n                voiesLayer.clearLayers();\n                communePoly.setStyle({ fillOpacity:0.4 });\n              } else {\n                tooltip.dataset.locked = 'true';\n                communePoly.setStyle({ fillOpacity:0.8 });\n                afficherVoiesPourCommune(c.nom, c.codesPostaux, c, true);\n                if (Array.isArray(c.bbox) && c.bbox.length === 4) {\n                  const [minLon, minLat, maxLon, maxLat] = c.bbox;\n                  map.fitBounds([[minLat, minLon], [maxLat, maxLon]]);\n                }\n              }\n            });\n\n            communePoly.on('mouseout', (e) => {\n              \/\/ si on survole encore la m\u00eame commune (via une voie interne), on ignore\n              const target = e.relatedTarget;\n              if (tooltip.dataset.locked === 'true' || (target && target.feature && target.feature.properties && target.feature.properties.nom === c.nom)) return;\n\n              communePoly.setStyle({ fillOpacity:0.4 });\n              voiesLayer.clearLayers();\n              tooltip.innerHTML = \"Survolez une commune pour afficher ses voiries...\";\n            });\n\n          })\n          .catch(err => console.warn('Erreur commune', nom, err));\n      });\n\n\n    })\n    .catch(err => console.error('Erreur chargement voies:', err));\n\n  \/\/ \ud83d\udcac Affichage des voies\n  function afficherVoiesPourCommune(nomCommune, codesPostaux=[], meta=null, verrou=false) {\n    voiesLayer.clearLayers();\n    const matches = voies.filter(v => {\n      const nomMatch = v.commune && v.commune.toLowerCase() === nomCommune.toLowerCase();\n      const codeField = v.code_postal || v.cp || v.codePostal;\n      const codeMatch = codeField && codesPostaux.includes(codeField);\n      return nomMatch || codeMatch;\n    });\n\n    matches.forEach(v => {\n      if (!v.geometry) return;\n      L.geoJSON(v.geometry, { style: { color:'#fba531', weight:3 } })\n        .bindPopup(`<b>${v.nom || ''}<\/b><br>${v.commune || ''}`)\n        .addTo(voiesLayer);\n    });\n\n    let html = `<strong>Voiries d\u2019int\u00e9r\u00eat communautaire \u00e0 ${nomCommune}<\/strong><hr><ul>`;\n    if (matches.length === 0) {\n      html += `<li>Pas de voie r\u00e9pertori\u00e9e<\/li>`;\n    } else {\n      matches.forEach(v => {\n        html += `<li><b>${v.nom || '(sans nom)'}<\/b>`;\n        if (v.complement) html += ` <em>\u2013 ${v.complement}<\/em>`;\n        html += `<\/li>`;\n      });\n    }\n    html += `<\/ul>`;\n    html += verrou ? `<p><em>(Cliquez \u00e0 nouveau pour d\u00e9verrouiller)<\/em><\/p>` : '';\n    tooltip.innerHTML = html;\n  }\n});\n<\/script>\n\n        \n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Dans ce cadre, il est r\u00e9guli\u00e8rement proc\u00e9d\u00e9 \u00e0 la r\u00e9fection compl\u00e8te des voies fortement d\u00e9grad\u00e9es et devenues dangereuses. Ces travaux d\u2019ampleur sont l\u2019occasion de renouveler les canalisations d\u2019eaux, ou encore d\u2019enfouir les r\u00e9seaux \u00e9lectriques, d\u2019\u00e9clairage public et de t\u00e9l\u00e9communication, en partenariat avec les diff\u00e9rents concessionnaires.<\/p>\n\n\n\n<p>De plus, tout au long de l\u2019ann\u00e9e et plus particuli\u00e8rement \u00e0 l\u2019approche de la p\u00e9riode hivernale, une veille de l\u2019\u00e9tat de la voirie est effectu\u00e9e afin de rep\u00e9rer les zones sensibles et de faire les r\u00e9parations n\u00e9cessaires pour s\u00e9curiser la circulation des v\u00e9hicules et des pi\u00e9tons.<\/p>\n\n\n\n<p><strong><em>Derni\u00e8re r\u00e9alisation de travaux de voirie<\/em> <\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Voie d&rsquo;acc\u00e8s ZA des Carmes<\/li>\n<\/ul>\n\n\n\n<p><strong>Pour contacter le service inh\u00e9rent, composez le : <\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f18556\" class=\"has-inline-color\">02 42 74 00 04<\/mark><\/strong><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Les cr\u00e9ations, am\u00e9nagements et l\u2019entretien de la voirie intercommunale sont g\u00e9r\u00e9s par C\u0153ur de France. Voici les voies d&rsquo;int\u00e9r\u00eat communautaire g\u00e9r\u00e9s par Coeur de France : Dans ce cadre, il est r\u00e9guli\u00e8rement proc\u00e9d\u00e9 \u00e0 la r\u00e9fection compl\u00e8te des voies fortement d\u00e9grad\u00e9es et devenues dangereuses. Ces travaux d\u2019ampleur sont l\u2019occasion de renouveler les canalisations d\u2019eaux, ou [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":11163,"parent":0,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","footnotes":""},"rubrique":[18],"class_list":["post-219","page","type-page","status-publish","has-post-thumbnail","hentry","rubrique-voirie-eclairage-et-reseaux"],"acf":[],"_links":{"self":[{"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/pages\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/comments?post=219"}],"version-history":[{"count":0,"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/pages\/219\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/media\/11163"}],"wp:attachment":[{"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/media?parent=219"}],"wp:term":[{"taxonomy":"rubrique","embeddable":true,"href":"https:\/\/cc-coeurdefrance.fr\/en\/wp-json\/wp\/v2\/rubrique?post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}