s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
35 lines • 871 B
JavaScript
import { parseCSVAsRecord } from '../../';
/**
* # Areas
*
* **Optional**
* Defines area identifiers.
* Each record in `areas.txt` contains a unique `area_id` that can be referenced
* in `stop_areas.txt`.
*/
export class GTFSArea {
/**
* **Required**
* Identifies an area (`area_id`). Must be unique within `areas.txt`.
*/
areaId;
/**
* **Optional**
* Name of the area as displayed to the rider.
*/
areaName;
/** @param data - the parsed GTFS CSV data */
constructor(data) {
this.areaId = data.area_id;
this.areaName = data.area_name;
}
}
/**
* @param input - the input string to parse from
* @returns - an array of Areas
*/
export function parseGTFSAreas(input) {
const data = parseCSVAsRecord(input);
return data.map((d) => new GTFSArea(d));
}
//# sourceMappingURL=areas.js.map