mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 09:38:54 +00:00
feat(map): draw transit journeys along their real rail and bus alignments
MOTIS leg geometry (encoded polylines) now travels through the proxy and is stored per leg, so both map renderers draw the journey along the actual tracks instead of a straight line: colored cores in each line's GTFS color over a white casing, walks as dotted grey connectors. Transit journeys are always visible on the map — they are part of the plan itself, not an opt-in overlay — and the day route already anchors to their stations, so the journey slots into the route computation end to end. Entries saved before this keep the straight-line fallback. Also: stronger dashes on the walk dividers, notes open rendered (preview tab) when present, and MOTIS's START/END placeholders are replaced with the places the user actually picked.
This commit is contained in:
@@ -129,6 +129,9 @@ export interface TransitLeg {
|
||||
lineTextColor: string | null;
|
||||
agency: string | null;
|
||||
intermediateStops: number;
|
||||
/** Encoded polyline of the leg's real path (Google encoding) + its precision. */
|
||||
geometry: string | null;
|
||||
geometryPrecision: number;
|
||||
}
|
||||
|
||||
export interface TransitItinerary {
|
||||
@@ -216,6 +219,7 @@ export async function plan(q: PlanQuery): Promise<{ itineraries: TransitItinerar
|
||||
routeShortName?: string; displayName?: string; routeColor?: string; routeTextColor?: string;
|
||||
agencyName?: string; from?: MotisPlaceRaw; to?: MotisPlaceRaw;
|
||||
intermediateStops?: unknown[];
|
||||
legGeometry?: { points?: string; precision?: number };
|
||||
}>;
|
||||
}>;
|
||||
};
|
||||
@@ -234,6 +238,8 @@ export async function plan(q: PlanQuery): Promise<{ itineraries: TransitItinerar
|
||||
lineTextColor: safeColor(leg.routeTextColor),
|
||||
agency: leg.agencyName || null,
|
||||
intermediateStops: Array.isArray(leg.intermediateStops) ? leg.intermediateStops.length : 0,
|
||||
geometry: leg.legGeometry?.points || null,
|
||||
geometryPrecision: leg.legGeometry?.precision ?? 6,
|
||||
}));
|
||||
const walkSeconds = legs.filter((l) => l.mode === 'WALK').reduce((a, l) => a + l.duration, 0);
|
||||
return [{
|
||||
|
||||
Reference in New Issue
Block a user