- Thurgau hourly traffic counts (data.tg.ch) refreshed every 6 h into a per-day JSON cache - Road geometry per station direction from swisstopo swissTLM3D; roundabout arms run outward from the roundabout centre - Leaflet map with animated vehicles by class, time controls and base map switcher (grey, colour, aerial) - Station panel with per-class counts and Chart.js charts - Start page with map tiles; traffic map at /verkehr/thurgau - Dockerfile and docker-compose, xUnit tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Claudio Schaad <c.schaad@pog.ch> Co-committed-by: Claudio Schaad <c.schaad@pog.ch>
30 lines
908 B
C#
30 lines
908 B
C#
using Schaad.OpenData.Traffic.Models;
|
|
|
|
namespace Schaad.OpenData.Server.Traffic;
|
|
|
|
public sealed record StationResponse(
|
|
int Code,
|
|
string Name,
|
|
string Municipality,
|
|
string Address,
|
|
string Road,
|
|
double Lat,
|
|
double Lon,
|
|
bool FollowsRoad,
|
|
IReadOnlyList<DirectionResponse> Directions)
|
|
{
|
|
public static StationResponse From(Station station, StationGeometry? geometry) => new(
|
|
station.Code,
|
|
station.Name,
|
|
station.Municipality,
|
|
station.Address,
|
|
station.Road,
|
|
station.Location.Lat,
|
|
station.Location.Lon,
|
|
geometry?.FollowsRoad ?? false,
|
|
station.Directions
|
|
.Select(direction => new DirectionResponse(
|
|
direction,
|
|
geometry?.Directions.FirstOrDefault(d => d.Direction == direction)?.Path.Select(p => new[] { p.Lat, p.Lon }).ToList() ?? []))
|
|
.ToList());
|
|
}
|