feat: Ajout des scripts d'import

This commit is contained in:
2023-02-15 15:38:11 +01:00
parent 471b194408
commit a6a7e50ab9
12 changed files with 378 additions and 6 deletions

View File

@ -38,13 +38,29 @@
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var json = fetch('./finess-small.json').then(response => {
const columns = {
finessET: 0,
name: 1,
dep: 2,
tel: 3,
siret: 4,
x: 5,
y: 6,
}
var json = fetch('./data.json').then(response => {
return response.json();
})
.then(jsondata => {
var markersCluster = new L.MarkerClusterGroup();
for (const msp of jsondata) {
const marker = L.marker([msp[5], msp[6]]).bindPopup(msp[0] + "(" + msp[2] + ")<br><a href='tel:" + msp[3] + "'>" + msp[3] + "</a>");
const marker = L
.marker([msp[columns.x], msp[columns.y]])
.bindPopup(
msp[columns.name] + " (" + msp[columns.dep] + ")<br>" +
"Établissement FINESS N°" + msp[columns.finessET] + "<br>" +
(msp[columns.siret] != null ? "SIREN : <a rel='noreferrer' target='_blank' href='https://data.inpi.fr/entreprises/" + msp[columns.siret].substring(0, 9) + "'>" + msp[columns.siret].substring(0, 9) + "</a><br>" : "") +
(msp[columns.tel] != null ? "<a href='tel:" + msp[columns.tel] + "'>" + msp[columns.tel] + "</a>" : "")
);
markersCluster.addLayer(marker);
}
map.addLayer(markersCluster);