Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specs gtfs2ntfs: reading shapes & frequencies #424

Merged
merged 4 commits into from
Oct 23, 2019

Conversation

papailio
Copy link
Contributor

No description provided.

A new trip is created, departing from the first stop every `headway_secs` seconds within the time period between `start_time` and `end_time`. Stop times of the referenced trip are used to calculate the time interval between two stop departures.
The departure time at the first stop of the last trip should not be later than the `end_time` value.

Th identifier for each new trip is generated using the following pattern: \<trip_id>:<auto-incrimented integer\> and maintains the rest of the attributes of the sample trip. That is, all new trips are assigned to the same route as the route of the sample trip, have the same service_id, etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Th identifier for each new trip is generated using the following pattern: \<trip_id>:<auto-incrimented integer\> and maintains the rest of the attributes of the sample trip. That is, all new trips are assigned to the same route as the route of the sample trip, have the same service_id, etc.
The identifier for each new trip is generated using the following pattern: \<trip_id>:<auto-incremented integer\> and maintains the rest of the attributes of the sample trip. That is, all new trips are assigned to the same route as the route of the sample trip, have the same service_id, etc.

A new trip is created, departing from the first stop every `headway_secs` seconds within the time period between `start_time` and `end_time`. Stop times of the referenced trip are used to calculate the time interval between two stop departures.
The departure time at the first stop of the last trip should not be later than the `end_time` value.

Th identifier for each new trip is generated using the following pattern: \<trip_id>:<auto-incrimented integer\> and maintains the rest of the attributes of the sample trip. That is, all new trips are assigned to the same route as the route of the sample trip, have the same service_id, etc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, the frequencies are using a virtual trip that need to be destroyed once all frequencies have been transformed into stop_times. Maybe this can be mentioned in the specification too?

| geometries.txt | geometry__id | ID | shapes.txt | shape_id | All slashes `/` are removed |
| geometries.txt | geometry__wkt | Required | shapes.txt | shape_pt_lat, shape_pt_lon, shape_pt_sequence | A WKT LINESTRING geometry is created from the 3 input fields. |

### Reading frequencies.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I did the documentation, I had these 3 special cases:

  • src/gtfs/read.rs:954 WARN/IGNORE [frequency for trip <frequency.trip_id> has same start and end time] if the frequency start time and end time are the same
  • src/gtfs/read.rs:964 WARN/IGNORE [frequency mapped to an unexisting trip <frequency.trip_id>] if the frequency refers to a vehicle_journey which doesn't exist
  • src/gtfs/read.rs:975 WARN/IGNORE [frequency mapped to trip <frequency.trip_id> with no stop_times] if the vehicle_journey relative to the frequency doesn't have any stop_time

They are very technical but I think they should be documented one way or another (except maybe the second one which might be evident enough).

Frequencies are transformed into explicit passing times by creating new trips that operate on regular times within the specified period. For each line of the GTFS frequencies.txt file, the referenced trip and its stop_times are used as a sample to create the new trips whose stop_times are calculated based on the given headway.

A new trip is created, departing from the first stop every `headway_secs` seconds within the time period between `start_time` and `end_time`. Stop times of the referenced trip are used to calculate the time interval between two stop departures.
The departure time at the first stop of the last trip should not be later than the `end_time` value. In case both values for `start_time` and `end_time` are equal, the frequency is ignored (no new trip is created).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

equals? (not sure)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding the ignored case when endtime is inferior to the starttime ?

woshilapin
woshilapin previously approved these changes Oct 22, 2019
@@ -187,7 +189,7 @@ immediately with an error.
| trips.txt | route_id | Required | trips.txt | route_id | cf. NTFS `route_id` definition above to specify the proper reference. |
| trips.txt | service_id | Required | trips.txt | service_id | |
| trips.txt | trip_id | Required | trips.txt | trip_id | |
| trips.txt | trip_headsign | Optional | trips.txt | | `trip_short_name`, of if empty `trip_headsign` |
| trips.txt | trip_headsign | Optional | trips.txt | | `trip_short_name`, or if empty `trip_headsign` |
Copy link
Contributor

@ArnaudOggy ArnaudOggy Oct 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since NTFS 0.10 there are now 2 fields "trip_headsign" and "trip_short_name".
It's not yet implemented in TransitModel, but I think it will be soon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok to do this later to avoid opening toi many subjects at once


| NTFS file | NTFS field | Constraint | GTFS file | GTFS field | Note |
| --- | --- | --- | --- | --- | --- |
| geometries.txt | geometry__id | ID | shapes.txt | shape_id | All slashes `/` are removed |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

geometry_id and geometry_wkt (remove one underscore)

ArnaudOggy
ArnaudOggy previously approved these changes Oct 23, 2019
Frequencies are transformed into explicit passing times by creating new trips that operate on regular times within the specified period. For each line of the GTFS frequencies.txt file, the referenced trip and its stop_times are used as a sample to create the new trips whose stop_times are calculated based on the given headway.

A new trip is created, departing from the first stop every `headway_secs` seconds within the time period between `start_time` and `end_time`. Stop times of the referenced trip are used to calculate the time interval between two stop departures.
The departure time at the first stop of the last trip should not be later than the `end_time` value. In case both values for `start_time` and `end_time` are equal, the frequency is ignored (no new trip is created).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding the ignored case when endtime is inferior to the starttime ?

A new trip is created, departing from the first stop every `headway_secs` seconds within the time period between `start_time` and `end_time`. Stop times of the referenced trip are used to calculate the time interval between two stop departures.
The departure time at the first stop of the last trip should not be later than the `end_time` value. In case both values for `start_time` and `end_time` are equal, the frequency is ignored (no new trip is created).

Note that the referenced trip (and its stop_times) is only used as a sample and is not generated by the reader in the end. In case the referenced trip ans/or its associated stop_times do not exist, the frequency is ignored (no new trip is created).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced by the use of generated by the reader. What about something like and is deleted is the resulting data ?

  • Typo in ans/or

@ArnaudOggy ArnaudOggy merged commit b78e05a into hove-io:master Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants