GTFS Offline

This is a small application that allows you to view bus stops and schedules in a general way. It is virtually* permissionless, flexible enough to handle most* GTFS feeds, and designed for power-users to have the control they want.

Details

GTFSOffline was forked from GRTransit, a well programmed application for the Grand River region bus system. Because of the standardization of the GTFS feed format, many transit initiatives across the country are releasing open routes in GTFS.

  1. This app requires a user to download a GTFS-compatible zip file and index it on a computer. The indexed SQLite database can then be transferred to the GTFS application directory (/sdcard/Android/data/com.wbrenna.gtfsoffline/files). To create the *.db index file, use the mksql3db.sh script from GTFS Offline Data in the unzipped GTFS file directory: ./mksql3db.sh someDBName.db *.txt.

  2. After creating the *.db file, you can manually put it in the right location, or you can gzip it, put it up on a webserver and download it on the phone regularly (where it will go to the Download folder) and then run "Scan Downloads Folder" from the app to unzip and move the file. For an example, visit one of the goo.gl/* links at gdrivefilelist.

  3. Use the Settings menu to choose from a list of databases to activate (Databases to monitor). Navigate to the tab of the database you want to view, and it will grab your location and return a set of the next few buses at the closest stops to you.

  4. A long press on any of these routes sets a favourite, and a tap on these routes will give you the bus route's full schedule for the day. The favourites tab contains stops you want to be able to see no matter where you are - you can remove stops from this tab by long pressing on them in the Favourites tab.

Some other details: the "show buses for all days" will just affect the schedule returned when you press on a bus route. Normally it will return all of the day's buses but if this preference is checked, it will show (and label) all times for that route. The "Search grid" option allows you to specify how far away the app looks for bus stops that have upcoming buses (you can set the future time length that the app will look for buses as well). If the app slows down you might want to shrink the search grid - this happens especially if you have databases activated for a number of different cities, or when it's late at night and there are few buses (it will keep sifting through stops until it finds active routes). Hopefully the other preferences are self explanatory!

Code

The full source code is available on GitHub at:

wbrenna/gtfsoffline

Note Permissions required are merely GPS coarse and fine location. No internet access or even permission to read or write to storage is required. However, the Play Store version and Master branch in Github do require the external storage permission for compatibility reasons. Use the minimalpermissions branch on Github if you'd like to avoid this permission. Some GTFS feeds will not work, because some transit agencies do not play by the rules when it comes to the GTFS specification. I suggest you berate them until they smarten up. Because of the no internet access requirement this app cannot get real-time updates. There are some other open source projects that have that functionality - see OpenTripPlanner for Android!