PlannerResource Resource

This is the primary entry point for the trip planning web service. All parameters are passed in the query string. These parameters are defined as fields in the abstract RoutingResource superclass, which also has methods for building routing requests from query parameters. This allows multiple web services to have the same set of query parameters. In order for inheritance to work, the REST resources are request-scoped (constructed at each request) rather than singleton-scoped (a single instance existing for the lifetime of the OTP server).

GET /otp/routers/{routerId}/plan

Request Parameters
name type description constraints multivalued
routerId path The routerId selects between several graphs on the same server. The routerId is pulled from the path, not the query parameters. However, the class RoutingResource is not annotated with a path because we don't want it to be instantiated as an endpoint. Instead, the {routerId} path parameter should be included in the path annotations of all its subclasses.   no
alightSlack query int no
arriveBy query Whether the trip should depart or arrive at the specified date and time. boolean no
bannedAgencies query The comma-separated list of banned agencies.   no
bannedRoutes query The comma-separated list of banned routes. The format is agency_[routename][_routeid], so TriMet_100 (100 is route short name) or Trimet__42 (two underscores, 42 is the route internal ID).   no
bannedStops query A comma-separated list of banned stops. A stop is banned by ignoring its pre-board and pre-alight edges. This means the stop will be reachable via the street network. Also, it is still possible to travel through the stop. Just boarding and alighting is prohibited. The format is agencyId_stopId, so: TriMet_2107   no
bannedStopsHard query A comma-separated list of banned stops. A stop is banned by ignoring its pre-board and pre-alight edges. This means the stop will be reachable via the street network. It is not possible to travel through the stop. For example, this parameter can be used when a train station is destroyed, such that no trains can drive through the station anymore. The format is agencyId_stopId, so: TriMet_2107   no
bannedTrips query The comma-separated list of banned trips. The format is agency_trip[:stop*], so: TriMet_24601 or TriMet_24601:0:1:2:17:18:19   no
batch query If true, goal direction is turned off and a full path tree is built (specify only once) boolean no
bikeBoardCost query Prevents unnecessary transfers by adding a cost for boarding a vehicle. This is the cost that is used when boarding while cycling. This is usually higher that walkBoardCost. int no
bikeSpeed query The user's biking speed in meters/second. Defaults to approximately 11 MPH, or 9.5 for bikeshare. double no
bikeSwitchCost query The cost of the user fetching their bike and parking it again. Defaults to 0. int no
bikeSwitchTime query The time it takes the user to fetch their bike and park it again in seconds. Defaults to 0. int no
boardSlack query int no
clampInitialWait query When subtracting initial wait time, do not subtract more than this value, to prevent overly optimistic trips. Reasoning is that it is reasonable to delay a trip start 15 minutes to make a better trip, but that it is not reasonable to delay a trip start 15 hours; if that is to be done, the time needs to be included in the trip time. This number depends on the transit system; for transit systems where trips are planned around the vehicles, this number can be much higher. For instance, it's perfectly reasonable to delay one's trip 12 hours if one is taking a cross-country Amtrak train from Emeryville to Chicago. Has no effect in stock OTP, only in Analyst. A value of 0 means that initial wait time will not be subtracted out (will be clamped to 0). A value of -1 (the default) means that clamping is disabled, so any amount of initial wait time will be subtracted out. long no
date query The date that the trip should depart (or arrive, for requests where arriveBy is true).   no
disableAlertFiltering query boolean no
disableRemainingWeightHeuristic query If true, the remaining weight heuristic is disabled. Currently only implemented for the long distance path service. boolean no
flexFlagStopBufferSize query double no
flexIgnoreDrtAdvanceBookMin query Whether to ignore DRT time limits. According to the GTFS-flex spec, demand-response transit (DRT) service must be reserved at least `drt_advance_book_min` minutes in advance. OTP not allow DRT service to be used inside that time window, unless this parameter is set to true. boolean no
flexUseEligibilityServices query Whether to use eligibility-based services boolean no
flexUseReservationServices query Whether to use reservation-based services boolean no
fromPlace query The start location -- either latitude, longitude pair in degrees or a Vertex label. For example, 40.714476,-74.005966 or mtanyctsubway_A27_S.   no
geoidElevation query If true, the Graph's ellipsoidToGeoidDifference is applied to all elevations returned by this query. boolean no
ignoreRealtimeUpdates query If true, realtime updates are ignored during this search. boolean no
intermediatePlaces query An ordered list of intermediate locations to be visited (see the fromPlace for format). Parameter can be specified multiple times.   yes
locale query   no
maxHours query double no
maxPreTransitTime query The maximum time (in seconds) of pre-transit travel when using drive-to-transit (park and ride or kiss and ride). Defaults to unlimited. int no
maxTransfers query The maximum number of transfers (that is, one plus the maximum number of boardings) that a trip will be allowed. Larger values will slow performance, but could give better routes. This is limited on the server side by the MAX_TRANSFERS value in org.opentripplanner.api.ws.Planner. int no
maxWalkDistance query The maximum distance (in meters) the user is willing to walk. Defaults to unlimited. double no
minTransferTime query The minimum time, in seconds, between successive trips on different vehicles. This is designed to allow for imperfect schedule adherence. This is a minimum; transfers over longer distances might use a longer time. int no
mode query The set of modes that a user is willing to use, with qualifiers stating whether vehicles should be parked, rented, etc.   no
nonpreferredTransferPenalty query An additional penalty added to boardings after the first when the transfer is not preferred. Preferred transfers also include timed transfers. The value is in OTP's internal weight units, which are roughly equivalent to seconds. Set this to a high value to discourage transfers that are not preferred. Of course, transfers that save significant time or walking will still be taken. When no preferred or timed transfer is defined, this value is ignored. int no
numItineraries query The maximum number of possible itineraries to return. int no
optimize query The set of characteristics that the user wants to optimize for. @See OptimizeType "FLAT" or "GREENWAYS" or "QUICK" or "SAFE" or "TRANSFERS" or "TRIANGLE" no
otherThanPreferredRoutesPenalty query Penalty added for using every route that is not preferred if user set any route as preferred, i.e. number of seconds that we are willing to wait for preferred route. int no
pathComparator query Set the method of sorting itineraries in the response. Right now, the only supported value is "duration"; otherwise it uses default sorting. More sorting methods may be added in the future.   no
preferredAgencies query The comma-separated list of preferred agencies.   no
preferredRoutes query The list of preferred routes. The format is agency_[routename][_routeid], so TriMet_100 (100 is route short name) or Trimet__42 (two underscores, 42 is the route internal ID).   no
reverseOptimizeOnTheFly query If true, this trip will be reverse-optimized on the fly. Otherwise, reverse-optimization will occur once a trip has been chosen (in Analyst, it will not be done at all). boolean no
showIntermediateStops query Whether intermediate stops -- those that the itinerary passes in a vehicle, but does not board or alight at -- should be returned in the response. For example, on a Q train trip from Prospect Park to DeKalb Avenue, whether 7th Avenue and Atlantic Avenue should be included. boolean no
startTransitStopId query A transit stop required to be the first stop in the search (AgencyId_StopId)   no
startTransitTripId query A transit trip acting as a starting "state" for depart-onboard routing (AgencyId_TripId)   no
time query The time that the trip should depart (or arrive, for requests where arriveBy is true).   no
toPlace query The end location (see fromPlace for format).   no
transferPenalty query An additional penalty added to boardings after the first. The value is in OTP's internal weight units, which are roughly equivalent to seconds. Set this to a high value to discourage transfers. Of course, transfers that save significant time or walking will still be taken. int no
triangleSafetyFactor query For bike triangle routing, how much safety matters (range 0-1). double no
triangleSlopeFactor query For bike triangle routing, how much slope matters (range 0-1). double no
triangleTimeFactor query For bike triangle routing, how much time matters (range 0-1). double no
unpreferredAgencies query The comma-separated list of unpreferred agencies.   no
unpreferredRoutes query The list of unpreferred routes. The format is agency_[routename][_routeid], so TriMet_100 (100 is route short name) or Trimet__42 (two underscores, 42 is the route internal ID).   no
useRequestedDateTimeInMaxHours query boolean no
waitAtBeginningFactor query How much less bad is waiting at the beginning of the trip (replaces waitReluctance) double no
waitReluctance query How much worse is waiting for a transit vehicle than being on a transit vehicle, as a multiplier. The default value treats wait and on-vehicle time as the same. It may be tempting to set this higher than walkReluctance (as studies often find this kind of preferences among riders) but the planner will take this literally and walk down a transit line to avoid waiting at a stop. This used to be set less than 1 (0.95) which would make waiting offboard preferable to waiting onboard in an interlined trip. That is also undesirable. If we only tried the shortest possible transfer at each stop to neighboring stop patterns, this problem could disappear. double no
walkBoardCost query Prevents unnecessary transfers by adding a cost for boarding a vehicle. This is the cost that is used when boarding while walking. int no
walkReluctance query A multiplier for how bad walking is, compared to being in transit for equal lengths of time. Defaults to 2. Empirically, values between 10 and 20 seem to correspond well to the concept of not wanting to walk too much without asking for totally ridiculous itineraries, but this observation should in no way be taken as scientific or definitive. Your mileage may vary. double no
walkSpeed query The user's walking speed in meters/second. Defaults to approximately 3 MPH. double no
wheelchair query Whether the trip must be wheelchair accessible. boolean no
whiteListedAgencies query Functions the same as banned agencies, except only the listed agencies are allowed.   no
whiteListedRoutes query Functions the same as bannnedRoutes, except only the listed routes are allowed.   no
Response Body
media type data type description
application/json Response (JSON)
application/xml response (XML)
text/xml response (XML)

Example

Request
GET /routers/{routerId}/plan
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "requestParameters" : {
    "property1" : "...",
    "property2" : "..."
  },
  "debugOutput" : {
    "precalculationTime" : 12345,
    "pathCalculationTime" : 12345,
    "pathTimes" : [ 12345, 12345 ],
    "renderingTime" : 12345,
    "totalTime" : 12345,
    "timedOut" : true
  },
  "elevationMetadata" : {
    "ellipsoidToGeoidDifference" : 12345.0,
    "geoidElevation" : true
  },
  "plan" : {
    "date" : 12345,
    "from" : {
      "name" : "...",
      "stopId" : { },
      "stopCode" : "...",
      "platformCode" : "...",
      "lon" : 12345.0,
      "lat" : 12345.0,
      "arrival" : 12345,
      "departure" : 12345,
      "orig" : "...",
      "zoneId" : "...",
      "stopIndex" : 12345,
      "stopSequence" : 12345,
      "vertexType" : "TRANSIT",
      "bikeShareId" : "...",
      "boardAlightType" : "DEVIATED",
      "flagStopArea" : { }
    },
    "to" : {
      "name" : "...",
      "stopId" : { },
      "stopCode" : "...",
      "platformCode" : "...",
      "lon" : 12345.0,
      "lat" : 12345.0,
      "arrival" : 12345,
      "departure" : 12345,
      "orig" : "...",
      "zoneId" : "...",
      "stopIndex" : 12345,
      "stopSequence" : 12345,
      "vertexType" : "NORMAL",
      "bikeShareId" : "...",
      "boardAlightType" : "DEFAULT",
      "flagStopArea" : { }
    },
    "itineraries" : [ {
      "duration" : 12345,
      "startTime" : 12345,
      "endTime" : 12345,
      "walkTime" : 12345,
      "transitTime" : 12345,
      "waitingTime" : 12345,
      "walkDistance" : 12345.0,
      "walkLimitExceeded" : true,
      "elevationLost" : 12345.0,
      "elevationGained" : 12345.0,
      "transfers" : 12345,
      "fare" : { },
      "legs" : [ { }, { } ],
      "tooSloped" : true
    }, {
      "duration" : 12345,
      "startTime" : 12345,
      "endTime" : 12345,
      "walkTime" : 12345,
      "transitTime" : 12345,
      "waitingTime" : 12345,
      "walkDistance" : 12345.0,
      "walkLimitExceeded" : true,
      "elevationLost" : 12345.0,
      "elevationGained" : 12345.0,
      "transfers" : 12345,
      "fare" : { },
      "legs" : [ { }, { } ],
      "tooSloped" : true
    } ]
  },
  "error" : {
    "id" : 12345,
    "msg" : "...",
    "message" : "GEOCODE_FROM_TO_AMBIGUOUS",
    "missing" : [ "...", "..." ],
    "noPath" : true
  }
}