├── .gitignore ├── README ├── gtfs └── ADD GTFS FILES HERE ├── index.php ├── source ├── css │ └── main.css ├── gfx │ ├── false.png │ └── true.png ├── pages │ ├── checkForm.php │ ├── createTables.php │ ├── fillTables.php │ └── makeconfig.php └── sql │ ├── createSQL.php │ └── makeTables.php └── sql-connect.php /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | PHP GTFS MySQL IMPORT WITH GUI 2 | Author: Steffen Martinsen (steffen@steffenmedia.no - @kverdagshelt) 3 | 4 | This is a PHP "app" that reads files from a provided GTFS feed and puts the data into a MySQL table via a GUI (Graphical User Interface) that totally looks like the Wordpress setup (and should be just as easy to operate). 5 | This was originally written to fetch GTFS data for Kolumbus (www.kolumbus.no) GTFS feed, and might require some modification to work properly with other GTFS sets although it should detect most of it. 6 | 7 | USAGE: 8 | 1. Download/clone 9 | 2. Unzip GTFS zip and add all .txt files into the "gtfs" folder at the root of this repo. 10 | 3. Upload it, or run it locally with PHP and follow the on-screen guide. 11 | 12 | 13 | FILES (And stuff they do): 14 | 15 | - index.php 16 | contains some HTML and links to CSS to make the GUI looks slick and smooth. It also performs a check to see if the config file is created. If not, it includes a script that will help you create one. 17 | 18 | - sql-connect.php 19 | connects to your mysql database provided in the config file. If the config file does not exist, launch index.php to create it. 20 | 21 | - gtfs/ 22 | the gtfs folder contains the raw gtfs .txt files. by default it contains an empty file called ADD GTFS FILES HERE which is what one would except. Add the .txt files here! 23 | 24 | - source/gfx/ 25 | doesn't contain anything really. I thought i should provide some graphics but it wasn't necessary really :) 26 | 27 | - source/css/ 28 | contains one stylesheet to provide a somewhat simple graphical user interface. 29 | 30 | - source/pages/makeconfig.php 31 | is the file index php includes if no config file is provided. basically it helps you create a config file. 32 | 33 | - source/pages/checkForm.php 34 | checks if the provided data to the config file is correct. this only applies if you created the config file through makeconfig.php 35 | 36 | - source/pages/createTables.php 37 | displays a list to the user with the tables that are being created. 38 | 39 | - source/pages/fillTables.php 40 | displays a list of default gtfs files, and which of those is found. files that is found appears in green, while files thats missing appears in red. missing files are ignored while importing to mysql table. 41 | 42 | -source/sql/makeTables.php 43 | creates the sql skeleton of tables automatically to the desired/provided database. 44 | 45 | -source/sql/createSQL.php 46 | reads the files in the gtfs folder, and puts them into the mysql database. this might take some time. default allocated memory is 512M and it shouldn't timeout. might screw things up if you have large files and running php in safe_mode. 47 | 48 | // Steffen Martinsen Tuesday 07.02.2012 -------------------------------------------------------------------------------- /gtfs/ADD GTFS FILES HERE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/steffenz/php-gtfs-mysql/7b489443de7ff3901b161bce3418aa5bff08db88/gtfs/ADD GTFS FILES HERE -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |Everything seems to be going our way. Now we need to create the table skeleton for our MySQL schema/tables Hit the "Create tables" button to continue.
12 |