s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
34 lines • 1.03 kB
JavaScript
import { parseCSVAsRecord } from '../../';
/**
* # Route Networks
*
* **Conditionally Forbidden**
* Assigns routes (`routes.route_id`) to networks (`networks.network_id`).
* This file is forbidden if `network_id` exists in `routes.txt`. Otherwise, it is optional.
*/
export class GTFSRouteNetwork {
/**
* **Required**
* Identifies a network (`networks.network_id`) to which one or multiple routes belong.
*/
networkId;
/**
* **Required**
* Identifies a route (`routes.route_id`). One route can only belong to one network.
*/
routeId;
/** @param data - the parsed GTFS CSV data */
constructor(data) {
this.networkId = data.network_id;
this.routeId = data.route_id;
}
}
/**
* @param input - the input string to parse from
* @returns - an array of RouteNetworks
*/
export function parseGTFSRouteNetworks(input) {
const data = parseCSVAsRecord(input);
return data.map((d) => new GTFSRouteNetwork(d));
}
//# sourceMappingURL=routeNetworks.js.map