Thursday, July 21, 2011

Bus Route Finder

A month and a half back, I made a map of bus routes in Colombo that became a surprise hit. This, coupled with the number of calls Himal was getting asking which bus to take, made me think that a website that tells you which buses to take from location A to location B would be pretty useful. With my beginner-level knowledge of SQL, JavaScript and PHP, I was able to cobble together a website that helps you find the bus route to your destination.

The system is far from perfect (it has only 25 or so bus routes, from the 70 odd listed in the Colombo bus routes Wikipedia article), and so it could do with some improvement, which is why I'm releasing the source code and the database SQL under the GNU GPL. :) So, I hope someone who's better with buses and code can take this to the next level. So, do feel free to modify, change, and host as you please, and please excuse the n00bish code, I'm kinda new to this! :D

A better algorithm for finding buses would be really nice, since all buses are not created equal. Waiting for a 135 that never came on a Sunday afternoon in Narahenpita, or getting late for an appointment because some fool recommended you take a 255 (worst bus ever!!!) from Kottawa to Mount Lavinia, is uncool. A better system with some sort of ranking algorithm would solve this problem, me thinks. :)

Hope you guys find the system useful. There is a mobile version of the site, but my stupid web host won't let me automatically redirect users to it using htaccess. :( A special Thank You to all my friends who helped me with this, and especially Mr. Inosh Perera, who helped me with the 187 bus route and also suggested I add Google Maps geolocations to bus halts. :)

Update: Bus Route Finder on GitHub (Thanks, John!) :D

37 comments:

  1. I know nothing about codes and shit and close to nothing about bus routes , for all the time I've lived in colombo I can still get easily lost but this sounds so coool ! xoxo. keep it up.

    ReplyDelete
  2. Nice work man- esp liked the minimalist design.

    I'm a product of ur alma mater(!) currently working in software engineering (expat). Here's the transport timetable site we have[http://metlinkmelbourne.com.au/]- hope you get an idea or two to improve your work

    ReplyDelete
  3. sorry, your host isn't letting me download the code. Throw it up on github instead?

    This will make it easier for people to patch or clone, and for your selected license - it is completely free.

    ReplyDelete
  4. Shabith and Ishan - Thanks, guys! :D

    Middle Child - Thank you. Hope you find it useful! :D

    Anon 1 - Thank you! :D That is pretty neat. Hope this system will be up to that standard in usefulness. :)

    Anon 2 - Tried to get it on Github, with no success. :D Hopefully one of my friends will do it and I'll be able to share the link. The download link should work now, though. :)

    Thanks for the comments, everyone! :D

    ReplyDelete
  5. Wow.. I'm amazed by it's usability.. Good work dude.. +1 to your effort and making it opensource. I simply feel you have done the majority of the work which doesn't need improvement. But I hope requirements will grow and everyone can chip in to improve it.. Again, good work..

    ReplyDelete
  6. Bro, this is a freaking awesome tool

    ReplyDelete
  7. good dude but please update other information such as jaffna to colombo, and other places...

    cooool

    s.saththiyan
    MD/CEO IDM JAFFNA
    MD/CEO Softnet
    CAO Intermatriexs

    ReplyDelete
  8. This is the best thing that has happened. Would like to see if you can integrate the map you designed along side of Google maps as well. (like they do on the London transport website)

    ReplyDelete
  9. really nice work.. thumbs up.. exactly the one that i was searching for ages..
    thanx buddy..
    small suggestion: better to add some alternate buses/routes

    ReplyDelete
  10. This is really wonderful and a brilliant idea... and kudos for making it open source!

    ReplyDelete
  11. Thanks, guys! :D Thank you for the feature requests and suggestions as well. Will hopefully be able to make the system better together with the other developers. :)

    ReplyDelete
  12. good stuff. you should ask all the tourism sites to integrate this to their sites. foreigners would love this too.

    ReplyDelete
  13. some more suggestions, for anyone interested in further development:
    a. include bus fares (will need to update frequently ;))
    b. integrate with a gps device/ maps- for mobiles( to insert locations)
    c. approx time for the journey
    d. improvements in best route selection (eg. panadura to delkanda: dehiwala-nugegoda route is better)
    e. add alternate routes
    f. bus time tables

    dnt think i'm asking too much, this is to make it more handy..

    ReplyDelete
  14. azure-0:
    for a, do you have a fare table for buses? it has been a few years since I traveled on a bus, but I remember there is a base fare and then additions at every major junction. Give me examples for a few routes and i can try to figure it out from there.

    Except c, d and f, the other things are either doable or already done. c depends on too many factors [can provide a wildly inaccurate guess], d is difficult but being worked on (why do you think your route is "better" is an interesting question?), f - I don't have a clue. never traveled on buses with a timetable in this country.

    btw: I am not the original author, just made a few changes and shared them back. it is an interesting problem to try to solve for me :)

    ReplyDelete
  15. Just a suggestion, try integrating this with the LiFE Location Code Navigator from ICTA - http://repository.icta.lk/LIFe/navigate

    ReplyDelete
  16. This is some genius work! You gotta improve it. Try considering suggestions by "azure-0" too.

    ReplyDelete
  17. Smart work! Appreciate the fact that you made it open source.

    Try adding few options like shortest part / fastest path. E.g. It may be faster to pick a 138 and take a borella bus from town hall rather than waiting for 135 Bus to go to Borella from Thimbirigasyaya.

    ReplyDelete
  18. This is really cool stuff!!! Works like a charm! keep it up!

    ReplyDelete
  19. Great idea... really cool..
    Keep up the good work!!

    ReplyDelete
  20. Thanks everyone! :D

    Azure-0: Thanks for those suggestions. I think Thimal commented below you, and his code is available at https://github.com/thimal/Bus-Route-Finder, where he's implementing a lot of route based options, ranking and suggestions. :D

    K - Thanks! :D Yeah, we need to improve the suggestions, and crowd-sourcing that data would be the best way to go, methinks. :)

    Thanks for the comments, everyone. :D I haven't been able to mess with the code in a while because of other work, but hopefully when I get holidays in October, I can begin contributing again. :D

    ReplyDelete
  21. good idea.
    Some suggestions: Let users to add routes. That will be more scalable than one adding all routes.
    An Android app for this will be of greater use than a website.

    ReplyDelete
  22. Thanks everyone. :) Hopefully I can do some more work on it, especially make an extension for people to add their own routes, and an API. For some reason this app feel like "ugh noooooo!" whenever I try to work with it, which is weird coz I work with much more complicated apps usually. :S

    ReplyDelete
  23. You should get this app done for mobile platforms. I cant stand these bus routes. This is the only thing I have for a correct solution.

    If we could plot the bus stop locations to their GPS coords, we could get Google maps to work with this. Like from to directions pointed from the map and we select the nearest bus stations to get the route.

    I still dont get your logic in selection overlapping intersection points for two stage buses. Is it OK to develop this for android if I get the idea?

    ReplyDelete
  24. Well, the logic in that was, that unlike all these theoretical routing algorithms (shortest path, minimum cost spanning tree stuff etc) where switching between routes doesn't cost anything, switching from bus to bus is an inconvenience for the user, and we need to reduce the number of bus routes he has to take as much as possible. The simplest mechanism I could find to do this was having changeover points (but there might be better ways of doing it).

    You might be interested in the Android app for this that Aloka is building. He will (hopefully) be demoing it at the next Refresh Colombo. :D

    ReplyDelete
  25. Shageevan SachithanandanMarch 27, 2012 at 7:58 AM

    Just checked the beta app! I love the usability of this app!

    ReplyDelete
  26. The information on bus route finder is totally up to date and I liked lot of essentail aspects about it. Thanks for sharing it.

    ReplyDelete
  27. Hi
    First of all thank you for the Great work!
    I am not sure how far you guys got with this, I am more than happy to contribute my knowledge if you needed.
    Also What is the name of the app that you developed? I am developing a SL Map app with some few more features so it would be good if we can include this as well(btw I'm using Djikstra's algorithm)

    Sanj

    ReplyDelete