-
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
OTP2: First itinerary returned is often an implausible walk only trip #3289
Comments
To add to this:
|
Lett me clarify a few things here:
(OtpDefaultSortOrder.java) As you can see, any street all the way is sorted first - this is done because it does not naturally blend in with the transit options. Providing another sort order would be easy - Most of the task would be to document it. The sorting is applied in the filter-chain and the max-limit-itinerary will remove itineraries of the "tail" (after it is sorted).
I hope this was useful, and let us know witch of these features are a MUST for you. |
@t2gran Thanks. Can you clarify what you mean by 'direct mode'? Do you mean that the mode parameter sent to the API call should just contain "TRANSIT" and not "TRANSIT,WALK" if you don't want a WALK only option always returned? Would this still return a WALK-only option if the trip was very short and walking was a better option than transit? Does this apply to all the separate transit modes as well where in OTPv1 you needed to include "WALK". Presumbaly BICYCLE still needs to be treated as before and provided along with TRANSIT etc? This change doesn't seem to be documented anywhere. In the API docs it says: "For a more complete discussion of this parameter see Routing modes." But the internal bookmark doesn't seem to exist. |
Sorry, for the term "direct mode" i thought we changed it on the REST API, but it is only changed in the other APIs and in the internal router. I looked at the rest API and it "try" to map the list of modes to the new internal set of mode parameters: Mode If I read the code correct the current implementation is:
Since the REST API is missing the access, egress, and direct parameters the only thing we can do is to make it as close to the old OTP1 API as we can. The GraphQL APIs have this. I will try to ask about this at the next OTP2 dev meeting on Tue 22.12.2020 at 10:00 CET, feel free to join: https://meet.google.com/qwh-xzbz-atr |
@t2gran, I tried passing just "TRANSIT" as the mode and get no itineraries returned, so I don't think WALK is included? Which I think is what you are saying (for the REST API)? |
Yes I think this is a bug, we should add WALK to the access and egress modes if not street mode is set. Can you live with this until the next OTP2 release, hopefully by the end of Q1 2021? |
@t2gran Yes, fine to wait for the next release, now I'm aware of what's happening. Thanks. |
@t2gran Not sure if this is related to this, or whether I should create a new issue. But |
It seems that this issue has returned (for me) on 2.2 and 2.3, I mention it here: #5062 Is there any way to fix this? |
You can configure when exactly you want to see a walking leg: https://docs.opentripplanner.org/en/dev-2.x/RouteRequest/?h=itin#rd_if_nonTransitGeneralizedCostLimit It's a little complex so read the docs carefully. |
Thanks for that suggestion, unfortunately it doesn't seem to work in my case. As paging next/previous does return the correct itinerary (related issue #5062 ) I have the feeling it's not a router problem, but something else. I will note down my steps and understanding of the nonTransitGeneralizedCostLimit carefully, to make sure that I use that option as intended. The request I run is:
Fold out for API response{
"requestParameters": {
"date": "04-21-2023",
"mode": "TRANSIT,WALK",
"fromPlace": "52.073605,4.303689",
"toPlace": "52.070959889346696,4.285032749176026",
"time": "3:32pm"
},
"plan": {
"date": 1682083920000,
"from": {
"name": "Origin",
"lon": 4.303689,
"lat": 52.073605,
"vertexType": "NORMAL"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"vertexType": "NORMAL"
},
"itineraries": [
{
"duration": 1173,
"startTime": 1682083920000,
"endTime": 1682085093000,
"walkTime": 1173,
"transitTime": 0,
"waitingTime": 0,
"walkDistance": 1475.23,
"walkLimitExceeded": false,
"generalizedCost": 2238,
"elevationLost": 0.0,
"elevationGained": 0.0,
"transfers": 0,
"fare": {
"fare": {
},
"details": {
}
},
"legs": [
{
"startTime": 1682083920000,
"endTime": 1682085093000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 1475.23,
"generalizedCost": 2238,
"pathway": false,
"mode": "WALK",
"transitLeg": false,
"route": "",
"agencyTimeZoneOffset": 7200000,
"interlineWithPreviousLeg": false,
"from": {
"name": "Origin",
"lon": 4.303689,
"lat": 52.073605,
"departure": 1682083920000,
"vertexType": "NORMAL"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"arrival": 1682085093000,
"vertexType": "NORMAL"
},
"legGeometry": {
"points": "csy|H}pgYRt@GDNh@@H\\pAt@xCHZnA~ER|@F^CXIVKNcBtAs@j@CB[ZY^S^Ud@Ul@I\\GZEPANALCPAX@Z?NJx@@L?BHh@?D?@BPDX@R@DDZ@HbAjHt@|FFd@h@~DBN@HHd@BP@L@HRnABPF`@D^BHb@bDNv@Rx@t@rCFPTz@|@fDNt@`@|BP`AF^Jj@TtAJf@@FBN@JBF",
"length": 76
},
"steps": [
{
"distance": 20.85,
"relativeDirection": "DEPART",
"streetName": "Brouwersgracht",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.3036743,
"lat": 52.073621,
"elevation": "",
"walkingBike": false
},
{
"distance": 4.3,
"relativeDirection": "RIGHT",
"streetName": "path",
"absoluteDirection": "NORTHWEST",
"stayOn": false,
"area": false,
"bogusName": true,
"lon": 4.3034086,
"lat": 52.0735288,
"elevation": "",
"walkingBike": false
},
{
"distance": 258.4,
"relativeDirection": "LEFT",
"streetName": "Prinsegracht",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.3033797,
"lat": 52.0735632,
"elevation": "",
"walkingBike": false
},
{
"distance": 321.06,
"relativeDirection": "SLIGHTLY_RIGHT",
"streetName": "Lijnbaan",
"absoluteDirection": "NORTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.3000719,
"lat": 52.0724851,
"elevation": "",
"walkingBike": false
},
{
"distance": 870.67,
"relativeDirection": "CONTINUE",
"streetName": "Loosduinseweg",
"absoluteDirection": "WEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.296729,
"lat": 52.0740016,
"elevation": "",
"walkingBike": false
}
],
"rentedBike": false,
"walkingBike": false,
"duration": 1173.0
}
],
"tooSloped": false,
"arrivedAtDestinationWithRentedBicycle": false
},
{
"duration": 346,
"startTime": 1682084099000,
"endTime": 1682084445000,
"walkTime": 30,
"transitTime": 316,
"waitingTime": 0,
"walkDistance": 28.2,
"walkLimitExceeded": false,
"generalizedCost": 969,
"elevationLost": 0.0,
"elevationGained": 0.0,
"transfers": 0,
"fare": {
"fare": {
},
"details": {
}
},
"legs": [
{
"startTime": 1682084099000,
"endTime": 1682084415000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 1307.94,
"generalizedCost": 916,
"pathway": false,
"mode": "TRAM",
"transitLeg": true,
"route": "Lijn 4",
"agencyName": "HTM",
"agencyUrl": "http://www.htm.nl",
"agencyTimeZoneOffset": 7200000,
"routeColor": "ef7100",
"routeType": 0,
"routeId": "NL:84735",
"routeTextColor": "000000",
"interlineWithPreviousLeg": false,
"tripShortName": "40119",
"headsign": "DH De Uithof",
"agencyId": "NL:HTM",
"tripId": "NL:166141799",
"serviceDate": "2023-04-21",
"from": {
"name": "Den Haag, Brouwersgracht",
"stopId": "NL:2506373",
"stopCode": "2824",
"lon": 4.303689,
"lat": 52.073605,
"departure": 1682084099000,
"stopIndex": 19,
"stopSequence": 20,
"vertexType": "TRANSIT"
},
"to": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682084415000,
"departure": 1682084415000,
"stopIndex": 22,
"stopSequence": 23,
"vertexType": "TRANSIT"
},
"legGeometry": {
"points": "}ry|H_qgYx@l[??`Adi@??tK`k@",
"length": 6
},
"steps": [
],
"routeShortName": "4",
"routeLongName": "Lijn 4",
"duration": 316.0
},
{
"startTime": 1682084415000,
"endTime": 1682084445000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 28.2,
"generalizedCost": 51,
"pathway": false,
"mode": "WALK",
"transitLeg": false,
"route": "",
"agencyTimeZoneOffset": 7200000,
"interlineWithPreviousLeg": false,
"from": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682084415000,
"departure": 1682084415000,
"vertexType": "TRANSIT"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"arrival": 1682084445000,
"vertexType": "NORMAL"
},
"legGeometry": {
"points": "kby|Hi~cYBA@FBRAB??MF@JBF",
"length": 9
},
"steps": [
{
"distance": 28.2,
"relativeDirection": "DEPART",
"streetName": "Loosduinseweg",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.2853418,
"lat": 52.0709292,
"elevation": "",
"walkingBike": false
}
],
"rentedBike": false,
"walkingBike": false,
"duration": 30.0
}
],
"tooSloped": false,
"arrivedAtDestinationWithRentedBicycle": false
},
{
"duration": 346,
"startTime": 1682084102000,
"endTime": 1682084448000,
"walkTime": 30,
"transitTime": 316,
"waitingTime": 0,
"walkDistance": 28.2,
"walkLimitExceeded": false,
"generalizedCost": 969,
"elevationLost": 0.0,
"elevationGained": 0.0,
"transfers": 0,
"fare": {
"fare": {
},
"details": {
}
},
"legs": [
{
"startTime": 1682084102000,
"endTime": 1682084418000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 1307.94,
"generalizedCost": 916,
"pathway": false,
"mode": "TRAM",
"transitLeg": true,
"route": "Kraaijenstein - Leidschendam Leidsenhage",
"agencyName": "HTM",
"agencyUrl": "http://www.htm.nl",
"agencyTimeZoneOffset": 7200000,
"routeType": 0,
"routeId": "NL:84732",
"interlineWithPreviousLeg": false,
"tripShortName": "20092",
"headsign": "DH Kraayenstein",
"agencyId": "NL:HTM",
"tripId": "NL:166143554",
"serviceDate": "2023-04-21",
"from": {
"name": "Den Haag, Brouwersgracht",
"stopId": "NL:2506373",
"stopCode": "2824",
"lon": 4.303689,
"lat": 52.073605,
"departure": 1682084102000,
"stopIndex": 14,
"stopSequence": 15,
"vertexType": "TRANSIT"
},
"to": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682084418000,
"departure": 1682084418000,
"stopIndex": 17,
"stopSequence": 18,
"vertexType": "TRANSIT"
},
"legGeometry": {
"points": "}ry|H_qgYx@l[??`Adi@??tK`k@",
"length": 6
},
"steps": [
],
"routeShortName": "2",
"routeLongName": "Kraaijenstein - Leidschendam Leidsenhage",
"duration": 316.0
},
{
"startTime": 1682084418000,
"endTime": 1682084448000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 28.2,
"generalizedCost": 51,
"pathway": false,
"mode": "WALK",
"transitLeg": false,
"route": "",
"agencyTimeZoneOffset": 7200000,
"interlineWithPreviousLeg": false,
"from": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682084418000,
"departure": 1682084418000,
"vertexType": "TRANSIT"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"arrival": 1682084448000,
"vertexType": "NORMAL"
},
"legGeometry": {
"points": "kby|Hi~cYBA@FBRAB??MF@JBF",
"length": 9
},
"steps": [
{
"distance": 28.2,
"relativeDirection": "DEPART",
"streetName": "Loosduinseweg",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.2853418,
"lat": 52.0709292,
"elevation": "",
"walkingBike": false
}
],
"rentedBike": false,
"walkingBike": false,
"duration": 30.0
}
],
"tooSloped": false,
"arrivedAtDestinationWithRentedBicycle": false
},
{
"duration": 346,
"startTime": 1682084699000,
"endTime": 1682085045000,
"walkTime": 30,
"transitTime": 316,
"waitingTime": 0,
"walkDistance": 28.2,
"walkLimitExceeded": false,
"generalizedCost": 969,
"elevationLost": 0.0,
"elevationGained": 0.0,
"transfers": 0,
"fare": {
"fare": {
},
"details": {
}
},
"legs": [
{
"startTime": 1682084699000,
"endTime": 1682085015000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 1307.94,
"generalizedCost": 916,
"pathway": false,
"mode": "TRAM",
"transitLeg": true,
"route": "Lijn 4",
"agencyName": "HTM",
"agencyUrl": "http://www.htm.nl",
"agencyTimeZoneOffset": 7200000,
"routeColor": "ef7100",
"routeType": 0,
"routeId": "NL:84735",
"routeTextColor": "000000",
"interlineWithPreviousLeg": false,
"tripShortName": "40121",
"headsign": "DH De Uithof",
"agencyId": "NL:HTM",
"tripId": "NL:166141801",
"serviceDate": "2023-04-21",
"from": {
"name": "Den Haag, Brouwersgracht",
"stopId": "NL:2506373",
"stopCode": "2824",
"lon": 4.303689,
"lat": 52.073605,
"departure": 1682084699000,
"stopIndex": 19,
"stopSequence": 20,
"vertexType": "TRANSIT"
},
"to": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682085015000,
"departure": 1682085015000,
"stopIndex": 22,
"stopSequence": 23,
"vertexType": "TRANSIT"
},
"legGeometry": {
"points": "}ry|H_qgYx@l[??`Adi@??tK`k@",
"length": 6
},
"steps": [
],
"routeShortName": "4",
"routeLongName": "Lijn 4",
"duration": 316.0
},
{
"startTime": 1682085015000,
"endTime": 1682085045000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 28.2,
"generalizedCost": 51,
"pathway": false,
"mode": "WALK",
"transitLeg": false,
"route": "",
"agencyTimeZoneOffset": 7200000,
"interlineWithPreviousLeg": false,
"from": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682085015000,
"departure": 1682085015000,
"vertexType": "TRANSIT"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"arrival": 1682085045000,
"vertexType": "NORMAL"
},
"legGeometry": {
"points": "kby|Hi~cYBA@FBRAB??MF@JBF",
"length": 9
},
"steps": [
{
"distance": 28.2,
"relativeDirection": "DEPART",
"streetName": "Loosduinseweg",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.2853418,
"lat": 52.0709292,
"elevation": "",
"walkingBike": false
}
],
"rentedBike": false,
"walkingBike": false,
"duration": 30.0
}
],
"tooSloped": false,
"arrivedAtDestinationWithRentedBicycle": false
}
]
},
"metadata": {
"searchWindowUsed": 2400,
"nextDateTime": 1682084820000,
"prevDateTime": 1682081520000
},
"previousPageCursor": "rO0ABXc1AQANUFJFVklPVVNfUEFHRQY2pfCAAAAAAAAJYAAXU1RSRUVUX0FORF9BUlJJVkFMX1RJTUU=",
"nextPageCursor": "rO0ABXcxAQAJTkVYVF9QQUdFBjay1IAAAAAAAAlgABdTVFJFRVRfQU5EX0FSUklWQUxfVElNRQ==",
"debugOutput": {
"precalculationTime": 148690,
"directStreetRouterTime": 9792032,
"transitRouterTime": 632385842,
"filteringTime": 1594812,
"renderingTime": 1019426,
"totalTime": 645004536,
"transitRouterTimes": {
"tripPatternFilterTime": 99954918,
"accessEgressTime": 120800178,
"raptorSearchTime": 409956304,
"itineraryCreationTime": 1653727
}
},
"elevationMetadata": {
"ellipsoidToGeoidDifference": 47.694913775834976,
"geoidElevation": false
}
} I use the text from the docs as a guide:
OK, my request returns 4 itineraries (I capped that with
That is 969 in my case.
The default function is
None of the returned generalized costs is larger than 5538, so nothing is dropped. Works as expected. Add `nonTransitGeneralizedCostLimit``Now I add the
API response{
"requestParameters": {
"date": "04-21-2023",
"mode": "TRANSIT,WALK",
"fromPlace": "52.073605,4.303689",
"nonTransitGeneralizedCostLimit": "f(x) = 1.5 x",
"toPlace": "52.070959889346696,4.285032749176026",
"time": "3:32pm"
},
"plan": {
"date": 1682083920000,
"from": {
"name": "Origin",
"lon": 4.303689,
"lat": 52.073605,
"vertexType": "NORMAL"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"vertexType": "NORMAL"
},
"itineraries": [
{
"duration": 1173,
"startTime": 1682083920000,
"endTime": 1682085093000,
"walkTime": 1173,
"transitTime": 0,
"waitingTime": 0,
"walkDistance": 1475.23,
"walkLimitExceeded": false,
"generalizedCost": 2238,
"elevationLost": 0.0,
"elevationGained": 0.0,
"transfers": 0,
"fare": {
"fare": {
},
"details": {
}
},
"legs": [
{
"startTime": 1682083920000,
"endTime": 1682085093000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 1475.23,
"generalizedCost": 2238,
"pathway": false,
"mode": "WALK",
"transitLeg": false,
"route": "",
"agencyTimeZoneOffset": 7200000,
"interlineWithPreviousLeg": false,
"from": {
"name": "Origin",
"lon": 4.303689,
"lat": 52.073605,
"departure": 1682083920000,
"vertexType": "NORMAL"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"arrival": 1682085093000,
"vertexType": "NORMAL"
},
"legGeometry": {
"points": "csy|H}pgYRt@GDNh@@H\\pAt@xCHZnA~ER|@F^CXIVKNcBtAs@j@CB[ZY^S^Ud@Ul@I\\GZEPANALCPAX@Z?NJx@@L?BHh@?D?@BPDX@R@DDZ@HbAjHt@|FFd@h@~DBN@HHd@BP@L@HRnABPF`@D^BHb@bDNv@Rx@t@rCFPTz@|@fDNt@`@|BP`AF^Jj@TtAJf@@FBN@JBF",
"length": 76
},
"steps": [
{
"distance": 20.85,
"relativeDirection": "DEPART",
"streetName": "Brouwersgracht",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.3036743,
"lat": 52.073621,
"elevation": "",
"walkingBike": false
},
{
"distance": 4.3,
"relativeDirection": "RIGHT",
"streetName": "path",
"absoluteDirection": "NORTHWEST",
"stayOn": false,
"area": false,
"bogusName": true,
"lon": 4.3034086,
"lat": 52.0735288,
"elevation": "",
"walkingBike": false
},
{
"distance": 258.4,
"relativeDirection": "LEFT",
"streetName": "Prinsegracht",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.3033797,
"lat": 52.0735632,
"elevation": "",
"walkingBike": false
},
{
"distance": 321.06,
"relativeDirection": "SLIGHTLY_RIGHT",
"streetName": "Lijnbaan",
"absoluteDirection": "NORTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.3000719,
"lat": 52.0724851,
"elevation": "",
"walkingBike": false
},
{
"distance": 870.67,
"relativeDirection": "CONTINUE",
"streetName": "Loosduinseweg",
"absoluteDirection": "WEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.296729,
"lat": 52.0740016,
"elevation": "",
"walkingBike": false
}
],
"rentedBike": false,
"walkingBike": false,
"duration": 1173.0
}
],
"tooSloped": false,
"arrivedAtDestinationWithRentedBicycle": false
},
{
"duration": 346,
"startTime": 1682084099000,
"endTime": 1682084445000,
"walkTime": 30,
"transitTime": 316,
"waitingTime": 0,
"walkDistance": 28.2,
"walkLimitExceeded": false,
"generalizedCost": 969,
"elevationLost": 0.0,
"elevationGained": 0.0,
"transfers": 0,
"fare": {
"fare": {
},
"details": {
}
},
"legs": [
{
"startTime": 1682084099000,
"endTime": 1682084415000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 1307.94,
"generalizedCost": 916,
"pathway": false,
"mode": "TRAM",
"transitLeg": true,
"route": "Lijn 4",
"agencyName": "HTM",
"agencyUrl": "http://www.htm.nl",
"agencyTimeZoneOffset": 7200000,
"routeColor": "ef7100",
"routeType": 0,
"routeId": "NL:84735",
"routeTextColor": "000000",
"interlineWithPreviousLeg": false,
"tripShortName": "40119",
"headsign": "DH De Uithof",
"agencyId": "NL:HTM",
"tripId": "NL:166141799",
"serviceDate": "2023-04-21",
"from": {
"name": "Den Haag, Brouwersgracht",
"stopId": "NL:2506373",
"stopCode": "2824",
"lon": 4.303689,
"lat": 52.073605,
"departure": 1682084099000,
"stopIndex": 19,
"stopSequence": 20,
"vertexType": "TRANSIT"
},
"to": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682084415000,
"departure": 1682084415000,
"stopIndex": 22,
"stopSequence": 23,
"vertexType": "TRANSIT"
},
"legGeometry": {
"points": "}ry|H_qgYx@l[??`Adi@??tK`k@",
"length": 6
},
"steps": [
],
"routeShortName": "4",
"routeLongName": "Lijn 4",
"duration": 316.0
},
{
"startTime": 1682084415000,
"endTime": 1682084445000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 28.2,
"generalizedCost": 51,
"pathway": false,
"mode": "WALK",
"transitLeg": false,
"route": "",
"agencyTimeZoneOffset": 7200000,
"interlineWithPreviousLeg": false,
"from": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682084415000,
"departure": 1682084415000,
"vertexType": "TRANSIT"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"arrival": 1682084445000,
"vertexType": "NORMAL"
},
"legGeometry": {
"points": "kby|Hi~cYBA@FBRAB??MF@JBF",
"length": 9
},
"steps": [
{
"distance": 28.2,
"relativeDirection": "DEPART",
"streetName": "Loosduinseweg",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.2853418,
"lat": 52.0709292,
"elevation": "",
"walkingBike": false
}
],
"rentedBike": false,
"walkingBike": false,
"duration": 30.0
}
],
"tooSloped": false,
"arrivedAtDestinationWithRentedBicycle": false
},
{
"duration": 346,
"startTime": 1682084102000,
"endTime": 1682084448000,
"walkTime": 30,
"transitTime": 316,
"waitingTime": 0,
"walkDistance": 28.2,
"walkLimitExceeded": false,
"generalizedCost": 969,
"elevationLost": 0.0,
"elevationGained": 0.0,
"transfers": 0,
"fare": {
"fare": {
},
"details": {
}
},
"legs": [
{
"startTime": 1682084102000,
"endTime": 1682084418000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 1307.94,
"generalizedCost": 916,
"pathway": false,
"mode": "TRAM",
"transitLeg": true,
"route": "Kraaijenstein - Leidschendam Leidsenhage",
"agencyName": "HTM",
"agencyUrl": "http://www.htm.nl",
"agencyTimeZoneOffset": 7200000,
"routeType": 0,
"routeId": "NL:84732",
"interlineWithPreviousLeg": false,
"tripShortName": "20092",
"headsign": "DH Kraayenstein",
"agencyId": "NL:HTM",
"tripId": "NL:166143554",
"serviceDate": "2023-04-21",
"from": {
"name": "Den Haag, Brouwersgracht",
"stopId": "NL:2506373",
"stopCode": "2824",
"lon": 4.303689,
"lat": 52.073605,
"departure": 1682084102000,
"stopIndex": 14,
"stopSequence": 15,
"vertexType": "TRANSIT"
},
"to": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682084418000,
"departure": 1682084418000,
"stopIndex": 17,
"stopSequence": 18,
"vertexType": "TRANSIT"
},
"legGeometry": {
"points": "}ry|H_qgYx@l[??`Adi@??tK`k@",
"length": 6
},
"steps": [
],
"routeShortName": "2",
"routeLongName": "Kraaijenstein - Leidschendam Leidsenhage",
"duration": 316.0
},
{
"startTime": 1682084418000,
"endTime": 1682084448000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 28.2,
"generalizedCost": 51,
"pathway": false,
"mode": "WALK",
"transitLeg": false,
"route": "",
"agencyTimeZoneOffset": 7200000,
"interlineWithPreviousLeg": false,
"from": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682084418000,
"departure": 1682084418000,
"vertexType": "TRANSIT"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"arrival": 1682084448000,
"vertexType": "NORMAL"
},
"legGeometry": {
"points": "kby|Hi~cYBA@FBRAB??MF@JBF",
"length": 9
},
"steps": [
{
"distance": 28.2,
"relativeDirection": "DEPART",
"streetName": "Loosduinseweg",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.2853418,
"lat": 52.0709292,
"elevation": "",
"walkingBike": false
}
],
"rentedBike": false,
"walkingBike": false,
"duration": 30.0
}
],
"tooSloped": false,
"arrivedAtDestinationWithRentedBicycle": false
},
{
"duration": 346,
"startTime": 1682084699000,
"endTime": 1682085045000,
"walkTime": 30,
"transitTime": 316,
"waitingTime": 0,
"walkDistance": 28.2,
"walkLimitExceeded": false,
"generalizedCost": 969,
"elevationLost": 0.0,
"elevationGained": 0.0,
"transfers": 0,
"fare": {
"fare": {
},
"details": {
}
},
"legs": [
{
"startTime": 1682084699000,
"endTime": 1682085015000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 1307.94,
"generalizedCost": 916,
"pathway": false,
"mode": "TRAM",
"transitLeg": true,
"route": "Lijn 4",
"agencyName": "HTM",
"agencyUrl": "http://www.htm.nl",
"agencyTimeZoneOffset": 7200000,
"routeColor": "ef7100",
"routeType": 0,
"routeId": "NL:84735",
"routeTextColor": "000000",
"interlineWithPreviousLeg": false,
"tripShortName": "40121",
"headsign": "DH De Uithof",
"agencyId": "NL:HTM",
"tripId": "NL:166141801",
"serviceDate": "2023-04-21",
"from": {
"name": "Den Haag, Brouwersgracht",
"stopId": "NL:2506373",
"stopCode": "2824",
"lon": 4.303689,
"lat": 52.073605,
"departure": 1682084699000,
"stopIndex": 19,
"stopSequence": 20,
"vertexType": "TRANSIT"
},
"to": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682085015000,
"departure": 1682085015000,
"stopIndex": 22,
"stopSequence": 23,
"vertexType": "TRANSIT"
},
"legGeometry": {
"points": "}ry|H_qgYx@l[??`Adi@??tK`k@",
"length": 6
},
"steps": [
],
"routeShortName": "4",
"routeLongName": "Lijn 4",
"duration": 316.0
},
{
"startTime": 1682085015000,
"endTime": 1682085045000,
"departureDelay": 0,
"arrivalDelay": 0,
"realTime": false,
"distance": 28.2,
"generalizedCost": 51,
"pathway": false,
"mode": "WALK",
"transitLeg": false,
"route": "",
"agencyTimeZoneOffset": 7200000,
"interlineWithPreviousLeg": false,
"from": {
"name": "Den Haag, De la Reyweg",
"stopId": "NL:2506413",
"stopCode": "3003",
"lon": 4.285331,
"lat": 52.070944,
"arrival": 1682085015000,
"departure": 1682085015000,
"vertexType": "TRANSIT"
},
"to": {
"name": "Destination",
"lon": 4.2850327,
"lat": 52.0709599,
"arrival": 1682085045000,
"vertexType": "NORMAL"
},
"legGeometry": {
"points": "kby|Hi~cYBA@FBRAB??MF@JBF",
"length": 9
},
"steps": [
{
"distance": 28.2,
"relativeDirection": "DEPART",
"streetName": "Loosduinseweg",
"absoluteDirection": "SOUTHWEST",
"stayOn": false,
"area": false,
"bogusName": false,
"lon": 4.2853418,
"lat": 52.0709292,
"elevation": "",
"walkingBike": false
}
],
"rentedBike": false,
"walkingBike": false,
"duration": 30.0
}
],
"tooSloped": false,
"arrivedAtDestinationWithRentedBicycle": false
}
]
},
"metadata": {
"searchWindowUsed": 2400,
"nextDateTime": 1682084820000,
"prevDateTime": 1682081520000
},
"previousPageCursor": "rO0ABXc1AQANUFJFVklPVVNfUEFHRQY2pfCAAAAAAAAJYAAXU1RSRUVUX0FORF9BUlJJVkFMX1RJTUU=",
"nextPageCursor": "rO0ABXcxAQAJTkVYVF9QQUdFBjay1IAAAAAAAAlgABdTVFJFRVRfQU5EX0FSUklWQUxfVElNRQ==",
"debugOutput": {
"precalculationTime": 83168,
"directStreetRouterTime": 8183940,
"transitRouterTime": 589834714,
"filteringTime": 1053999,
"renderingTime": 671756,
"totalTime": 599870349,
"transitRouterTimes": {
"tripPatternFilterTime": 90307955,
"accessEgressTime": 103007135,
"raptorSearchTime": 395519902,
"itineraryCreationTime": 995137
}
},
"elevationMetadata": {
"ellipsoidToGeoidDifference": 47.694913775834976,
"geoidElevation": false
}
}
OK, my request returns 4 itineraries (I capped that with
That is 969 in my case.
My function is
The WALK itinerary has a cost of 2238, which is larger than 1453.5. However, it is not dropped. This works different than I expected. Other things I tried that didn't make a difference:
|
This parameter is not available though the API. You need to add it to router-config.json. The docs have an example file. It's easy to nest the params incorrectly so look at the example quite carefully. |
https://docs.opentripplanner.org/en/dev-2.x/RouterConfiguration/#router-config-example The example is here but it appears there is no example value for your exact parameter. |
Thank you very much! Tthat was the information I was missing. With the following router-config.json: {
"routingDefaults": {
"numItineraries": 4,
"itineraryFilters": {
"nonTransitGeneralizedCostLimit": "0 + 1.5 x"
}
}
} The route request
Filters out the option for walking succesfully: The other issue (#5062) remains though, as the paging seems to invoke a call to the planner with a different |
Expected behavior
That the top suggested itinerary should be the "best" as determined by OTP
Observed behavior
For example, a two hour walk is suggested as the top itinerary when the fastest transit trip is 40 minutes
Version of OTP used (exact commit hash or JAR name)
v2.0.0
Example attached.
Query used:
http://localhost:8080/?module=planner&fromPlace=53.4820190316094%2C-2.2446441650390625&toPlace=53.41863787930069%2C-2.2063636779785156&time=7%3A11pm&date=12-11-2020&mode=TRANSIT%2CWALK&arriveBy=false
The text was updated successfully, but these errors were encountered: