Feeder bus service
In last year's Google Summer of Code program a student implemented a pgRouting function for multi-modal routing. It didn't make it into the new 2.0 release, so it probably doesn't work right now, but you may want to take a look at the available resources to see if it's helpful or not:
- Wiki Page: https://github.com/pgRouting/pgrouting/wiki/Multi-modal-Public-Transit-Routing
- Small tutorial: https://github.com/pgRouting/pgrouting/wiki/MMPTR-Tutorial
- Github branch: https://github.com/pgrouting/pgrouting/tree/gsoc-multimodal
It would be nice to get this function into the next release, so please contact the developer mailing list to coordinate the necessary work in case you're interested: http://pgrouting.org/support.html
Actually creating the loop you want is really easy with SQL:
SELECT DISTINCT ON (b1.line, b1.number) b1.line,b1.number,b2.waiting FROM busstops AS b1 LEFT JOIN busstops AS b2 ON b1.line = b2.line AND b1.number<=b2.number AND b2.waiting IS NOT NULL ORDER BY b1.line,b1.number,b2.number;
It'd also be easy to, let's say, sum transfer times from stop to stop.
And you could use regular pgRouting if only you manage to transform the routes into temporal graph (with nodes representing times of departure and time for route cost).