Skip to content

derhuerst/naive-gtfs-routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

naive-gtfs-routing

A naive routing engine for GTFS data.

npm version build status ISC-licensed chat with me on Gitter support me on Patreon

Installing

Because this project is still a work in progress, you have to build the index by yourself.

git clone https://gtihub.com/derhuerst/naive-gtfs-routing.git
cd naive-gtfs-routing
npm install
npm run build

Usage

const computeJourneys = require('naive-gtfs-routing')

const stockholm = 'FLIXBUS:3978'
const oberstdorf = 'FLIXBUS:101'
const when = 1523037600 // 2018-04-06T18:00:00.000Z
const opt = {
	maxTransfers: 2,
	maxDuration: 2 * 24 * 60 * 60
}

const journeys = computeJourneys(stockholm, oberstdorf, when, opt)

for (let journey of journeys) {
	console.log({
		origin: journey.origin,
		departure: journey.departure,
		destination: journey.destination,
		arrival: journey.arrival,
		legs: journey.legs.map(l => l.tripId)
	})
}

Contributing

If you have a question or have difficulties using naive-gtfs-routing, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.