In case you are not but conversant in GraphQL and GraphiQL it’s extremely really useful to overview these pages at first.

Glossary

Time period Rationalization
Itinerary A mixture of various transportation modes at sure occasions to succeed in from origin to vacation spot. For instance, strolling to a bus cease, taking a bus for 2 stops after which strolling to the ultimate vacation spot.
Generally used synonym: journey
Leg One a part of an itinerary, e.g. strolling to a bus cease or a bus experience between two stops.
Origin A geographical level the place an itinerary begins.
Vacation spot A geographical level the place an itinerary ends.

Be aware about Itinerary leg geometries

You’ll be able to ask the server to return geometries for itineraries. The API will return them in Google polyline-encoded format. It seems to be like this:

You should use this software to see what the polyline seems to be on a map.

See the next examples on tips on how to decode and use polylines:

Question examples

Be aware: For extra particulars in regards to the question sort plan and its parameters you should utilize the Documentation Explorer offered in GraphiQL.

Itinerary planning may be tuned by a number of arguments of the plan question.

  • Time arguments (e.g. minTransferTime, bikeSwitchTime) are taken into consideration actually when planning the itinerary

    • For instance, if minTransferTime is about to 2 minutes, it isn’t doable to proceed the journey by one other car inside two minutes after disembarking one car
    • Values of time arguments are included within the returned length of an itinerary
    • For instance, if there’s a 15 minute bicycling leg and bikeSwitchTime is about to 1 minute, the returned length of the bicycling leg will likely be 17 minutes
  • Value arguments (e.g. walkBoardCost) however are usually not exhausting limits, however preferences

    • For instance, if walkBoardCost is about to 2 minutes, it’s doable to proceed the journey instantly after disembarking from one car, however as much as 2 minutes longer itineraries are most well-liked if they’ve one switch much less and as much as four minutes longer itineraries are most well-liked if they’ve two transfers much less, and so forth.
    • Value will not be included within the returned length of an itinerary
    • For instance, if there’s a 15 minute bicycling leg and bikeSwitchCost is about to 1 minute, the returned length of the bicycling leg will likely be 15 minutes
  • Multiplier arguments (e.g. walkReluctance, modeWeight) are used to multiply prices of an leg

    • For instance, if walkReluctance is about to three.0, the price of every strolling part will likely be multiplied by Three and thus itineraries with much less strolling are most well-liked

Plan an itinerary from location (60.168992,24.932366) to (60.175294,24.684855)

  1. Click on this hyperlink to run the question under in GraphiQL.
{
  plan(
    from: {lat: 60.168992, lon: 24.932366}
    to: {lat: 60.175294, lon: 24.684855}
    numItineraries: 3
  ) {
    itineraries {
      legs {
        startTime
        endTime
        mode
        length
        realTime
        distance
        transitLeg
      }
    }
  }
}
  1. Press play in GraphiQL to execute the question.

Primary route from Kamppi (Helsinki) to Pisa (Espoo)

  1. Click on this hyperlink to run the question under in GraphiQL.
{
  plan(
    fromPlace: "Kamppi, Helsinki::60.168992,24.932366",
    toPlace: "Pisa, Espoo::60.175294,24.684855",
  ) {
    itineraries{
      walkDistance,
      length,
      legs {
        mode
        startTime
        endTime
        from {
          lat
          lon
          identify
          cease {
            code
            identify
          }
        },
        to {
          lat
          lon
          identify
        },
        company {
          gtfsId
	  identify
        },
        distance
        legGeometry {
          size
          factors
        }
      }
    }
  }
}
  1. Press play in GraphiQL to execute the question.

Plan an itinerary utilizing solely WALK and RAIL modes

  1. Click on this hyperlink to run the question under in GraphiQL.
{
  plan(
    from: {lat: 60.199196699999995, lon: 24.9397302}
    to: {lat: 60.168438, lon: 24.929283}
    numItineraries: 3
    transportModes: [{mode: WALK}, {mode: RAIL}]
  ) {
    itineraries {
      legs {
        startTime
        endTime
        mode
        length
        realTime
        distance
        transitLeg
      }
    }
  }
}
  1. Press play in GraphiQL to execute the question.

Plan an itinerary from Hakaniemi to Keilaniemi and modify the next parameters:

  • Return 5 outcomes: (numItineraries: 5)
  • Use transportation modes apart from subway (transportModes)
  • Strolling velocity of 1,7m/s (walkSpeed: 1.7)
  • Use a 10 minute security margin for transfers (minTransferTime: 600)
  • Use a 5 minute boarding value (walkBoardCost: 300)

    • Boarding value is used to choose itineraries with much less car boardings
    • For instance, if walkBoardCost: 300 is used and there’s a 48min itinerary with one boarding and a 45min itinerary with two boardings, the 48 minute itinerary is returned, as a result of its complete value is smaller (48min + 5min vs. 45min + 5min + 5min)
  • Use multiplier of two.1 for stroll reluctance to choose routes with much less strolling (walkReluctance: 2.1)

    • Strolling occasions are multiplied with this multiplier
  • Particular departure date and time

    • date in format YYYY-MM-DD
    • time in format hh:mm:ss
  1. Click on this hyperlink to run the question under in GraphiQL.
{
  plan(
    fromPlace: "Hakaniemi, Helsinki::60.179267,24.951501",
    toPlace: "Keilaniemi, Espoo::60.1762,24.836584",
    date: "2018-08-21",
    time: "23:28:00",
    numItineraries: 5,
    transportModes: [{mode: BUS}, {mode: RAIL}, {mode:TRAM}, {mode: FERRY}, {mode:WALK}]
    walkReluctance: 2.1,
    walkBoardCost: 300,
    minTransferTime: 600,
    walkSpeed: 1.7,
  ) {
    itineraries{
      walkDistance
      length
      legs {
        mode
        startTime
        endTime
        from {
          lat
          lon
          identify
          cease {
            code
            identify
          }
        }
        to {
          lat
          lon
          identify
          cease {
            code
            identify
          }
        }
        journey {
          tripHeadsign
          routeShortName
        }
        distance
        legGeometry {
          size
          factors
        }
      }
    }
  }
}
  1. Change arguments date and time.
  2. Press play in GraphiQL to execute the question.

Plan an itinerary utilizing Park & Journey

  • Utilizing qualifier PARK for CAR mode plans an itinerary utilizing Park & Journey, i.e. the primary leg of the journey is finished by driving to a carpark and persevering with by public transportation from there
  1. Click on this hyperlink to run the question under in GraphiQL.
{
  plan(
    fromPlace: "Seutula::60.34770,24.86569",
    toPlace: "Kamppi::60.16870,24.93129",
    transportModes: [{mode: CAR, qualifier: PARK}, {mode: TRANSIT}, {mode:WALK}]
  ) {
    itineraries{
      walkDistance
      length
      legs {
        mode
        startTime
        endTime
        length
        from {
          lat
          lon
          identify
          cease {
            code
            identify
          }
        }
        to {
          lat
          lon
          identify
          cease {
            code
            identify
          }
          carPark {
            carParkId
            identify
          }
        }
        journey {
          tripHeadsign
          routeShortName
        }
        distance
        legGeometry {
          size
          factors
        }
      }
    }
  }
}
  1. Press play in GraphiQL to execute the question.

Plan an itinerary and question fare info

  • Be aware: At the moment solely common grownup fare info is on the market
  1. Click on this hyperlink to run the question under in GraphiQL.
{
  plan(
    from: {lat: 60.1713572, lon: 24.9416544}
    to: {lat: 60.40431, lon: 25.1066186}
    numItineraries: 3
  ) {
    date
    itineraries {
      legs {
        startTime
        endTime
        mode
        length
        realTime
        distance
        transitLeg
      }
      fares {
        sort
        cents
        forex
      }
    }
  }
}
  1. Press play in GraphiQL to execute the question.

Plan an itinerary with ticket sort restrictions

Question record of obtainable ticket sorts

  • Subject fareId incorporates ticket sort ID that can be utilized with plan question
  • Subject zones incorporates a listing of zones the place the ticket is legitimate
  1. Click on this hyperlink to run the question under in GraphiQL.
{
  ticketTypes {
    fareId
    worth
    forex
    zones
  }
}
  1. Press play in GraphiQL to execute the question.

Plan an itinerary with AB ticket

  • The next question plans an itinerary from Helsinki (zone A) to Tikkurila (zone C) utilizing solely AB ticket
  1. Click on this hyperlink to run the question under in GraphiQL.
{
  plan(
    from: {lat: 60.1713572, lon: 24.9416544}
    to: {lat: 60.29280, lon: 25.04396}
    numItineraries: 3
    allowedTicketTypes: "HSL:AB"
  ) {
    date
    itineraries {
      legs {
        startTime
        endTime
        mode
        route {
          gtfsId
        }
        from {
          identify
          cease {
            zoneId
          }
        }
        to {
          identify
          cease {
            zoneId
          }
        }
        length
        distance
        transitLeg
      }
    }
  }
}
  1. Press play in GraphiQL to execute the question.

Leave a Reply

Your email address will not be published. Required fields are marked *