added search
This commit is contained in:
1 parent
0e51144845
commit
91788dd54b
11 files changed
+169
-73
No files matched your search
@@ -2,4 +2,5 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADateOnly_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F59b19d8d0febef2e46cc2ae2dcca54a3c6e6502577a6e8801e7135f52114bb_003FDateOnly_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADateOnly_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F59b19d8d0febef2e46cc2ae2dcca54a3c6e6502577a6e8801e7135f52114bb_003FDateOnly_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADuckDBConnection_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fca720d256d57636d0cbd88927a44051edc962673dfcd25a83faed8281bbbbf_003FDuckDBConnection_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADuckDBConnection_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fca720d256d57636d0cbd88927a44051edc962673dfcd25a83faed8281bbbbf_003FDuckDBConnection_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHtmlHelperLinkExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F412c687beff81665b9b9ee44dc9149afceb65f88c961c3eba363c7842d0dd16_003FHtmlHelperLinkExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHtmlHelperLinkExtensions_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F412c687beff81665b9b9ee44dc9149afceb65f88c961c3eba363c7842d0dd16_003FHtmlHelperLinkExtensions_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APreparedStatement_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fffd344cbd5cc1f5fef5696203b407f02e6f9de97f33525589fa9b50d45db9_003FPreparedStatement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStream_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ff713d72a8fc43d6d19e7a01d4aa26cb4ae7d2c2def906c81da92c0ace94e3e_003FStream_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStream_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Ff713d72a8fc43d6d19e7a01d4aa26cb4ae7d2c2def906c81da92c0ace94e3e_003FStream_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>
|
||||||
@@ -7,7 +7,9 @@ namespace YongeStreet.Controllers;
|
|||||||
|
|
||||||
public record CityModel(string City, IList<CityRoadLengthStats> CityRoadLengthStats, DateOnly Date);
|
public record CityModel(string City, IList<CityRoadLengthStats> CityRoadLengthStats, DateOnly Date);
|
||||||
|
|
||||||
public record IndexModel(IList<CityOverview> Cities);
|
public record IndexModel(List<CityOverview> Cities);
|
||||||
|
|
||||||
|
public record TmpModel(IList<string> Cities);
|
||||||
|
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
@@ -33,6 +35,12 @@ public class HomeController : Controller
|
|||||||
return View(new IndexModel(cities));
|
return View(new IndexModel(cities));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IActionResult CityList_Partial(string? search)
|
||||||
|
{
|
||||||
|
var cities = _dataService.GetCityOverview(search??"");
|
||||||
|
return View(new IndexModel(cities));
|
||||||
|
}
|
||||||
|
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using DuckDB.NET.Data;
|
using DuckDB.NET.Data;
|
||||||
|
using FuzzierSharp;
|
||||||
|
|
||||||
namespace YongeStreet.Services;
|
namespace YongeStreet.Services;
|
||||||
|
|
||||||
@@ -10,15 +11,27 @@ public record CityRoadLengthStats(string Name, double MunicipalRoadLength, DateO
|
|||||||
|
|
||||||
public class DataService
|
public class DataService
|
||||||
{
|
{
|
||||||
private static readonly List<string> CITY_STREET_HIGHWAY = ["primary",
|
private static readonly List<string> CITY_STREET_HIGHWAY =
|
||||||
|
[
|
||||||
|
"primary",
|
||||||
"primary_link",
|
"primary_link",
|
||||||
"secondary",
|
"secondary",
|
||||||
"secondary_link",
|
"secondary_link",
|
||||||
"tertiary",
|
"tertiary",
|
||||||
"tertiary_link",
|
"tertiary_link",
|
||||||
"residential",
|
"residential",
|
||||||
"unclassified"];
|
"unclassified"
|
||||||
private readonly string path = System.Environment.GetEnvironmentVariable("PREPROCESSED_DUCKDB_FILE") ?? "/home/didier/all-dressed-programming/YongeStreet/real.duckdb";
|
];
|
||||||
|
|
||||||
|
private readonly ILogger<DataService> _logger;
|
||||||
|
|
||||||
|
private readonly string path = Environment.GetEnvironmentVariable("PREPROCESSED_DUCKDB_FILE") ??
|
||||||
|
"/home/didier/all-dressed-programming/YongeStreet/real.duckdb";
|
||||||
|
|
||||||
|
public DataService(ILogger<DataService> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
public IList<Road> GetRoads(string city, DateOnly extractDate)
|
public IList<Road> GetRoads(string city, DateOnly extractDate)
|
||||||
{
|
{
|
||||||
@@ -48,20 +61,20 @@ public class DataService
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<CityOverview> GetCityOverview()
|
public List<CityOverview> GetCityOverview()
|
||||||
{
|
{
|
||||||
using var duckDBConnection = new DuckDBConnection($"Data Source={path};ACCESS_MODE=READ_ONLY");
|
using var duckDBConnection = new DuckDBConnection($"Data Source={path};ACCESS_MODE=READ_ONLY");
|
||||||
duckDBConnection.Open();
|
duckDBConnection.Open();
|
||||||
|
|
||||||
using var command = duckDBConnection.CreateCommand();
|
using var command = duckDBConnection.CreateCommand();
|
||||||
command.CommandText = """
|
command.CommandText = """
|
||||||
SELECT city_name,
|
WITH raw AS (SELECT city_name,
|
||||||
SUM(length) FILTER (list_contains($allowed_highway, highway) AND extract_date = (Date '2025-01-01')) AS length,
|
SUM(length) FILTER (list_contains($allowed_highway, highway) AND extract_date = (Date '2025-01-01')) AS length,
|
||||||
LIST(DISTINCT extract_date) AS available_years
|
LIST(DISTINCT extract_date) AS available_years
|
||||||
FROM city_road
|
FROM city_road
|
||||||
GROUP BY city_name
|
GROUP BY city_name
|
||||||
ORDER BY length desc
|
ORDER BY length desc)
|
||||||
LIMIT 100
|
SELECT * FROM raw WHERE length > 1000
|
||||||
""";
|
""";
|
||||||
command.Parameters.Add(new DuckDBParameter("allowed_highway", CITY_STREET_HIGHWAY));
|
command.Parameters.Add(new DuckDBParameter("allowed_highway", CITY_STREET_HIGHWAY));
|
||||||
using var reader = command.ExecuteReader();
|
using var reader = command.ExecuteReader();
|
||||||
@@ -74,7 +87,36 @@ public class DataService
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> GetAllCityNames()
|
||||||
|
{
|
||||||
|
using var duckDBConnection = new DuckDBConnection($"Data Source={path};ACCESS_MODE=READ_ONLY");
|
||||||
|
duckDBConnection.Open();
|
||||||
|
|
||||||
|
using var command = duckDBConnection.CreateCommand();
|
||||||
|
command.CommandText = "SELECT DISTINCT city_name FROM city_road";
|
||||||
|
using var reader = command.ExecuteReader();
|
||||||
|
|
||||||
|
var ret = new List<string>();
|
||||||
|
while (reader.Read()) ret.Add(reader.GetString(0));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CityOverview> GetCityOverview(string search)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("Seeking " + search);
|
||||||
|
if (search == "") return GetCityOverview().Take(20).ToList();
|
||||||
|
|
||||||
|
var cityNames = GetAllCityNames();
|
||||||
|
var foundCityNames = Process.ExtractSorted(search, cityNames);
|
||||||
|
return (
|
||||||
|
from cityName in foundCityNames
|
||||||
|
join city in GetCityOverview() on cityName.Value equals city.Name
|
||||||
|
orderby cityName.Score descending
|
||||||
|
select city
|
||||||
|
).Take(20).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public IList<CityRoadLengthStats> GetCityRoadLengthStats(string city)
|
public IList<CityRoadLengthStats> GetCityRoadLengthStats(string city)
|
||||||
{
|
{
|
||||||
using var duckDBConnection = new DuckDBConnection($"Data Source={path};ACCESS_MODE=READ_ONLY");
|
using var duckDBConnection = new DuckDBConnection($"Data Source={path};ACCESS_MODE=READ_ONLY");
|
||||||
@@ -95,15 +137,10 @@ public class DataService
|
|||||||
|
|
||||||
var ret = new List<CityRoadLengthStats>();
|
var ret = new List<CityRoadLengthStats>();
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
ret.Add(new CityRoadLengthStats(city,
|
||||||
ret.Add(new CityRoadLengthStats(city,
|
reader.GetInt32(0),
|
||||||
reader.GetInt32(0),
|
|
||||||
reader.GetFieldValue<DateOnly>(1)));
|
reader.GetFieldValue<DateOnly>(1)));
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,8 @@
|
|||||||
<div class="uk-height-large uk-flex uk-flex-center uk-flex-middle uk-background-cover uk-light"
|
<div class="uk-height-large uk-flex uk-flex-center uk-flex-middle uk-background-cover uk-light"
|
||||||
style=""
|
style=""
|
||||||
id="leaflet-map"
|
id="leaflet-map"
|
||||||
data-city="@Model.City">
|
data-city="@Model.City"
|
||||||
|
data-date="@Model.Date.ToString("yyyy-MM-dd")">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="uk-table uk-table-striped">
|
<table class="uk-table uk-table-striped">
|
||||||
@@ -50,4 +51,6 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script src="~/js/quebec-province-map.js" type="module"></script>
|
<script src="~/js/quebec-province-map.js" type="module"></script>
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
@model YongeStreet.Controllers.IndexModel
|
||||||
|
|
||||||
|
@{
|
||||||
|
Layout = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@foreach(var city in Model.Cities)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@Html.ActionLink(city.Name, "City", "Home", new {City=city.Name})</td>
|
||||||
|
<td>@((city.TotalStreetSize / 1000 ).ToString("N"))</td>
|
||||||
|
<td>@string.Join(", ", city.AvailableDates)</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
@@ -6,6 +6,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Le Québec possède un reseau routier impréssionant.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="uk-form-horizontal uk-margin-large">
|
||||||
|
<div class="uk-margin">
|
||||||
|
<label class="uk-form-label" for="city-name">Nom de Ville</label>
|
||||||
|
<div class="uk-form-controls">
|
||||||
|
<input class="uk-input" id="city-name" type="text" name="search" placeholder="Rimouski" hx-get="/Home/CityList_Partial"
|
||||||
|
hx-trigger="keyup changed delay:500ms"
|
||||||
|
hx-target="#city-table-body"
|
||||||
|
hx-swap="innerHTML">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="uk-table uk-table-striped">
|
<table class="uk-table uk-table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -15,16 +31,10 @@
|
|||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody id="city-table-body"
|
||||||
@foreach(var city in Model.Cities)
|
hx-get="/Home/CityList_Partial"
|
||||||
{
|
hx-trigger="load"
|
||||||
<tr>
|
hx-target="#city-table-body"
|
||||||
<td>@Html.ActionLink(city.Name, "City", "Home", new {City=city.Name})</td>
|
hx-swap="innerHTML">
|
||||||
<td>@((city.TotalStreetSize / 1000 ).ToString("N"))</td>
|
|
||||||
<td>@string.Join(", ", city.AvailableDates)</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -14,38 +14,23 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
@* <nav class="uk-navbar-container"> *@
|
|
||||||
@* <div class="uk-container"> *@
|
|
||||||
@* <div uk-navbar> *@
|
|
||||||
@* *@
|
|
||||||
@* <div class="uk-navbar-left"> *@
|
|
||||||
@* *@
|
|
||||||
@* <a class="uk-navbar-item uk-logo" href="/" aria-label="Back to Home"> *@
|
|
||||||
@* <img src="~/images/logo.jpg" *@
|
|
||||||
@* alt="" *@
|
|
||||||
@* style="height: 1.7em;"/> *@
|
|
||||||
@* *@
|
|
||||||
@* </a> *@
|
|
||||||
@* *@
|
|
||||||
@* <ul class="uk-navbar-nav"> *@
|
|
||||||
@* <span class="uk-icon uk-margin-small-right" uk-icon="icon: star"> *@
|
|
||||||
@* L'Insoutenable Longeur Du Réseau Routier *@
|
|
||||||
@* </span> *@
|
|
||||||
@* </ul> *@
|
|
||||||
@* </div> *@
|
|
||||||
@* *@
|
|
||||||
@* </div> *@
|
|
||||||
@* </div> *@
|
|
||||||
@* </nav> *@
|
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<div class="uk-container">
|
<div class="uk-container">
|
||||||
|
|
||||||
@RenderBody()
|
@RenderBody()
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
<footer>
|
||||||
|
source: <a href="https://gitlab.com/all-dressed-programming/yongestreet">https://gitlab.com/all-dressed-programming/yongestreet</a>
|
||||||
|
</footer>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
@await RenderSectionAsync("Scripts", required: false)
|
@await RenderSectionAsync("Scripts", required: false)
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DuckDB.NET.Data.Full" Version="1.1.3" />
|
<PackageReference Include="DuckDB.NET.Data.Full" Version="1.1.3" />
|
||||||
|
<PackageReference Include="FuzzierSharp" Version="3.0.1" />
|
||||||
<PackageReference Include="Htmx" Version="1.8.1" />
|
<PackageReference Include="Htmx" Version="1.8.1" />
|
||||||
<PackageReference Include="Htmx.TagHelpers" Version="1.8.1" />
|
<PackageReference Include="Htmx.TagHelpers" Version="1.8.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
import leaflet from "https://esm.sh/leaflet@1.9.4";
|
import leaflet from "https://esm.sh/leaflet@1.9.4";
|
||||||
import * as chartjs from "https://esm.sh/chart.js@4.4.7";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const london = [51.505, -0.09];
|
const london = [51.505, -0.09];
|
||||||
const centerOfTheWorld = london;
|
const centerOfTheWorld = london;
|
||||||
|
|
||||||
function findBaryCenter(points){
|
function findBaryCenter(points) {
|
||||||
let lat = 0;
|
let lat = 0;
|
||||||
let lon = 0;
|
let lon = 0;
|
||||||
for (const point of points){
|
for (const point of points) {
|
||||||
lat += point[0];
|
lat += point[0];
|
||||||
lon += point[1];
|
lon += point[1];
|
||||||
}
|
}
|
||||||
return [lat / points.length, lon / points.length]
|
return [lat / points.length, lon / points.length]
|
||||||
}
|
}
|
||||||
@@ -19,7 +16,7 @@ function findBaryCenter(points){
|
|||||||
function getCenter(data) {
|
function getCenter(data) {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return centerOfTheWorld;
|
return centerOfTheWorld;
|
||||||
}
|
}
|
||||||
// good enough estimation
|
// good enough estimation
|
||||||
return findBaryCenter(data.map(road => findBaryCenter(road.points)));
|
return findBaryCenter(data.map(road => findBaryCenter(road.points)));
|
||||||
}
|
}
|
||||||
@@ -34,34 +31,37 @@ function addRoads(roads, map) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getActiveCity(){
|
function getActiveCity() {
|
||||||
const elm = document.getElementById("leaflet-map");
|
const elm = document.getElementById("leaflet-map");
|
||||||
return elm.getAttribute('data-city');
|
return elm.getAttribute('data-city');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUrl(city){
|
function getActiveDate() {
|
||||||
const params = {city: city}
|
const elm = document.getElementById("leaflet-map");
|
||||||
|
return elm.getAttribute('data-date') ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUrl(city, date) {
|
||||||
|
const params = {city: city}
|
||||||
|
if (date.trim() !== "") {
|
||||||
|
params.date = date;
|
||||||
|
}
|
||||||
return `/api/roads?${new URLSearchParams(params).toString()}`
|
return `/api/roads?${new URLSearchParams(params).toString()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function renderLeafletMap(city, date) {
|
||||||
|
const resp = await fetch(getUrl(city, date));
|
||||||
|
|
||||||
async function renderLeafletMap(city){
|
|
||||||
const resp = await fetch(getUrl(city));
|
|
||||||
const roads = await resp.json();
|
const roads = await resp.json();
|
||||||
|
|
||||||
const map = leaflet.map("leaflet-map").setView(getCenter(roads), 13);
|
const map = leaflet.map("leaflet-map").setView(getCenter(roads), 13);
|
||||||
|
|
||||||
leaflet
|
leaflet
|
||||||
.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", { maxZoom: 19 })
|
.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {maxZoom: 19})
|
||||||
.addTo(map);
|
.addTo(map);
|
||||||
addRoads(roads, map);
|
addRoads(roads, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const activeCity = getActiveCity();
|
const activeCity = getActiveCity();
|
||||||
await Promise.all([renderLeafletMap(activeCity)])
|
const activeDate = getActiveDate();
|
||||||
|
await Promise.all([renderLeafletMap(activeCity, activeDate)])
|
||||||
|
|
||||||
@@ -106,6 +106,30 @@
|
|||||||
geofabrik-base-url =
|
geofabrik-base-url =
|
||||||
"${static-server-url}/download.geofabrik.de/north-america/canada/";
|
"${static-server-url}/download.geofabrik.de/north-america/canada/";
|
||||||
|
|
||||||
|
osm-quebec."2015" = pkgs.fetchurl {
|
||||||
|
url = "${geofabrik-base-url}quebec-150101.osm.pbf";
|
||||||
|
hash = "sha256-nRZxVuiKUosqTDaI2fx8VCBuAp/l8ie1krUrsen4Jh4=";
|
||||||
|
};
|
||||||
|
|
||||||
|
osm-quebec."2016" = pkgs.fetchurl {
|
||||||
|
url = "${geofabrik-base-url}quebec-160101.osm.pbf";
|
||||||
|
hash = "sha256-OMdII4R1+iEDT9tc1m8JG+Ed9UKMapaf37ceX0O91DM=";
|
||||||
|
};
|
||||||
|
|
||||||
|
osm-quebec."2017" = pkgs.fetchurl {
|
||||||
|
url = "${geofabrik-base-url}quebec-170101.osm.pbf";
|
||||||
|
hash = "sha256-9OdzfrV2KaG2z1NJAAVJ0FzqoU/K+Lp50hlFc8nHfNs=";
|
||||||
|
};
|
||||||
|
|
||||||
|
osm-quebec."2018" = pkgs.fetchurl {
|
||||||
|
url = "${geofabrik-base-url}quebec-180101.osm.pbf";
|
||||||
|
hash = "sha256-Qa1a7HtEkvmnirzn6sSekidPTxUr2ObGv/LxY5+cZu8=";
|
||||||
|
};
|
||||||
|
|
||||||
|
osm-quebec."2019" = pkgs.fetchurl {
|
||||||
|
url = "${geofabrik-base-url}quebec-190101.osm.pbf";
|
||||||
|
hash = "sha256-iquV6nXJaRmb05SOX0X9NjqGRO404AXLEug3xtypEVE=";
|
||||||
|
};
|
||||||
osm-quebec."2020" = pkgs.fetchurl {
|
osm-quebec."2020" = pkgs.fetchurl {
|
||||||
url = "${geofabrik-base-url}quebec-200101.osm.pbf";
|
url = "${geofabrik-base-url}quebec-200101.osm.pbf";
|
||||||
hash = "sha256-RYoz4Qo/xwiEVBoA4xRHHpt8kvNS/mHskJBmR4+3vQk=";
|
hash = "sha256-RYoz4Qo/xwiEVBoA4xRHHpt8kvNS/mHskJBmR4+3vQk=";
|
||||||
@@ -155,6 +179,11 @@
|
|||||||
buildPhase = "";
|
buildPhase = "";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
ln -s ${data-dir osm-quebec."2015"} $out/2015
|
||||||
|
ln -s ${data-dir osm-quebec."2016"} $out/2016
|
||||||
|
ln -s ${data-dir osm-quebec."2017"} $out/2017
|
||||||
|
ln -s ${data-dir osm-quebec."2018"} $out/2018
|
||||||
|
ln -s ${data-dir osm-quebec."2019"} $out/2019
|
||||||
ln -s ${data-dir osm-quebec."2020"} $out/2020
|
ln -s ${data-dir osm-quebec."2020"} $out/2020
|
||||||
ln -s ${data-dir osm-quebec."2021"} $out/2021
|
ln -s ${data-dir osm-quebec."2021"} $out/2021
|
||||||
ln -s ${data-dir osm-quebec."2022"} $out/2022
|
ln -s ${data-dir osm-quebec."2022"} $out/2022
|
||||||
@@ -169,6 +198,11 @@
|
|||||||
hash = "sha256-jZEkKg/D3MOVWprVGmsc/ev2fY6TVcN3tD3NH23B2h4=";
|
hash = "sha256-jZEkKg/D3MOVWprVGmsc/ev2fY6TVcN3tD3NH23B2h4=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
# to create the ./nuget-deps.nix file, run the below
|
||||||
|
# two comments
|
||||||
|
# $ dotnet restore --packages out
|
||||||
|
# $ nuget-to-nix out > nuget-deps.nix
|
||||||
web-server = pkgs.buildDotnetModule {
|
web-server = pkgs.buildDotnetModule {
|
||||||
pname = "YongeStreet";
|
pname = "YongeStreet";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
(fetchNuGet { pname = "coverlet.collector"; version = "6.0.0"; hash = "sha256-IEmweTMapcPhFHpmJsPXfmMhravYOrWupgjeOvMmQ4o="; })
|
(fetchNuGet { pname = "coverlet.collector"; version = "6.0.0"; hash = "sha256-IEmweTMapcPhFHpmJsPXfmMhravYOrWupgjeOvMmQ4o="; })
|
||||||
(fetchNuGet { pname = "DuckDB.NET.Bindings.Full"; version = "1.1.3"; hash = "sha256-OVmnUwydfBHmAvsjDoWH8x4p5AvIgXl4rC1E6d7Wdw8="; })
|
(fetchNuGet { pname = "DuckDB.NET.Bindings.Full"; version = "1.1.3"; hash = "sha256-OVmnUwydfBHmAvsjDoWH8x4p5AvIgXl4rC1E6d7Wdw8="; })
|
||||||
(fetchNuGet { pname = "DuckDB.NET.Data.Full"; version = "1.1.3"; hash = "sha256-CRBYs/bickkngbDzQbbYUu3yLtJiWS66QxeO1lm8CXY="; })
|
(fetchNuGet { pname = "DuckDB.NET.Data.Full"; version = "1.1.3"; hash = "sha256-CRBYs/bickkngbDzQbbYUu3yLtJiWS66QxeO1lm8CXY="; })
|
||||||
|
(fetchNuGet { pname = "FuzzierSharp"; version = "3.0.1"; hash = "sha256-XO88548BCBI9rIDFpyMBd2ohgdhVnVoQlNLJeifCjYU="; })
|
||||||
(fetchNuGet { pname = "Htmx"; version = "1.8.1"; hash = "sha256-kzCnFpbYjh/C1Q49Vhzap6hKPSdi0fldjCtgDVPm4XM="; })
|
(fetchNuGet { pname = "Htmx"; version = "1.8.1"; hash = "sha256-kzCnFpbYjh/C1Q49Vhzap6hKPSdi0fldjCtgDVPm4XM="; })
|
||||||
(fetchNuGet { pname = "Htmx.TagHelpers"; version = "1.8.1"; hash = "sha256-Vy6qoqoN91OuxeMLZUtJ5itfryxerqdZLNVOgvQBcls="; })
|
(fetchNuGet { pname = "Htmx.TagHelpers"; version = "1.8.1"; hash = "sha256-Vy6qoqoN91OuxeMLZUtJ5itfryxerqdZLNVOgvQBcls="; })
|
||||||
(fetchNuGet { pname = "Microsoft.CodeCoverage"; version = "17.8.0"; hash = "sha256-cv/wAXfTNS+RWEsHWNKqRDHC7LOQSSdFJ1a9cZuSfJw="; })
|
(fetchNuGet { pname = "Microsoft.CodeCoverage"; version = "17.8.0"; hash = "sha256-cv/wAXfTNS+RWEsHWNKqRDHC7LOQSSdFJ1a9cZuSfJw="; })
|
||||||
|
|||||||
Reference in new issue
Block a user