3

I'm building a public transit service in South Africa, and I initially started the project on PHP and MySQL. I've managed to get far with the simple stack, with:

  • Routing algorithm in PHP
  • Data storage as coordinates in MySQL
  • front-end in WordPress
  • JS for Google Maps and a REST API for mobile apps (incomplete)

My question based on the above is: I want to move away from using PHP in the back-end, and I'd like to know what alternatives there are.

I'm fairly inexperienced, and used PHP as it's the only server-side language that I currently know. I've seen that a lot of map/routing applications use Java and Python, and am thinking of moving in that direction in future.

I'm finding myself having to do a lot of geographic calculations, and as my data grows I find myself reinventing the wheel. Would a PostGIS + PgRouting setup benefit me?

A working demo of the project can be found at http://rwt.to.


The project has subsequently went live.

5
  • 1
    I'm not terribly familiar with the project, but if you are considering a change in platform/design, have you taken a look at OpenTripPlanner? Aug 10, 2012 at 14:54
  • Hey RyanDalton, yes I have taken a look at it. I haven't tried using it though, there's someone who has implemented it in the same area in my country, but from their implementation fromAtoB it's rather terrible. I also need full control of the data as I'm going to be creating a lot of other services with it. The rwt.to thing is just the beginning.
    – nevi_me
    Aug 10, 2012 at 15:00
  • As a transportation and traffic guy, I would suggest you speak with the local GIS and traffic folks about what they use for GIS systems. It has been my experience that a lot of times, different municipal offices build GIS systems in silos rather than in coordination. Also for the purposes of traffic planning and modeling, it would help us more if the systems were interoperable.
    – dassouki
    Aug 23, 2012 at 16:29
  • Hi dassouki, in South Africa most of the service providers are way behind, with only our fast-rail provider likely to have GIS systems (I think they're outsourced). Our government's struggling to even get all their transit data into one location, and we have a very informal taxi system which operates inefficiently. Hence I decided to create this project in order to try bridge the gap between the various modes of transport.
    – nevi_me
    Aug 23, 2012 at 18:27
  • If you want more control of how the algorithm is calculating the shortest/fastest path checkout GraphHopper (java). Also I'd like to push it in the direction of your use-case :)
    – Karussell
    Aug 30, 2012 at 22:39

2 Answers 2

1

For anyone who's interested: I've decided to adopt mongoDB instead of Postgre-based solutions (for the public transit search at least). I won't be providing things like walking directions, so I will have a relatively static dataset.

I chose mongo over MySQL because:

  • supports spatial indexing out of the box
  • I can control 'find()' queries by pushing dynamic arrays of things (e.g. stations to exclude from search). I don't know how to safely and easily do it in SQL.
  • Performance benefit as I'll be able to keep my entire database in memory (one Amazon EC2 instance with 66GB would hold the whole country's data I think).

I find Dijkstra's algorithm to be well suited for what I want to do, so I'm still going to reinvent the wheel by rewriting the algorithm with some logic tweaks to match the type of data I have. That's also giving me the benefit of being in control of my results, as opposed to pushing quieries to a black box (PgRouting in this case).

So I'll be 'relaunching' my service in early December if all goes well

0

Yes PgRouting and PostGIS setup will benefit you a lot I think.

  1. It will allow you to do most of the logic in the database, which is in general much faster since there is a lot less back and forth passing.
  2. It also means your front-end can be dummer so the issue of what you run in the front-end because less important and you have more flexibility what you use.
  3. PostGIS and PgRouting are much faster than MySQL for these kinds of workflows.
1
  • Thanks LR1234567, I think I've found the right stack for what I want to do. I am going to slowly transition towards using PostGIS and PgRouting, only for an internal directions service. For other data like POI's I'm going to use a document-oriented database.
    – nevi_me
    Aug 23, 2012 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.