-
Notifications
You must be signed in to change notification settings - Fork 1.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
Support for routing to Station centroid instead of child stops #6047
Merged
habrahamsson-skanetrafiken
merged 18 commits into
opentripplanner:dev-2.x
from
Skanetrafiken:access-egress-station-routing
Oct 8, 2024
Merged
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
25068f1
Refactor: Simplify DirectTransferGenerator
habrahamsson-skanetrafiken 4b65b74
Add accessibility to station
habrahamsson-skanetrafiken 2047421
Implementation of route to centroid coordinate
habrahamsson-skanetrafiken 41a9870
Revert non-allowed dependency
habrahamsson-skanetrafiken 4db3bc5
Address review comments
habrahamsson-skanetrafiken d8c6718
Use truth in tests
habrahamsson-skanetrafiken 7ac66ba
Remove previously added Station accessibility information
habrahamsson-skanetrafiken 345b2a9
Unify Edge toString methods
habrahamsson-skanetrafiken 7d77b4c
Add validation of route to centroid StopPlace ids
habrahamsson-skanetrafiken d898aff
Rename station -> stop place in netex context
habrahamsson-skanetrafiken a336654
Address review comment
habrahamsson-skanetrafiken c029b19
Address review comments
habrahamsson-skanetrafiken 6e0eb03
Fix centroid validation
t2gran 14a53d9
Merge branch 'dev-2.x' into access-egress-station-routing
habrahamsson-skanetrafiken 9c8acf6
Add version 2.7
habrahamsson-skanetrafiken b619d61
Fix issue reporting
habrahamsson-skanetrafiken 684a90e
Address review comments
habrahamsson-skanetrafiken a8674a9
Rename stationAndStreetVertexLinker
habrahamsson-skanetrafiken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -83,6 +83,7 @@ Sections follow that describe particular settings in more depth. | |||||
| [sharedFilePattern](#nd_sharedFilePattern) | `regexp` | Pattern for matching shared NeTEx files in a NeTEx bundle. | *Optional* | `"shared-data\.xml"` | 2.0 | | ||||||
| [sharedGroupFilePattern](#nd_sharedGroupFilePattern) | `regexp` | Pattern for matching shared group NeTEx files in a NeTEx bundle. | *Optional* | `"(\w{3})-.*-shared\.xml"` | 2.0 | | ||||||
| [ferryIdsNotAllowedForBicycle](#nd_ferryIdsNotAllowedForBicycle) | `string[]` | List ferries which do not allow bikes. | *Optional* | | 2.0 | | ||||||
| [routeToCentroidStationIds](#nd_routeToCentroidStationIds) | `string[]` | List stations that should route to centroid. | *Optional* | | 2.6 | | ||||||
| [osm](#osm) | `object[]` | Configure properties for a given OpenStreetMap feed. | *Optional* | | 2.2 | | ||||||
| [osmTagMapping](#osm_0_osmTagMapping) | `enum` | The named set of mapping rules applied when parsing OSM tags. Overrides the value specified in `osmDefaults`. | *Optional* | `"default"` | 2.2 | | ||||||
| source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | | ||||||
|
@@ -113,6 +114,7 @@ Sections follow that describe particular settings in more depth. | |||||
| [sharedGroupFilePattern](#tf_1_sharedGroupFilePattern) | `regexp` | Pattern for matching shared group NeTEx files in a NeTEx bundle. | *Optional* | `"(\w{3})-.*-shared\.xml"` | 2.0 | | ||||||
| source | `uri` | The unique URI pointing to the data file. | *Required* | | 2.2 | | ||||||
| [ferryIdsNotAllowedForBicycle](#tf_1_ferryIdsNotAllowedForBicycle) | `string[]` | List ferries which do not allow bikes. | *Optional* | | 2.0 | | ||||||
| [routeToCentroidStationIds](#tf_1_routeToCentroidStationIds) | `string[]` | List stations that should route to centroid. | *Optional* | | 2.6 | | ||||||
|
||||||
<!-- PARAMETERS-TABLE END --> | ||||||
|
||||||
|
@@ -922,6 +924,26 @@ For this reason we allow bicycles on ferries by default and allow to override th | |||||
case where this is not the case. | ||||||
|
||||||
|
||||||
<h3 id="nd_routeToCentroidStationIds">routeToCentroidStationIds</h3> | ||||||
|
||||||
**Since version:** `2.6` ∙ **Type:** `string[]` ∙ **Cardinality:** `Optional` | ||||||
**Path:** /netexDefaults | ||||||
|
||||||
List stations that should route to centroid. | ||||||
|
||||||
This field contains a list of station ids for which the centroid will be used instead | ||||||
of the stop coordinates. | ||||||
|
||||||
When doing street routing from/to a station the default behaviour is to route to any of | ||||||
the stations' child stops. This can cause strange results for stations that have stops | ||||||
spread over a large area. | ||||||
|
||||||
For some stations you might instead wish to use the centroid of the station as the | ||||||
source/destination for street routing. In this case the centroid will be used both for | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
direct street search and for access/egress street search where the station is used as | ||||||
the start/end of the access/egress. | ||||||
|
||||||
|
||||||
<h3 id="osm">osm</h3> | ||||||
|
||||||
**Since version:** `2.2` ∙ **Type:** `object[]` ∙ **Cardinality:** `Optional` | ||||||
|
@@ -1067,6 +1089,26 @@ For this reason we allow bicycles on ferries by default and allow to override th | |||||
case where this is not the case. | ||||||
|
||||||
|
||||||
<h3 id="tf_1_routeToCentroidStationIds">routeToCentroidStationIds</h3> | ||||||
|
||||||
**Since version:** `2.6` ∙ **Type:** `string[]` ∙ **Cardinality:** `Optional` | ||||||
**Path:** /transitFeeds/[1] | ||||||
|
||||||
List stations that should route to centroid. | ||||||
|
||||||
This field contains a list of station ids for which the centroid will be used instead | ||||||
of the stop coordinates. | ||||||
|
||||||
When doing street routing from/to a station the default behaviour is to route to any of | ||||||
the stations' child stops. This can cause strange results for stations that have stops | ||||||
spread over a large area. | ||||||
|
||||||
For some stations you might instead wish to use the centroid of the station as the | ||||||
source/destination for street routing. In this case the centroid will be used both for | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
direct street search and for access/egress street search where the station is used as | ||||||
the start/end of the access/egress. | ||||||
|
||||||
|
||||||
|
||||||
<!-- PARAMETERS-DETAILS END --> | ||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...ava/org/opentripplanner/graph_builder/module/nearbystops/DirectlyConnectedStopFinder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.opentripplanner.graph_builder.module.nearbystops; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Set; | ||
import org.opentripplanner.routing.api.request.RouteRequest; | ||
import org.opentripplanner.routing.api.request.request.StreetRequest; | ||
import org.opentripplanner.routing.graphfinder.NearbyStop; | ||
import org.opentripplanner.street.model.vertex.TransitStopVertex; | ||
import org.opentripplanner.street.model.vertex.Vertex; | ||
import org.opentripplanner.street.search.request.StreetSearchRequest; | ||
import org.opentripplanner.street.search.request.StreetSearchRequestMapper; | ||
import org.opentripplanner.street.search.state.State; | ||
|
||
public class DirectlyConnectedStopFinder { | ||
|
||
/** | ||
* Given a list of vertices, find the ones that corresponds to stops and return them as NearbyStops | ||
habrahamsson-skanetrafiken marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
public static List<NearbyStop> findDirectlyConnectedStops( | ||
t2gran marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Set<Vertex> originVertices, | ||
boolean reverseDirection, | ||
RouteRequest request, | ||
StreetRequest streetRequest | ||
) { | ||
List<NearbyStop> stopsFound = new ArrayList<>(); | ||
|
||
StreetSearchRequest streetSearchRequest = StreetSearchRequestMapper | ||
.mapToTransferRequest(request) | ||
.withArriveBy(reverseDirection) | ||
.withMode(streetRequest.mode()) | ||
.build(); | ||
|
||
for (Vertex vertex : originVertices) { | ||
if (vertex instanceof TransitStopVertex tsv) { | ||
stopsFound.add( | ||
new NearbyStop( | ||
tsv.getStop(), | ||
0, | ||
Collections.emptyList(), | ||
new State(vertex, streetSearchRequest) | ||
) | ||
); | ||
} | ||
} | ||
|
||
return stopsFound; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.