noisecapella / bostonbusmap

An app which uses the MBTA's data feed to display public transit predictions and vehicle locations
Other
17 stars 4 forks source link

misc issues generating sqlite3 DB #8

Open kenkyee opened 8 years ago

kenkyee commented 8 years ago

Was trying to follow the autogenerate.sh docs and found it also needed "pip install requests" after installing python3.

But after that, it blew up trying to look up the key for CapeFlyer:

sh ./autogenerate.sh Generate Schema.java... Generating database... Reading GTFS into temporary database (this may take a few minutes)... Type for column not found: wheelchair_accessible Type for column not found: wheelchair_boarding Type for column not found: route_sort_order Generating Hubway stops... Generating commuter rail stops... Traceback (most recent call last): File "generate_database.py", line 57, in main() File "generate_database.py", line 52, in main generate(conn, gtfs_map) File "generate_database.py", line 24, in generate index = MbtaCommuterRail().generate(conn, index, gtfs_map) File "/Users/kenyee/work/Kotlin/bostonbusmap/tools/generate/mbta_commuter_rail.py", line 96, in generate count = self.write_sql(cur, startorder, gtfs_map) File "/Users/kenyee/work/Kotlin/bostonbusmap/tools/generate/mbta_commuter_rail.py", line 63, in write_sql obj.routes.listorder.value = startorder + route_order[route_id] - 1 KeyError: 'CapeFlyer'

kenkyee commented 8 years ago

Fixed this by adding CapeFlyer as route #13 in generate/mbta_commuter_rail.py:

        "CR-Newburyport": 12,
        "CapeFlyer": 13}
noisecapella commented 8 years ago

Thanks, I'll incorporate this change into the code base. Please let me know if you encounter any other problems getting this stuff set up!

kenyee commented 8 years ago

@noisecapella : one other thing I noticed is the directionsStops table is empty. Is this a bug in the generator? I didn't see anything in the generator code that would fill this mapping table in. The directions table isn't too useful w/o this mapping table :-)

noisecapella commented 8 years ago

Sorry for the delay, I was on vacation. I'll take a look when I get home

noisecapella commented 8 years ago

I think I originally planned to populate that table but it turned out not to be necessary. The app only uses the directions table to convert the dirTag to a name and title to be displayed in the stop predictions and vehicle locations. Since the dirTags are unique there's no need to map it to a particular stop, at least for this particular app. Sorry for the late responses!

kenyee commented 8 years ago

That makes sense. I have a different need...have to figure out which stops and directions are nearby for a particular route (e.g. inbound for bus route 9) and that directions table doesn't give me a list of stops w/ directions. Any suggestions on how to modify the current generator code to do this? I've been looking through the generator code but nothing looks obvious :-(

noisecapella commented 8 years ago

If you look at this example route config: http://webservices.nextbus.com/service/publicXMLFeed?command=routeConfig&r=71&a=mbta

There are two different stop elements. The stops which are children of route describe bus stops, and the stop which are children of direction describe stop tags within that direction. In the generator there's this line which prevents the XML parser from parsing the stop elements within a direction. You will need to change that to parse stop elements within direction elements. Please let me know if you need more guidance, the code is not very clean