minotor
Version:
A lightweight client-side transit routing library.
35 lines (34 loc) • 1.34 kB
TypeScript
import { Latitude, Longitude, Platform, SourceStopId, Stop, StopId, StopsMap } from '../stops/stops.js';
import { Maybe } from './utils.js';
export type GtfsLocationType = 0 | 1 | 2 | 3 | 4;
export type StopEntry = {
stop_id: SourceStopId;
stop_name: string;
stop_lat?: Latitude;
stop_lon?: Longitude;
location_type?: GtfsLocationType;
parent_station?: SourceStopId;
platform_code?: Platform;
};
type ParsedStop = Stop & {
parentSourceId?: SourceStopId;
};
export type ParsedStopsMap = Map<SourceStopId, ParsedStop>;
/**
* Parses the stops.txt file from a GTFS feed.
*
* @param stopsStream The readable stream containing the stops data.
* @return A mapping of stop IDs to corresponding stop details.
*/
export declare const parseStops: (stopsStream: NodeJS.ReadableStream, platformParser?: (stopEntry: StopEntry) => Maybe<Platform>) => Promise<ParsedStopsMap>;
/**
* Builds the final stop map indexed by internal IDs.
* Excludes all stops that do not have at least one valid stopId
* as a child, a parent, or being valid itself.
*
* @param parsedStops - The map of parsed stops.
* @param validStops - A set of valid stop IDs.
* @returns A map of stops indexed by internal IDs.
*/
export declare const indexStops: (parsedStops: ParsedStopsMap, validStops?: Set<StopId>) => StopsMap;
export {};