diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index c05f443..805755b 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -8,6 +8,9 @@ const linesUrl = "https://data.grandlyon.com/geoserver/sytral/ows?SERVICE=WFS&VERSION=2.0.0&request=GetFeature&typename=sytral:tcl_sytral.tcllignemf_2_0_0&outputFormat=application/json&SRSNAME=EPSG:4171&sortBy=gid"; + let distance = +Infinity; + $: points = 5000 * Math.exp(-distance / 750); + onMount(async () => { const L = (await import("leaflet")).default; @@ -43,16 +46,28 @@ }); } - const marker = L.marker([centerLat, centerLon]); - map.on("click", (e) => marker.setLatLng(e.latlng).addTo(map)); + const marker = L.marker([0, 0]); + map.on("click", (e) => { + marker.setLatLng(e.latlng).addTo(map); + // allow 20m of error + distance = Math.max(0, e.latlng.distanceTo([45.75388713, 4.84715287]) - 20); + }); }); +
+ distance: {distance}, points: {points} +
+