Skip to content

maxTransfers cannot be changed by scripts and different default than web interface #2507

Description

@lapseofreason

The default maxTransfers should be the same in scripting and web interface, preferably a value of at least 4 (at least in my use case). Moreover, it would be useful to be able to configure it in scripts (see patch below).

I am running OTP in scripting mode (jython). When comparing its results to results from the web interface and to Google Maps, I noticed very long walking distances. The resulting total time is way over the actually needed time. After a lot of searching I found out that this is due to maxTransfers being set to 2 for scripts, whereas it is 4 for the web interface.

Affects OTP v1.2.0.

Patch to set maxTransfers and maxTransferWalkDistance in Scripts:

--- a/src/main/java/org/opentripplanner/scripting/api/OtpsRoutingRequest.java
+++ b/src/main/java/org/opentripplanner/scripting/api/OtpsRoutingRequest.java
@@ -91,6 +91,14 @@ public class OtpsRoutingRequest {
         req.maxWalkDistance = maxWalkDistance;
     }
 
+    public void setMaxTransferWalkDistance(double maxTransferWalkDistance) {
+        req.maxTransferWalkDistance = maxTransferWalkDistance;
+    }
+
+    public void setMaxTransfers(int maxTransfers) {
+        req.maxTransfers = maxTransfers;
+    }
+
     public void setWheelchairAccessible(boolean wheelchairAccessible) {
         req.wheelchairAccessible = wheelchairAccessible;
     }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions