Wednesday, May 1, 2013

[android help] Finding the nearest bus stations

android - Finding the nearest bus stations - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I'm just beginning to build an Android app that leverages the NextBus API to provide transit predictions.


When the app loads, I want it to get the user's location and then find the closest bus stops to them. Unfortnuately, the NextBus API doesn't provide a method for doing so. I do have a list of all bus stops (there are 5600 of them) in a text file, each with its textual name, numerical Stop ID and its latitude and longitude.


I'm considering several options, each with its own problems:



  1. Make a call the Google Places API to get all stops within (say) a mile of the user. The problem with this method is that Google returns only the name of the stop in text form, and the NextBus API requires the numerical Stop ID. So, I could create a map with the textual names as the keys and the numerical Stop ID's as the values (or, more probably, load them all into a MySQL database).




  2. Store the text file itself as a resource (perhaps converting it to XML or some other format that's easier to search), and compare the GPS locations of all 5600 stops to the user's current location. This solution seems utterly untenable, as it would be prohibitively expensive. However, perhaps I'm overestimating its cost?




  3. I also have the bus stop data in the form of KML (Google Earth) and GIS files, but I have never interacted with either of these two formats. Is there a way I could use them to locate the closest stops more efficiently than the previous two solutions?




















Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.










default






.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...