Coder Social home page Coder Social logo

brisbanebus's Introduction

BrisbaneBus API Documentation


Notice

I no longer live in Brisbane or heavily use public transport so this project is fairly dead in the water. Feel free to use this code if you see it being useful.


Background & Explanation

Queensland's Bus service, Translink, currently publishes its network and realtime network information in Google's gtfs and gtfs realtime formats. These formats are made for machine consumption and thus can provide an entry level barrier for those people looking to harness the data they provide. What's more, the realtime feed is ~500KiB per load, greatly reducing it's usability on mobile devices and due to their limited data supply.

Currently this website & the BrisbaneBus service only supplies realtime information for the Translink network. Rather than users of the feed having to download, decode and parse the gtfsrt feed themselves, they can use the following endpoints to fetch more specific data in easily readable JSON format. The goal is to increase availability of this interesting data supply.

Continued development of this project is being done at cavejay/BrisbaneBus

Endpoints

/routelist

NOT IMPLEMENTED YET

Returns a JSON array of all the routes in the network

/routelist/live

Returns a JSON array containing all the routes with buses currently servicing them.

/route/:routeid

NOT IMPLEMENTED YET

Returns an array of JSON objects providing information on each Bus on the given route.

/route/:routeid/near/:longitude/:latitude

NOT IMPLEMENTED YET

Returns the stop id of the stop closest to provided longitude and latitude.

Installation

This service requires that you have access to a MongoDB instance.

  1. Clone this repo. git clone https://github.com/cavejay/BrisbaneBus.git
  2. cd BrisbaneBus && npm install .
  3. Open resources/config.js with a text editor and correct line 7 to point to your preferred mongo instance. The default setting is to use a local instance.
  4. place the config.js file by running. cp resources/config.js node_modules/gtfs/config.js
  5. node /bin/gtfsSetup.js handles the downloading and loading into MongoDB of the Translink GTFS data. This will take very long time, about 20 minutes.
  6. node main.js or npm start can be used to start the server.
  7. If the server is to be run in a headless environment it's recommended to install pm2, a node process manager. This command will install and start pm2 for this server npm install -g pm2 && pm2 start main.js.

brisbanebus's People

Contributors

cavejay avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

brisbanebus's Issues

Doesn't use lazy realtime updates

Currently, to keep the feed up to date we have to ping the server every 15 seconds.
The referable state of being would be to only refresh the feed when we have an incoming request AND outdated data. This would lower the network usage of both this server and translink.

Finish/Write gtfsSetup.js script

It should use the written downloading functions and then call the gtfs's npm run download and to import the files into mongoldb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.