OpenDataVisualizer/client/src/traffic/vehicleClasses.ts
Claudio Schaad 7b65926aa2 Add Thurgau traffic visualizer and start page (#1)
- 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>
2026-11-06 20:17:26 +00:00

41 lines
1.4 KiB
TypeScript

export type VehicleGroup = 'car' | 'motorcycle' | 'van' | 'truck' | 'bus';
export interface VehicleClassInfo {
label: string;
group: VehicleGroup;
}
export const VEHICLE_CLASSES: VehicleClassInfo[] = [
{ label: 'Bus/Car', group: 'bus' },
{ label: 'Motorrad', group: 'motorcycle' },
{ label: 'Personenwagen', group: 'car' },
{ label: 'PW mit Anhänger', group: 'car' },
{ label: 'Lieferwagen', group: 'van' },
{ label: 'Lieferwagen mit Anhänger', group: 'van' },
{ label: 'Lieferwagen mit Auflieger', group: 'van' },
{ label: 'Lastwagen', group: 'truck' },
{ label: 'Lastenzug', group: 'truck' },
{ label: 'Sattelzug', group: 'truck' },
];
export interface VehicleGroupStyle {
label: string;
color: string;
radius: number;
}
export const VEHICLE_GROUPS: Record<VehicleGroup, VehicleGroupStyle> = {
car: { label: 'Personenwagen', color: '#2563eb', radius: 2.6 },
motorcycle: { label: 'Motorräder', color: '#0d9488', radius: 2 },
van: { label: 'Lieferwagen', color: '#16a34a', radius: 3 },
truck: { label: 'Lastwagen', color: '#ea580c', radius: 4 },
bus: { label: 'Busse', color: '#9333ea', radius: 4 },
};
export const GROUP_ORDER: VehicleGroup[] = ['car', 'van', 'truck', 'bus', 'motorcycle'];
export const DIRECTION_COLORS = ['#2563eb', '#ea580c'];
export function sumCounts(counts: number[] | null | undefined): number {
return counts ? counts.reduce((sum, value) => sum + value, 0) : 0;
}