-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add car ferry functionality #5966
Add car ferry functionality #5966
Conversation
This looks already quite promising. Under which conditions should a stop be linked to a drivable edge? Do you want to make it explicit in the transit data or do you want infer it from the fact that a car-enabled route stops there? |
This is a good question. We have discussed this quite a lot and the question remains somewhat open. The information for stops can be inferred from a car-enabled ferry using the stop as you said. At least currently I'll try to go with that. However, there is some discussion on changing the gtfs standard related to this here: google/transit#466. Depending on how the discussion progresses will also affect this quite a lot. The changes might also affect the Adding just |
7292d80
to
fb9e985
Compare
fb9e985
to
a555f3d
Compare
@t2gran @optionsome @leonardehrenfried assuming possible changes to transfers (e.g. changing |
Has been released: https://github.com/OneBusAway/onebusaway-gtfs-modules/releases |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5966 +/- ##
==========================================
Coverage 69.94% 69.95%
- Complexity 17744 17762 +18
==========================================
Files 1998 2000 +2
Lines 75454 75505 +51
Branches 7723 7728 +5
==========================================
+ Hits 52778 52818 +40
- Misses 20007 20012 +5
- Partials 2669 2675 +6 ☔ View full report in Codecov by Sentry. |
@optionsome I don't think we assigned reviewers yesterday, correct? |
I just posted to google/transit#466 in favor of the alternate approach that had been offered there by miklcct. If the work for |
@tsherlockcraig I posted a reply in the issue you mentioned. The arguments in that thread centered around adding changes to This implementation should be enough for many cases. Extending this functionality, especially since it is based on an experimental onebusaway GTFS library addition ( Also, for example, Netex support has not been implemented, so at some point development related to car ferries should come from that angle. |
@@ -3062,6 +3073,11 @@ enum PlanAccessMode { | |||
""" | |||
BICYCLE_RENTAL | |||
""" | |||
Driving a car from the origin to the destination. | |||
TODO add more thorough description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve these TODOs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODOs are now resolved, the comments are based on the assumption that the access, egress, and transfer modes should all be equal when one is set to CAR
. Once the issue brought up by Henrik is solved this might have to be changed
@@ -2268,6 +2268,8 @@ type Trip implements Node { | |||
"Whether bikes are allowed on board the vehicle running this trip" | |||
bikesAllowed: BikesAllowed | |||
blockId: String | |||
"Whether cars are allowed on board the vehicle running this trip" | |||
carsAllowed: CarsAllowed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you actually need this information in your UI? If not I would remove that field because we don't know how the standardisation process will play out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this
switch (carsAllowed) { | ||
case 1: | ||
return CarAccess.ALLOWED; | ||
case 2: | ||
return CarAccess.NOT_ALLOWED; | ||
default: | ||
return CarAccess.UNKNOWN; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch (carsAllowed) { | |
case 1: | |
return CarAccess.ALLOWED; | |
case 2: | |
return CarAccess.NOT_ALLOWED; | |
default: | |
return CarAccess.UNKNOWN; | |
} | |
return switch (carsAllowed) { | |
case 1 -> CarAccess.ALLOWED; | |
case 2 -> CarAccess.NOT_ALLOWED; | |
default -> CarAccess.UNKNOWN; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to this
Set<StopLocation> stopLocationsUsedForCarsAllowedTrips = Set.of(); | ||
stopLocationsUsedForCarsAllowedTrips = | ||
transitModel | ||
.getAllTripPatterns() | ||
.stream() | ||
.filter(t -> | ||
t | ||
.getScheduledTimetable() | ||
.getTripTimes() | ||
.stream() | ||
.anyMatch(tt -> tt.getTrip().getCarsAllowed() == CarAccess.ALLOWED) | ||
) | ||
.flatMap(t -> t.getStops().stream()) | ||
.collect(Collectors.toSet()); | ||
|
||
stopLocationsUsedForCarsAllowedTrips.addAll( | ||
stopLocationsUsedForCarsAllowedTrips | ||
.stream() | ||
.filter(GroupStop.class::isInstance) | ||
.map(GroupStop.class::cast) | ||
.flatMap(g -> g.getChildLocations().stream().filter(RegularStop.class::isInstance)) | ||
.toList() | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you extract that into a method and convert the line comments to Javadoc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, can also extract a method for the flex stops?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created methods for both in the transitModel
. This will also be useful later when working on the transferRequest
stuff related to cars on transit
assertTrue(model.stopVertex().isConnectedToGraph()); | ||
|
||
// Because the stop is used by a carsAllowed trip it needs to be linked to both the walk and car edge | ||
assertEquals(2, model.stopVertex().getOutgoing().size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertEquals(2, model.stopVertex().getOutgoing().size()); | |
assertThat(model.stopVertex().getOutgoing()).hasSize(2); |
Since I wrote this other test, we introduced the truth assertion library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed all assertEquals
in this file to assertThat
@optionsome can merge when HSL is ready. |
Lets wait a bit before merging this in. We need to do a production release of our fork first and then we will quickly test this in our dev to see that this doesn't cause any problems. |
9958ffc
…into car-ferry-changes
02aaf42
Final merge conflict resolve. According to @optionsome this can now be merged. |
Summary
This PR adds the carry ferry feature. Using this feature requires compatible GTFS data with the
cars_allowed
field in thetrips.txt
file. This field is used similarly to howbikes_allowed
is used. Also{ "modes": "CAR" }
should be added to thetransferRequests
section of thebuild-config.json
file.Things that have been manually tested include:
Things that are not in the scope of this pr:
transferRequests
to allow for vehicle-specificmaxTransferDuration
).Issue
Closes #5875
Unit tests
Added.
Documentation
No documentation has been added.
Bumping the serialization version id
Needed.