sri-lanka-transit-data
v0.1.0
Published
Sri Lanka inter-provincial bus routes and official NTC fares as typed, zero-dependency data for JavaScript and TypeScript.
Maintainers
Readme
sri-lanka-transit-data
Sri Lanka inter-provincial bus routes and official fares, as typed, zero-dependency data for JavaScript and TypeScript.
The dataset is extracted from the National Transport Commission (NTC) route-wise full bus fare publication by the open-source sri-lanka-transit-data data pipeline, and bundled here so any Node.js or browser-adjacent project can query it without scraping PDFs.
Unofficial community package. Data is compiled from official NTC publications and every record keeps its source URL, but this package is not published or endorsed by the NTC. Verify fares against the official source before relying on them commercially.
Install
npm install sri-lanka-transit-dataQuick start
import { getRouteByNumber, searchRoutes, getFare, dataset } from "sri-lanka-transit-data";
const route = getRouteByNumber("1");
route?.fares.normal; // 521 (full-route fare in LKR)
route?.fares.luxury; // 1018
getFare("1-1", "luxury"); // null: that class is not published for this route
dataset.recordCount; // 433
dataset.originCount; // 69
dataset.destinationCount; // 191Place names use the official source spelling (Sinhala), so search with the same spelling:
const matches = searchRoutes({ destination: route.destination });API
| Function | Returns |
|---|---|
| getAllRoutes() | All TransitRoute records |
| getRouteByNumber(routeNumber) | One route, or undefined |
| searchRoutes({ origin?, destination?, routeNumber? }) | Routes matching all given filters (substring, case-insensitive; route number exact) |
| getOrigins() / getDestinations() | Sorted distinct place names |
| getFare(routeNumber, serviceClass) | Fare in LKR, null if that class is not published, undefined if the route does not exist |
| dataset | Metadata: record counts, source name and source URLs |
serviceClass is one of "normal", "semiLuxury", "luxury".
Data notes
- 433 inter-provincial routes from the NTC fare publication linked as current in July 2026.
- Normal fare is published for all 433 routes; semi-luxury for 133 and luxury/AC for 97. Missing classes return
null, never a guess. - Fares are full-route fares in LKR. Stop-level and fare-stage data are not in this release.
- Every record carries
sourceNameandsourceUrlfor provenance.
Updating the data
The Python pipeline in the data repository is the source of truth. When the NTC publishes a new fare revision:
SLTD_REPO=/path/to/sri-lanka-transit-data npm run sync-data
npm test && npm run buildRoadmap
- Stop sequences and fare stages
- English place-name aliases alongside the official Sinhala spellings
- GTFS export in the data repository
Licence
Code: MIT. Data: compiled from official National Transport Commission publications; see the data repository's DATA_POLICY.md for the sourcing and personal-data rules applied during extraction.
