From e0b0ca48f2f4876989ebfc35bb88e399daaea35e Mon Sep 17 00:00:00 2001 From: didier amyot Date: Sun, 5 Jan 2025 13:26:23 -0500 Subject: [PATCH] Deleted old website --- static/index-d3.js | 51 ----------------------------------------- static/index-leaflet.js | 35 ---------------------------- static/index.html | 23 ------------------- 3 files changed, 109 deletions(-) delete mode 100644 static/index-d3.js delete mode 100644 static/index-leaflet.js delete mode 100644 static/index.html diff --git a/static/index-d3.js b/static/index-d3.js deleted file mode 100644 index 13b3b65..0000000 --- a/static/index-d3.js +++ /dev/null @@ -1,51 +0,0 @@ -import * as d3 from "https://cdn.jsdelivr.net/npm/d3@7/+esm"; - -function convertCsvRow(row) { - return { - relation_id: +row.relation_id, - points: JSON.parse(row.points), - }; -} - -const roads = await d3.csv("./data/pincourt.csv", convertCsvRow); - -const projection = d3 - .geoConicConformal() - .scale(100000) - .center([-73.983028645966, 45.37425995800737]); - -function drawRoad(context, road) { - if (!road || !road.points || road.points.length < 1) { - return context; - } - context.moveTo(...projection([road.points[0][0], road.points[0][1]])); - for (const datum of road.points) { - context.lineTo(...projection([datum[0], datum[1]])); - } - return context; -} - -const svg = d3 - .create("svg") - .attr("width", 975) - .attr("height", 610) - .attr("viewBox", [0, 0, 975, 610]) - .attr("style", "max-width: 100%; height: auto;"); - -svg - .append("g") - .attr("transform", "translate(610,20)") - .append("text") - .text("Some title"); - -svg - .selectAll("path") - .data(roads) - .join("path") - .attr("fill", "none") - .attr("stroke", "black") - .attr("stroke-linejoin", "round") - .attr("stroke-with", 2) - .attr("d", (road) => drawRoad(d3.path(), road).toString()); - -container.append(svg.node()); diff --git a/static/index-leaflet.js b/static/index-leaflet.js deleted file mode 100644 index c719932..0000000 --- a/static/index-leaflet.js +++ /dev/null @@ -1,35 +0,0 @@ -import leaflet from "https://esm.sh/leaflet@1.9.4"; -import * as d3 from "https://cdn.jsdelivr.net/npm/d3@7/+esm"; - -function convertCsvRow(row) { - return { - relation_id: +row.relation_id, - points: JSON.parse(row.points), - }; -} - -function getCenter(data) { - if (!data) { - return [51.505, -0.09]; // london - } - return data[0].points[0]; -} - -function addRoad(road, map) { - leaflet.polyline(road.points).addTo(map); -} - -function addRoads(roads, map) { - for (const road of roads) { - addRoad(road, map); - } -} - -const roads = await d3.csv("./data/montreal.csv", convertCsvRow); - -const map = leaflet.map("leaflet-map").setView(getCenter(roads), 13); - -leaflet - .tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", { maxZoom: 19 }) - .addTo(map); -addRoads(roads, map); diff --git a/static/index.html b/static/index.html deleted file mode 100644 index bd8c4c1..0000000 --- a/static/index.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - spacial-data-experiments - - - - - -
- -
- - - - -