Transitland Onestop

pip install onestop==0.5.0


Transitland Python Client

Circle CI

Migration Warning. Throughout October 2015, we're moving feed and operator records from the GitHub-based Feed Registry into Transitland's Datastore API. This client library will be updated soon to work with the new Datastore API endpoints, but will be broken in the meantime. Thanks for your patience—and your interest in Transitland!


Installation using pip:

pip install transitland

Alternatively, download from PyPi or clone this repository, and install using

python ./ install

The dependencies mzgeohash and mzgtfs will be automatically installed using the above methods.

Opening the Transitland Feed Registry

First, make sure you have a copy of the current Transitland Feed Registry. This can be accomplished through a git clone:

git clone

Then, create a registry reader with transitland.registry.FeedRegistry, passing the path to the registry as the argument.

>>> import transitland.registry
>>> registry = transitland.registry.FeedRegistry('.')

You can now list the known feeds:

>>> registry.feeds()
['f-9q5-lacmta', 'f-9q8-samtrans', 'f-9q8y-sanfranciscomunicipaltransportationagency', 'f-9q9-actransit', 'f-9q9-caltrain', 'f-9q9-vta', 'f-9vk-mtaharriscounty', 'f-c20-trimet', 'f-c23-kingcounty', 'f-c28-translink', 'f-dhw-miamidade', 'f-dnh-marta', 'f-dp3-cta', 'f-dpz8-ttc', 'f-dq-mtamaryland', 'f-dqc-wmata', 'f-dr5r-nyctsubway', 'f-dr5r-panynjpath', 'f-drt-mbta']

Working with a feed

A specific feed can be read with FeedRegistry.feed(). The resulting Feed can be used to inspect the feed attributes, download the current version of the feed, etc.

>>> feed = registry.feed('f-9q9-caltrain')
>>> feed.url()

Download current GTFS feeds

The current versions of GTFS feeds can be downloaded to the current directory using transitland.fetch:

$ python -m transitland.fetch f-9q9-caltrain
Downloading: ->

The "--all" option can also be used to download all feeds in the registry. Only updated feeds will be downloaded:

$ python -m transitland.fetch --all
Downloading: ->
Downloading: ->
Downloading: ->

Bootstrapping a feed from a GTFS source

A Feed can be created from a GTFS url with transitland.bootstrap. Specify the URL with "--url" and the feed name with "--feedname":

$ python -m transitland.bootstrap --url  --feedname bayarearapidtransit
Loading feed: /var/folders/zl/ps1504fx0b9_n2bx4ndmyyy40000gn/T/
Feed: f-9q9-bayarearapidtransit
  Stops: 45
  Routes: 6
  Operators: 1
  Operator: Bay Area Rapid Transit
    Routes: 6
    Stops: 45
Writing to f-9q9-bayarearapidtransit.json

A basic feed description will be written to the feeds directory that can then be annotated with details about licenses, additional identifiers, etc.

    "feedFormat": "gtfs",
    "onestopId": "f-9q9-bayarearapidtransit",
    "operatorsInFeed": [
            "gtfsAgencyId": "BART",
            "identifiers": [],
            "onestopId": "o-9q9-bayarearapidtransit"
    "tags": {},
    "url": ""

What is copied from GTFS to Transitland?



Please open a Github issue with as much of the following information as yo're able to specify, or contact us for assistance.


Transitland is sponsored by Mapzen. Contact us with your questions, comments, or suggests: