CodeforSouth / mdt-bus-sms

:sleeping: TextMyBusMIA: SMS Interface for Miami Dade Transit Bus Systems.
http://codefor.miami/mdt-bus-sms/
MIT License
7 stars 7 forks source link

Sanity test that stop locator is working #33

Open ErnieAtLYD opened 10 years ago

ErnieAtLYD commented 10 years ago

http://smsbus.miamicode.org/locate-stops.html?phrase=NW+29+ST+%26+NW+1+AVE%2C+miami%2C+fl doesn't work for me.

aramonc commented 10 years ago

When you get a minute, more detail please :)

Also, would anyone like to work on a phone app for this that basically shows you the bus stop locations near you (using gps) so that we can better test this ?

ErnieAtLYD commented 10 years ago

Sure thing. When I type in: "nw 29 st & nw 1 ave, miami, fl" in the box, the box doesn't reposition nor do any markers show up. I can also confirm that there doesn't seem to be any other markers besides the four in government center. I am using Chrome on OSX.

Re: the bus stop locations using GPS or phone app - I think that's a good idea. In general, how do you pull the data to get all the geo endpoints? Can you make them public somehow?

This also may be a good project to share at next Mondays hackweek. -E

aramonc commented 10 years ago

If you hit enter instead of click on the search button it just refreshes the page. The locate stops feature is very much a hack.

I attached an event listener to the button's click that does an ajax call to the answer-sms script. This then looks the address up in the MapQuest API (holdover from when I was doing this through SMS & couldn't use Google because I was not displaying the marker on the map). The MapQuest API then returns a list of results (first one should be most accurate) with geographic coordinates. The script then runs this set of coordinates against the set of coordinates for each stop on the stops tables using a haversine function to find the nearest stops. It then returns the found intersections & the list of nearby stops so that the JS can add them to the map.

AJAX call: https://github.com/Code-for-Miami/mdt-bus-sms/blob/master/public_html/js/main.js#L24 MapQuest call: https://github.com/Code-for-Miami/mdt-bus-sms/blob/master/src/SmsBus/Controller/Stop.php#L82 Query to stops table: https://github.com/Code-for-Miami/mdt-bus-sms/blob/master/src/SmsBus/Db/StopsTable.php#L13 Adding points on the map: https://github.com/Code-for-Miami/mdt-bus-sms/blob/master/public_html/js/main.js#L54

The address for this test case returns a wrong location, so it fails anyways.

Doing it via an app we wouldn't have to use the MapQuest API, we could just go against the device's reported geo-location & get the nearest stops from that.

This would require a new end point on the app & to use probably the Google Maps API with the HTML5 location API.

I'm on vacation on Monday :D

ErnieAtLYD commented 10 years ago

Hey, so, sanity check. When was the last time the GTFS data was updated? There is an available data set from January 15, 2014. If we already updated that data before, alas, never mind :|

aramonc commented 10 years ago

The site checks to see if there a new data set every 7 days, there's actually newer data sets than that I think.

Adrian R. Cardenas

On Thu, Jul 31, 2014 at 1:53 PM, Ernie Hsiung notifications@github.com wrote:

Hey, so, sanity check. When was the last time the GTFS data was updated? There is an available data set from January 15, 2014. If we already updated that data before, alas, never mind :|

— Reply to this email directly or view it on GitHub https://github.com/Code-for-Miami/mdt-bus-sms/issues/33#issuecomment-50794368 .

aramonc commented 10 years ago

No, you're right. The latest version of the GTFS data is from 4 months ago when I moved everything to the ServerGrove server. So we have the latest data set from Miami Dade.

So the sanity check is this: Take Bus route# 11 (http://www.miamidade.gov/transit/routes_schedule.asp?srv=WEEKDAY&dir=Eastbound&rt=11) on the eastbound trip, the last stop is the south east corner of Government Center (https://goo.gl/maps/NWjL9 ). Note that there's no stop there in Google Maps and none of the stops labeled on Google Maps around the Government Center building actually list route# 11.

Look up the trips for route 11 on the trips table. Pick a trip ID that is eastbound. Then look up the stop times for that trip ID in the stop_times table and try to match the stop times with when the route is supposed to stop at NW 1st ST & NW 1st AVE (Government Center) according to the MDT schedule. From there grab the corresponding stop ID and look up the stops information in the stops table.

This all has to be done by querying the database.

For reference: https://drive.google.com/file/d/0By99os8_brfWaVZjcDBhTTgxNTg/edit?usp=sharing