opentripplanner / OpenTripPlanner

An open source multi-modal trip planner
http://www.opentripplanner.org
Other
2.18k stars 1.02k forks source link

GTFS GraphQL API modeWeight doesn't support all transport modes #6100

Open miklcct opened 2 days ago

miklcct commented 2 days ago

Expected behavior

The reluctance of all transit modes can be set.

Observed behavior

The reluctance of coach and monorail modes are not taken into consideration of routing when supplied as the ModeWeight argument into the plan method of GTFS GraphQL API

Version of OTP used

2.6.0

Data sets in use

A dataset containing coach and monorail services

Command line used to start OTP

Router config and graph build config JSON

router-config.json

{
  "routingDefaults": { 
    "drivingDirection": "left",
    "locale": "en_GB",
    "numItineraries": 10,
    "searchWindow": "PT6H",
    "transferSlack": "PT30S",
    "waitReluctance": 1.76,
    "accessEgress": {
      "maxDuration": "PT2H"
    },
    "walk": {
      "boardCost": 300,
      "reluctance": 1.68
    },
    "wheelchairAccessibility": {
      "trip": {
        "onlyConsiderAccessible": false,
        "unknownCost": 600,
        "inaccessibleCost": 3600
      },
      "stop": {
        "onlyConsiderAccessible": false,
        "unknownCost": 600,
        "inaccessibleCost": 3600
      },
      "elevator": {
        "onlyConsiderAccessible": false
      },
      "inaccessibleStreetReluctance": 25,
      "maxSlope": 0.08333,
      "slopeExceededReluctance": 50,
      "stairsReluctance": 25
    }
  },
  "timetableUpdates": {
    "maxSnapshotFrequency": "PT5S" 
  },
  "transit": {
    "searchThreadPoolSize": 4,
    "transferCacheRequests": [
      {
        "modes" : "WALK",
        "walk" : {
          "boardCost" : 300,
          "reluctance" : 1.68
        }
      }
    ]
  },
  "updaters": [
    {
      "type": "stop-time-updater",
      "url": "${NR_GTFSRT_URL}",
      "feedId" : "NR",
      "frequency": "PT43S"
    }
  ]
}

Steps to reproduce the problem

Plan a query between two places where both rail and coach can reasonable be used. Adjust the modeWeight parameter with "COACH" as key.

Here is the exact query I used, with the relevant argument passed into $modeWeight.

query Plan(
    $date: String!
    , $time: String!
    , $from: InputCoordinates!
    , $to: InputCoordinates!
    , $arriveBy: Boolean!
    , $locale: String
    , $modeWeight: InputModeWeight
    , $wheelchair: Boolean
    , $bikeReluctance: Float
    , $bikeWalkingReluctance: Float
    , $carReluctance: Float
    , $waitReluctance: Float
    , $walkReluctance: Float
    , $bikeSpeed: Float
    , $walkSpeed: Float
    , $walkBoardCost: Int
    , $bikeBoardCost: Int
    , $bikeSwitchCost: Int
    , $bikeSwitchTime: Int
    # FIXME: https://github.com/opentripplanner/OpenTripPlanner/issues/5470
    #, $keepingRentedBicycleAtDestinationCost: Int
    , $boardSlack: Int
    , $alightSlack: Int
    , $transferPenalty: Int
    , $numberOfNextLegs: Int!
) {
  # TODO: convert bikeWalkingSpeed, carParkCost and bikeParkCost to new OTP param
  plan(
    date: $date
    , time: $time
    , from: $from
    , to: $to
    , numItineraries: 10
    , arriveBy: $arriveBy
    , locale: $locale
    , modeWeight: $modeWeight
    , wheelchair: $wheelchair
    , bikeReluctance: $bikeReluctance
    , bikeWalkingReluctance: $bikeWalkingReluctance
    , carReluctance: $carReluctance
    , waitReluctance: $waitReluctance
    , walkReluctance: $walkReluctance
    , bikeSpeed: $bikeSpeed
    , walkSpeed: $walkSpeed
    , walkBoardCost: $walkBoardCost
    , bikeBoardCost: $bikeBoardCost
    , bikeSwitchCost: $bikeSwitchCost
    , bikeSwitchTime: $bikeSwitchTime
    #, keepingRentedBicycleAtDestinationCost: $keepingRentedBicycleAtDestinationCost
    , boardSlack: $boardSlack
    , alightSlack: $alightSlack
    , transferPenalty: $transferPenalty
  ) {
    date
    from {
      name
      lon
      lat
    }
    to {
      name
      lon
      lat
    }
    itineraries {
      startTime
      endTime
      duration
      generalizedCost
      waitingTime
      walkTime
      walkDistance
      legs {
        startTime
        endTime
        departureDelay
        arrivalDelay
        mode
        duration
        generalizedCost
        legGeometry {
          length
          points
        }
        realTime
        distance
        transitLeg
        walkingBike
        rentedBike
        from {
          name
          lat
          lon
          arrivalTime
          departureTime
          stop {
            gtfsId
            name
            lat
            lon
            code
            desc
            platformCode
            parentStation {
              gtfsId
              name
              lat
              lon
              code
              desc
              platformCode
            }
          }
        }
        to {
          name
          lat
          lon
          arrivalTime
          departureTime
          stop {
            gtfsId
            name
            lat
            lon
            code
            desc
            platformCode
            parentStation {
              gtfsId
              name
              lat
              lon
              code
              desc
              platformCode
            }
          }
        }
        trip {
          route {
            gtfsId
            agency {
              gtfsId
              name
              url
              fareUrl
            }
            shortName
            longName
            mode
            type
            desc
            url
            color
            textColor
          }
          directionId
          blockId
          wheelchairAccessible
          bikesAllowed
        }
        intermediatePlaces {
          name
          lat
          lon
          arrivalTime
          departureTime
          stop {
            gtfsId
            name
            lat
            lon
            code
            desc
            platformCode
            parentStation {
              gtfsId
              name
              lat
              lon
              code
              desc
              platformCode
            }
          }
        }
        intermediatePlace
        steps {
          distance
          lon
          lat
          elevationProfile {
            distance
            elevation
          }
          relativeDirection
          absoluteDirection
          streetName
          exit
          stayOn
          area
          bogusName
          walkingBike
        }
        headsign
        pickupType
        dropoffType
        interlineWithPreviousLeg
        nextLegs(
          numberOfLegs: $numberOfNextLegs
          , originModesWithParentStation: [AIRPLANE, BUS, CABLE_CAR, COACH, FERRY, FUNICULAR, GONDOLA, RAIL, SUBWAY, TRAM, CARPOOL, TAXI, TROLLEYBUS, MONORAIL]
          , destinationModesWithParentStation: [AIRPLANE, BUS, CABLE_CAR, COACH, FERRY, FUNICULAR, GONDOLA, RAIL, SUBWAY, TRAM, CARPOOL, TAXI, TROLLEYBUS, MONORAIL]
        ) {
          startTime
          endTime
          departureDelay
          arrivalDelay
          mode
          duration
          generalizedCost
          legGeometry {
            length
            points
          }
          realTime
          distance
          transitLeg
          walkingBike
          rentedBike
          from {
            name
            lat
            lon
            arrivalTime
            departureTime
            stop {
              gtfsId
              name
              lat
              lon
              code
              desc
              platformCode
              parentStation {
                gtfsId
                name
                lat
                lon
                code
                desc
                platformCode
              }
            }
          }
          to {
            name
            lat
            lon
            arrivalTime
            departureTime
            stop {
              gtfsId
              name
              lat
              lon
              code
              desc
              platformCode
              parentStation {
                gtfsId
                name
                lat
                lon
                code
                desc
                platformCode
              }
            }
          }
          trip {
            route {
              gtfsId
              agency {
                gtfsId
                name
                url
                fareUrl
              }
              shortName
              longName
              mode
              type
              desc
              url
              color
              textColor
            }
            directionId
            blockId
            wheelchairAccessible
            bikesAllowed
          }
          intermediatePlaces {
            name
            lat
            lon
            arrivalTime
            departureTime
            stop {
              gtfsId
              name
              lat
              lon
              code
              desc
              platformCode
              parentStation {
                gtfsId
                name
                lat
                lon
                code
                desc
                platformCode
              }
            }
          }
          intermediatePlace
          headsign
          steps {
            distance
            lon
            lat
            elevationProfile {
              distance
              elevation
            }
            relativeDirection
            absoluteDirection
            streetName
            exit
            stayOn
            area
            bogusName
            walkingBike
          }
          pickupType
          dropoffType
          interlineWithPreviousLeg
        }
      }
      elevationGained
      elevationLost
      arrivedAtDestinationWithRentedBicycle
    }
    messageStrings
    routingErrors {
      description
    }
  }
}
miklcct commented 3 hours ago

It seems to be supported in the newer planConnections field.