annuaire/layouts/index.html

72 lines
2.4 KiB
HTML
Raw Normal View History

2023-02-04 00:02:12 +01:00
<!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>
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: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
2023-02-15 15:38:11 +01:00
const columns = {
finessET: 0,
name: 1,
dep: 2,
tel: 3,
siret: 4,
x: 5,
y: 6,
}
var json = fetch('./data.json').then(response => {
2023-02-04 00:02:12 +01:00
return response.json();
})
.then(jsondata => {
var markersCluster = new L.MarkerClusterGroup();
for (const msp of jsondata) {
2023-02-15 15:38:11 +01:00
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>" : "")
);
2023-02-04 00:02:12 +01:00
markersCluster.addLayer(marker);
}
map.addLayer(markersCluster);
});
</script>
</body>
</html>