linkedconnections / gtfs2lc

GTFS to Linked Connections converter
http://linkedconnections.org
MIT License
28 stars 14 forks source link

Frequencies #21

Open pietercolpaert opened 8 years ago

pietercolpaert commented 8 years ago

We need to process frequencies as well...

This means reading an extra file if it exists, and adding extra connections based on the connectionRules stream

derhuerst commented 3 years ago

FYI: computeConnections of the gtfs-utils package implements this in JavaScript:

https://github.com/public-transport/gtfs-utils/blob/7b8137e85a73933c2b7e6276d35c2641f96f2789/compute-connections.js#L27-L70

https://github.com/public-transport/gtfs-utils/blob/7b8137e85a73933c2b7e6276d35c2641f96f2789/lib/read-stop-times.js#L63-L151

pietercolpaert commented 3 years ago

The problem I have with frequencies is the semantic intention: the departureTime and arrivalTime become an interval, and the amount of resulting trips may also be a bit more or less depending on the line. I’m unsure how to translate this to connection objects that get a persistent identifier.

derhuerst commented 3 years ago

the amount of resulting trips may also be a bit more or less depending on the line.

I don’t understand what you mean. Doesn‘t the amount of trips only depend on the headway (and start and end time)?

I‘m rather worried about extact-times !== 1, because the connection won‘t have a fixed time anymore, so a Linked Connections endpoint might convey a degree of certainty (time-wise) that the data/reality doesn‘t provide.

I’m unsure how to translate this to connection objects that get a persistent identifier.

Currently the id of a connection is https://github.com/linkedconnections/gtfs2lc/blob/cb0bdac0e790dc0ebea811111d9794fc13aa308c/lib/URIStrategy.js, right? Couldn‘t the id of a freqnecies-based connection be {trips.startTime(yyyyMMdd)}/{depStop}/{trips.trip_id}/{index}? I would be really hard to resolve this ID with non-GTFS data sources though.

derhuerst commented 3 years ago

FYI I have updated gtfs-utils to use plain for await loops & async functions. This means that you can just for await-loop over all connections (including frequencies.txt). It's Node 12+ though.