Skip to main content
Help us improve Python packaging – donate today!

General Transit Feed Specification (GTFS) as a Django app

Project Description

multigtfs: GTFS as a Django app
===============================

**multigtfs** is an `Apache 2.0`_-licensed Django app that supports importing
and exporting of GTFS feeds. All features of the `June 20, 2012 reference`_
are supported. It allows multiple feeds to be stored in the database at once.

It requires a spatial databases compatible with GeoDjango_. PostgreSQL_ 9.x
and PostGIS_ 2.x are recommended for development and production, since these
support all the GeoDjango features. There are issues with GeoDjango in
Django 1.4 (see issue `20036`_), so Django 1.5 or above is recommended.

Usage
-----

Installation
++++++++++++
1. ``pip install multigtfs``
2. In your settings, add ``multigtfs`` to your ``INSTALLED APPS`` and ensure
you have a spatial database configured.
3. ``./manage.py syncdb`` to install the tables, or ``./manage.py migrate`` if
you are using South_

Management Commands
+++++++++++++++++++
There are two management commands to get GTFS feeds in and out of the database:

::

./manage.py importgtfs [--name name_of_feed] path/to/gtfsfeed.zip
./manage.py exportgtfs [--name basename_of_file] <feed_id>

In Code
+++++++
multigtfs is composed of Django models that implement GTFS, plus helper
methods for importing and exporting to the GTFS format. Where GTFS relates
objects through IDs (such as Stop IDs for stops), multigtfs uses
ForeignKeys.

multigtfs includes a Feed object, which is not part of GTFS. This is used
to include several feeds in the same file without collisions. These can be
feeds from different agencies, or different versions of a feed from the same
agency. The object has a helper method, ``in_feed``, that is sometimes useful
in filtering objects by feed. At other times, it is easier to start at the
feed and follow relations.

There isn't separate documentation yet. Load the app in your Django project,
play with the admin, and read the source code to learn more.

Sample Project
++++++++++++++
The `examples/explore` sample project demonstrates a simple read-only website
for viewing one or more GTFS feeds. It include OpenLayers_ maps for viewing
the routes, trips, and shapes. You an use it as is, or as a starting place
for your own projects. See the project README for more information.

Project History
---------------
multigtfs was first developed for the `Tulsa Web Devs`_' project to get
Tulsa's buses into `Google Maps`_. `tulsa-transit-google`_ is the
Tulsa-specific portion, and multigtfs contains the parts useful for any
GTFS effort. `Tulsa's bus schedule appeared on
Google Maps in July 2013`_, after a two-year effort. The Tulsa Web Devs
founded `Code for Tulsa`_ to collaborate on future civic tech projects.

The conversion to GeoDjango_ in February 2014 was generously sponsored by
MRCagney_.

Future
------
Upcoming features include:

- Validating the feed against Google's requirements
- More documentation
- More flexible GTFS imports and exports (longer values, extra columns)

See the `issues list`_ for more details.

.. _`Apache 2.0`: http://choosealicense.com/licenses/apache/
.. _`June 20, 2012 reference`: https://developers.google.com/transit/gtfs/reference
.. _GeoDjango: https://docs.djangoproject.com/en/dev/ref/contrib/gis/
.. _PostgreSQL: http://www.postgresql.org
.. _PostGIS: http://postgis.refractions.net
.. _South: http://south.readthedocs.org/en/latest/
.. _`Tulsa Web Devs`: http://tulsawebdevs.org
.. _`tulsa-transit-google`: https://github.com/tulsawebdevs/tulsa-transit-google
.. _`Google Maps`: https://www.google.com/intl/en/landing/transit/
.. _`Tulsa's bus schedule appeared on Google Maps in July 2013`: http://tulsawebdevs.org/tulsa-transit-schedules-integrated-into-google-maps/
.. _`Code for Tulsa`: http://codefortulsa.org
.. _MRCagney: http://mrcagney.co.nz
.. _`issues list`: https://github.com/tulsawebdevs/django-multi-gtfs/issues?state=open
.. _20036: https://code.djangoproject.com/ticket/20036
.. _OpenLayers: http://openlayers.org



Changelog
=========

0.3.1 (2014-03-12)
------------------
This release was generously sponsored by MRCagney.

* Add example project 'explore', which represents a feed as linked pages with
OpenLayer maps.
* Add cached geometry for Routes, Trips, and Shapes.
* Extend fields for real-world data (FeedInfo.version, Route.short_name).
* Drop support for Points as geography fields.

0.3.0 (2014-02-01)
------------------
This release was generously sponsored by MRCagney.

* Convert to GeoDjango: Stops and ShapePoints use Points rather than lat/long,
admin shows map of points, and new configuration settings to customize.
* Import south in try/except blocks (so that South really is optional).
* Django 1.5 or above is now required.

0.2.6 (2013-06-07)
------------------
* Remove verify_exists from URLField, so it can be used in Django 1.5

0.2.5 (2013-02-13)
------------------
* Human-friendly sorting for rest of GTFS output

0.2.4 (2013-02-06)
------------------
* Added optional manual sorting of output, used on stop_times.txt

0.2.3 (2012-11-09)
------------------
* Added South migrations for applying 0.2.2 changes

0.2.2 (2012-11-09)
------------------
* Fixed Fare.transfers for unlimited rides (use None instead of -1)
* First PyPi version



Authors
=======
* John Whitlock (John-Whitlock@ieee.org)

Release history Release notifications

History Node

1.1.1

History Node

1.1.0

History Node

1.0.0

History Node

0.4.3

History Node

0.4.2

History Node

0.4.1

History Node

0.4.0

History Node

0.3.3

History Node

0.3.2

This version
History Node

0.3.1

History Node

0.3.0

History Node

0.2.6

History Node

0.2.5

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
multigtfs-0.3.1.tar.gz (2.1 MB) Copy SHA256 hash SHA256 Source None Mar 12, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page