Choropleth of the 80 Thurgau municipalities from the road vehicle stock dataset (djs-stv-17): vehicles per 1000 inhabitants by vehicle group or share of a car brand among passenger cars, with year controls and a municipality panel. Population comes from sk-stat-56, outlines from swisstopo swissBOUNDARIES3D. Also fixes the broken ENV line in the Dockerfile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.4 KiB
C#
35 lines
1.4 KiB
C#
using Schaad.OpenData.Vehicles.Analysis;
|
|
using Schaad.OpenData.Vehicles.Storage;
|
|
|
|
namespace Schaad.OpenData.Server.Vehicles;
|
|
|
|
public static class VehicleEndpoints
|
|
{
|
|
public static IEndpointRouteBuilder MapVehicleEndpoints(this IEndpointRouteBuilder endpoints)
|
|
{
|
|
var group = endpoints.MapGroup("/api/vehicles");
|
|
|
|
group.MapGet("/meta", (VehicleDataStore store) =>
|
|
{
|
|
var snapshot = store.Current;
|
|
var overview = VehicleAnalysis.BuildOverview(snapshot);
|
|
return new VehicleMetaResponse(
|
|
"Strassenfahrzeugbestand nach Fahrzeuggruppe, Fahrzeugart, Marke und Politischer Gemeinde ab 2023",
|
|
"Strassenverkehrsamt Kanton Thurgau (data.tg.ch / opendata.swiss)",
|
|
"https://opendata.swiss/de/dataset/strassenfahrzeugbestand-nach-fahrzeuggruppe-fahrzeugart-marke-und-politischer-gemeinde-ab-2023",
|
|
"CC BY 4.0",
|
|
"https://data.tg.ch/explore/dataset/sk-stat-56/",
|
|
overview.Years,
|
|
overview.Groups,
|
|
overview.Types,
|
|
overview.Brands,
|
|
snapshot.LastRefresh);
|
|
});
|
|
|
|
group.MapGet("/years", (VehicleDataStore store) => VehicleAnalysis.BuildYears(store.Current));
|
|
|
|
group.MapGet("/municipalities", (VehicleDataStore store) => VehicleAnalysis.BuildShapes(store.Current));
|
|
|
|
return endpoints;
|
|
}
|
|
}
|