views:

155

answers:

1

Hey Everyone,

I am brainstorming possible ways to implement something for an Android application. I am working on an application for a bus system in which I thought it would be neat to try and find a way to find the fastest bus to your destination. Any suggestions on how I could use a starting position and ending position to find the closest bus stops to both positions?

Any input is appreciated, thanks!

Rob

+4  A: 

Assuming that you can get the GPS coordinates of each bus stop, you can do a simple brute-force search for the closest bus stop to your first position and the closest stop to your second position. I've used the same technique in Windows Mobile GPS applications to find the nearest zip code, although you have to pre-load the zip codes and GPS coords into memory rather than searching a database. There are around 45,000 zipcodes in the country, which I think is substantially larger than the number of bus stops in a major city, so you shouldn't have any problem there.

Once you have the two bus stops determined, you could plot out a bus route from start to end, based on your knowledge of which buses go to which stops and when.

Since you need the fastest route (presumably fastest in terms of time on the bus, but you might also take into account time needed to walk to and from the bus stops), you might also want to calculate the times for routes that don't connect to the closest bus stops, since there could well be a bus that gets to your destination faster but departs from a farther-away bus stop.

Update: since you're brainstorming, here is a link to a beta app you can use in Philadelphia that shows the bus routes and where the buses running that route are at any moment in time:

http://appdev.septa.org/busview-beta/

MusiGenesis
Great answer, I was considering something in that area but I figured I would get a second opinion first. Thanks!
Tarmon