PageSourceSearch

https://cartes.gouv.fr/explorer-les-cartes/assets/Plan-Drv8aA_-.js

js cartes.gouv.fr collected 2026-10-01 11:32:21 UTC 4,976 bytes, 1 lines download raw bytes

1import{_ as S,k as A,R as O,o as v,c as h,d as P,l as g,t as T,f as C,bA as $,a2 as R,ao as F,aK as N}from"./index-BbaUIIJA.js";import{P as G}from"./Patience-CFFJaRmf.js";const M="https://data.geopf.fr/wfs/ows",W="BDTOPO_V3",x="commune",k="application/json",I=async(r,l)=>{if(!r)throw new Error("Le code INSEE est requis pour récupérer les informations de la ville.");try{const t=await L(r);if(!t)throw new Error(`Aucune donnée trouvée pour la ville avec le code INSEE ${r}.`);return b(t)}catch(t){throw console.error("Erreur lors de la récupération des informations de la ville :",t),t}},L=async r=>{if(!r)throw new Error("Le code INSEE est requis pour récupérer les informations de la ville.");if(!/^\d{5}$/.test(r))throw new Error(`Code INSEE invalide : "${r}".`);const l=new URLSearchParams({request:"GetFeature",service:"WFS",version:"2.0.0",TypeNames:`${W}:${x}`,count:"1",CQL_FILTER:`code_insee='${r}'`,outputFormat:k,srsName:"EPSG:4326"}),t=`${M}?${l.toString()}`;try{const o=await fetch(t);if(!o.ok)throw new Error(`Erreur HTTP ${o.status} lors de la récupération des données WFS : ${o.statusText}`);return await o.json()}catch(o){throw console.error("Erreur lors de la récupération des données WFS :",o),o}},b=r=>{var l=typeof r=="string"?JSON.parse(r):r;if(!l||!l.features||l.features.length===0)throw new Error("Aucune donnée trouvée dans la réponse WFS pour la ville demandée.");var t=l.features[0]||{},o=t.properties||{},a=t.geometry||{},e={};if(e.id=o.cleabs||null,e.nom=o.nom_officiel||null,e.code_insee=o.code_insee||null,e.population=parseInt(o.population)||null,e.arrondissement=o.code_insee_de_l_arrondissement||null,e.departement=o.code_insee_du_departement||null,e.region=o.code_insee_de_la_region||null,o.capitale_d_etat===!0?e.statut="capitale_d_etat":o.chef_lieu_de_region===!0?e.statut="chef_lieu_de_region":o.chef_lieu_de_departement===!0?e.statut="chef_lieu_de_departement":o.chef_lieu_de_collectivite_terr===!0?e.statut="chef_lieu_de_collectivite_terr":o.chef_lieu_d_arrondissement===!0?e.statut="chef_lieu_d_arrondissement":e.statut="commune_simple",a&&a.coordinates){var s=[];if(a.type==="Polygon")s=a.coordinates;else if(a.type==="MultiPolygon")for(var n=0;n<a.coordinates.length;n++)s=s.concat(a.coordinates[n]);e.coordonnees=[];for(var p=0;p<s.length;p++){var f=s[p];if(Array.isArray(f))for(var i=0;i<f.length;i++){var c=f[i];!Array.isArray(c)||c.length<2||e.coordonnees.push([c[0],c[1]])}}}if(e.coordonnees&&e.coordonnees.length>0){var u=H(e.coordonnees);u?(e.enveloppe=u,e.centre=[(e.enveloppe.upperCorner[0]+e.enveloppe.lowerCorner[0])/2,(e.enveloppe.upperCorner[1]+e.enveloppe.lowerCorner[1])/2]):console.warn("Unable to calculate bounding box from coordinates for city: "+e.nom)}else console.warn("No coordinates available to calculate bounding box for city: "+e.nom);return e.slug=U(e.nom),e},H=r=>{if(!r||r.length===0)return null;var l=r[0][0],t=r[0][1],o=r[0][0],a=r[0][1];for(let e=1;e<r.length;e++){const s=r[e][0],n=r[e][1];s<l&&(l=s),s>o&&(o=s),n<t&&(t=n),n>a&&(a=n)}return{lowerCorner:[l,t],upperCorner:[o,a]}},U=r=>{r=r||"",r=r.replace(/^\s+|\s+$/g,""),r=r.toLowerCase();for(var l="ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;'",t="aaaaaeeeeeiiiiooooouuuunc-------",o=0,a=l.length;o<a;o++)r=r.replace(new RegExp(l.charAt(o),"g"),t.charAt(o));return r=r.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-"),r},Y={class:"plan-loading-view"},j={key:0,class:"plan-loading-label"},z={__name:"Plan",setup(r){const l=$(),t=R();let o=l.params.slug,a=[];Array.isArray(o)?a=o:typeof o=="string"&&(a=o.split("/"));let e=a[0],s=a[1],n={};const p=i=>{if(!i||i.length!==4)return 10;const c=[Math.max(320,window.innerWidth||1024),Math.max(320,window.innerHeight||768)],u=new F({projection:"EPSG:3857",minZoom:0,maxZoom:21}),d=N(i,"EPSG:4326","EPSG:3857");u.fit(d,{size:c,padding:[40,40,40,40],maxZoom:21});const _=u.getZoom();return Number.isFinite(_)?Math.round(_):10},f=()=>{const i=`${n.centre[0].toFixed(6)},${n.centre[1].toFixed(6)}`,c=[n.enveloppe.lowerCorner[0],n.enveloppe.lowerCorner[1],n.enveloppe.upperCorner[0],n.enveloppe.upperCorner[1]],u=p(c),d=["ORTHOIMAGERY.ORTHOPHOTOS$GEOPORTAIL:OGC:WMTS(1;1;1;0)","TN.RoadTransportNetwork.RoadLink$GEOPORTAIL:OGC:WMTS(2;1;1;0)","GEOGRAPHICALNAMES.NAMES$GEOPORTAIL:OGC:WMTS(3;1;1;0)"];var _=location.pathname.slice(-1),w=_==="/"?location.pathname.slice(0,-1):location.pathname,y=w.replace(/\/plan\/.*/,""),E=location.origin+y,m=`${E}?c=${i}&z=${Math.round(u)}`;return m+=`&l=${d.join(",")}`,m+"&permalink=yes"};return A(async()=>{var i=null;try{if(i=await I(e,s),!i)throw new Error(`Informations de la ville ${s} non trouvées !`)}catch(u){console.error(u),t.replace({path:"/"});return}if(n=i,n&&Object.keys(n).length>0){var c=f();await t.replace({path:"/",state:{cityinfo:n}}),O(c)}}),(i,c)=>(v(),h("div",Y,[P(G),g(s)?(v(),h("p",j," Chargement du plan : "+T(g(s)),1)):C("",!0)]))}},V=S(z,[["__scopeId","data-v-dffd4b44"]]);export{V as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.