How to Differentiate between 4/5/6 trains (ie express and local)

288 views
Skip to first unread message

Peter Platzer

unread,
Jan 3, 2021, 8:37:17 PM1/3/21
to mtadeveloperresources
Hi, I am subscribing to the 4/5/6 and 1/2/3 train (using the python package underground.)

The station I am trying to parse is Grand Central, which has the ID 631N (for northbound trains)

How do I differentiate between the various stop-times being for the 4 or 5 or 6 train? 

For example: Here is the code snippe
import underground
ROUTE4 = ‘4’
ROUTE5 = ‘5’
ROUTE6 = ‘6’

Feed4 = underground.SubwayFeed(ROUTE4,api_key=MY_API_KEY)
Feed5 = underground.SubwayFeed(ROUTE5,api_key=MY_API_KEY)
Feed6 = underground.SubwayFeed(ROUTE6,api_key=MY_API_KEY)

Feed_ext4 = feed4.extract_stop_dict()
Feed_ext5 = feed5.extract_stop_dict()
Feed_ext6 = feed6.extract_stop_dict()

However, I can get times now for :
Feed_ext6[‘6’][‘631N’]
Feed_ext6[‘4’][‘631N’]
Feed_ext4[‘4’][‘631N’]
Feed_ext4[‘6’][‘631N]

Which generally are all different. This has me a tad confused. I would have expected that Feed4 only has stops from the 4 train. But how come it seems to show stop times for 6 trains also? 

And the times for Feed_ext6[‘6’][‘631N’] != Feed_ext4[‘6’][‘631N’]

Clearly I am missing something quite fundamental here. Would appreciate any elucidation. 

Cheers
 PeterP




James Fennell

unread,
Jan 5, 2021, 10:37:10 AM1/5/21
to mtadevelop...@googlegroups.com
Hi Peter,

This sounds more like an issue with the Python package you're using rather than the MTA feeds; you might get more traction by filing an issue on the Python package's Github repo.

James

--
You received this message because you are subscribed to the Google Groups "mtadeveloperresources" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mtadeveloperreso...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mtadeveloperresources/cb6d2284-43e2-492e-a855-ebdd856bc549n%40googlegroups.com.

Peter Platzer

unread,
Jan 5, 2021, 8:56:27 PM1/5/21
to mtadeveloperresources
James, it was, of course, PEBCAC as the MTA feed for trains 4 and 5 is identical and as such requesting that feed would always yield all train information for 4 and 5 (and 6 and 1 and 2 and 3 it turns out). 

Thanks to everyone's help here (and special mention to the great underground library for python at https://github.com/nolanbconaway/underground, I was able to finish the sign today and I'm happy with the first iteration. 

Thank you again, and happy new year!IMG_0907.jpg

Reply all
Reply to author
Forward
Message has been deleted
0 new messages