feat: add initial map with lines
This commit is contained in:
parent
45cc451f27
commit
50a12fe432
5 changed files with 1439 additions and 2 deletions
|
@ -1,2 +1,31 @@
|
|||
<h1>Welcome to SvelteKit</h1>
|
||||
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
||||
<script lang="ts">
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import lignes from './lignes.json';
|
||||
|
||||
import L from 'leaflet';
|
||||
|
||||
function createMap(node: HTMLElement) {
|
||||
const map = L.map(node).setView([45.76, 4.832], 13);
|
||||
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
|
||||
lignes.features.forEach((feature) => {
|
||||
const color = 'rgb(' + feature.properties.couleur.replaceAll(' ', ',') + ')';
|
||||
|
||||
// @ts-ignore
|
||||
L.geoJSON(feature, { style: { color } }).addTo(map);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="map" use:createMap></div>
|
||||
|
||||
<style>
|
||||
.map {
|
||||
height: 800px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
1
src/routes/+page.ts
Normal file
1
src/routes/+page.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export const ssr = false;
|
1403
src/routes/lignes.json
Normal file
1403
src/routes/lignes.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue