brechtvdv / gtfs2arrdep

Transforms GTFS into JSON-LD stream of arrival/departures
MIT License
1 stars 0 forks source link

gtfs2arrdep

Transforms GTFS into a JSON-LD stream of arrival/departures.

This project is written in PHP and uses doctrine to load the GTFS files into a MySQL database.

Explanation of the data model of arrival and departure objects can be found here.

Requirements

* Composer
* MySQL
* PHP 5.4+

Install

We use the PHP package manager Composer. Make sure it's installed and then run from this directory:

composer install

Generating arrivals/departures

Step 1: Setup database configuration

Fill in your MySQL credentials inside db-config.php.

Step 2: Run database load script

scripts/init.sh path-to-gtfs.zip

Step 3: Run arrivals/departures generator script

php scripts/create_arrivals_and_departures.php [startDate] [endDate]

The format of date parameters must be 'YYYY-MM-DD'.

Note: optional parameters startDate and endDate only work when there are no calendars.

Step 4: Done

You can find arrivals-[agency_id].jsonldstream and departures-[agency_id].jsonldstream in dist folder.