95 lines
3.2 KiB
HTML
95 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<base target="_top">
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title>Quick Start - Leaflet</title>
|
|
|
|
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
|
|
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.1/dist/leaflet.css" integrity="sha256-sA+zWATbFveLLNqWO2gtiw3HL/lh1giY/Inf1BJ0z14=" crossorigin=""/>
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css" crossorigin=""/>
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css" crossorigin=""/>
|
|
<script src="https://unpkg.com/leaflet@1.9.1/dist/leaflet.js" integrity="sha256-NDI0K41gVbWqfkkaHj15IzU7PtMoelkzyKp8TOaFQ3s=" crossorigin=""></script>
|
|
<script src="https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster.js" crossorigin=""></script>
|
|
<script src="./leaflet.permalink.js"></script>
|
|
<style>
|
|
html, body {
|
|
height: 100%;
|
|
margin: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
|
|
|
|
<div id="map" style="width: 100%; height: 100%;"></div>
|
|
<script type="module">
|
|
var mappos = L.Permalink.getMapLocation();
|
|
var map = L.map('map').setView(mappos.center || [46.55886, 3.21924], mappos.zoom || 6);
|
|
L.Permalink.setup(map);
|
|
|
|
var tiles = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
|
|
maxZoom: 19,
|
|
subdomains: 'abcd',
|
|
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
|
}).addTo(map);
|
|
|
|
const columns = {
|
|
finessET: 0,
|
|
name: 1,
|
|
name_long: 2,
|
|
dep: 3,
|
|
adresse: 4,
|
|
tel: 5,
|
|
siret: 6,
|
|
x: 7,
|
|
y: 8,
|
|
}
|
|
|
|
async function getDataP4Pillon() {
|
|
const data = await fetch('./data_p4pillon.json')
|
|
return data.json()
|
|
}
|
|
async function getData() {
|
|
const data = await fetch('./data.json')
|
|
return data.json()
|
|
}
|
|
function getPopup(msp, dataP4Pillon) {
|
|
console.log(dataP4Pillon)
|
|
|
|
const nom = dataP4Pillon ? dataP4Pillon[0] : (msp[columns.name_long] ? msp[columns.name_long] : msp[columns.name])
|
|
const dep = msp[columns.dep]
|
|
const adresse = msp[columns.adresse]
|
|
|
|
return nom + " (" + dep + ")" +
|
|
"<br>Établissement FINESS N°" + msp[columns.finessET] +
|
|
(msp[columns.siret] != null ? "<br>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>" : "") +
|
|
(msp[columns.tel] != null ? "<br><a href='tel:" + msp[columns.tel] + "'>" + msp[columns.tel] + "</a>" : "") +
|
|
(dataP4Pillon ? "<br>" +
|
|
(dataP4Pillon[1] || dataP4Pillon[2] ? "<br>Leader : " + dataP4Pillon[1] + " " + dataP4Pillon[2] : "") +
|
|
(dataP4Pillon[3] ? "<br>Adhérent à l'association AVEC Santé : ✅" : "") +
|
|
(dataP4Pillon[4] ? "<br>Accord conventionnel interprofessionnel : ✅" : "")
|
|
: "")
|
|
}
|
|
|
|
var data = await getData()
|
|
var dataP4Pillon = await getDataP4Pillon()
|
|
var markersCluster = new L.MarkerClusterGroup();
|
|
|
|
for (const msp of data) {
|
|
const marker = L
|
|
.marker([msp[columns.x], msp[columns.y]])
|
|
.bindPopup(
|
|
getPopup(msp, dataP4Pillon[msp[columns.finessET]])
|
|
);
|
|
markersCluster.addLayer(marker);
|
|
}
|
|
map.addLayer(markersCluster);
|
|
</script>
|
|
</body>
|
|
</html>
|