UNPKG

minotor

Version:

A lightweight client-side transit routing library.

29 lines (28 loc) 1.7 kB
import { StopId } from '../stops/stops.js'; import { RoutesAdjacency, ServiceRouteId, ServiceRoutesMap, StopsAdjacency } from '../timetable/timetable.js'; import { ServiceIds } from './services.js'; import { ParsedStopsMap } from './stops.js'; import { TransfersMap } from './transfers.js'; export type TripId = string; export type TripIdsMap = Map<TripId, ServiceRouteId>; export type GtfsPickupDropOffType = '' | 0 | 1 | 2 | 3; /** * Parses the trips.txt file from a GTFS feed * * @param tripsStream The readable stream containing the trips data. * @param serviceIds A mapping of service IDs to corresponding route IDs. * @param routeIds A mapping of route IDs to route details. * @returns A mapping of trip IDs to corresponding route IDs. */ export declare const parseTrips: (tripsStream: NodeJS.ReadableStream, serviceIds: ServiceIds, routeIds: ServiceRoutesMap) => Promise<TripIdsMap>; export declare const buildStopsAdjacencyStructure: (validStops: Set<StopId>, routes: RoutesAdjacency, transfersMap: TransfersMap) => StopsAdjacency; /** * Parses the stop_times.txt data from a GTFS feed. * * @param stopTimesStream The readable stream containing the stop times data. * @param stopsMap A map of parsed stops from the GTFS feed. * @param validTripIds A map of valid trip IDs to corresponding route IDs. * @param validStopIds A set of valid stop IDs. * @returns A mapping of route IDs to route details. The routes returned correspond to the set of trips from GTFS that share the same stop list. */ export declare const parseStopTimes: (stopTimesStream: NodeJS.ReadableStream, stopsMap: ParsedStopsMap, validTripIds: TripIdsMap, validStopIds: Set<StopId>) => Promise<RoutesAdjacency>;