Skip to content

Commit

Permalink
Add info about planConnection (temp, uncompete)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikSundell committed May 16, 2024
1 parent 60c69c4 commit 042ae4e
Showing 1 changed file with 42 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ order: 80
| Term | Explanation |
|------------------------|---------------------------------|
| Itinerary | A combination of different transportation modes at certain times to reach from origin to destination. For example, walking to a bus stop, taking a bus for two stops and then walking to the final destination.<br/>Commonly used synonym: journey |
| Leg | One part of an itinerary, e.g. walking to a bus stop or a bus ride between two stops. |
| Node | One part of an itinerary, e.g. walking to a bus stop or a bus ride between two stops. |
| Origin | A geographical point where an itinerary begins. |
| Destination | A geographical point where an itinerary ends. |

Expand Down Expand Up @@ -48,24 +48,39 @@ Itinerary planning can be tuned by multiple arguments of the **plan** query.

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

1. Click [this link](https://api.digitransit.fi/graphiql/hsl?query=%7B%0A%20%20plan(%0A%20%20%20%20from%3A%20%7Blat%3A%2060.168992%2C%20lon%3A%2024.932366%7D%0A%20%20%20%20to%3A%20%7Blat%3A%2060.175294%2C%20lon%3A%2024.684855%7D%0A%20%20%20%20numItineraries%3A%203%0A%20%20)%20%7B%0A%20%20%20%20itineraries%20%7B%0A%20%20%20%20%20%20legs%20%7B%0A%20%20%20%20%20%20%20%20startTime%0A%20%20%20%20%20%20%20%20endTime%0A%20%20%20%20%20%20%20%20mode%0A%20%20%20%20%20%20%20%20duration%0A%20%20%20%20%20%20%20%20realTime%0A%20%20%20%20%20%20%20%20distance%0A%20%20%20%20%20%20%20%20transitLeg%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D) to run the query below in GraphiQL.
1. Click [this link](https://api.digitransit.fi/graphiql/hsl/v2?query=%257B%250A%2520%2520planConnection%28%250A%2520%2520%2520%2520origin%253A%2520%257Blocation%253A%2520%257Bcoordinate%253A%2520%257Blatitude%253A%252060.168992%252C%2520longitude%253A%252024.932366%257D%257D%257D%250A%2520%2520%2520%2520destination%253A%2520%257Blocation%253A%2520%257Bcoordinate%253A%2520%257Blatitude%253A%252060.175294%252C%2520longitude%253A%252024.684855%257D%257D%257D%250A%2520%2520%2520%2520first%253A%25202%250A%2520%2520%29%2520%257B%250A%2520%2520%2520%2520pageInfo%2520%257B%250A%2520%2520%2520%2520%2520%2520endCursor%250A%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520edges%2520%257B%250A%2520%2520%2520%2520%2520%2520node%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520start%250A%2520%2520%2520%2520%2520%2520%2520%2520end%250A%2520%2520%2520%2520%2520%2520%2520%2520legs%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520duration%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mode%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520distance%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520start%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520scheduledTime%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520end%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520scheduledTime%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520mode%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520duration%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520realtimeState%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%2520%2520emissionsPerPerson%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520co2%250A%2520%2520%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%2520%2520%257D%250A%2520%2520%2520%2520%257D%250A%2520%2520%257D%250A%257D) to run the query below in GraphiQL.

```graphql
{
plan(
from: {lat: 60.168992, lon: 24.932366}
to: {lat: 60.175294, lon: 24.684855}
numItineraries: 3
planConnection(
origin: {location: {coordinate: {latitude: 60.168992, longitude: 24.932366}}}
destination: {location: {coordinate: {latitude: 60.175294, longitude: 24.684855}}}
first: 2
) {
itineraries {
legs {
startTime
endTime
mode
duration
realTime
distance
transitLeg
pageInfo {
endCursor
}
edges {
node {
start
end
legs {
duration
mode
distance
start {
scheduledTime
}
end {
scheduledTime
}
mode
duration
realtimeState
}
emissionsPerPerson {
co2
}
}
}
}
Expand All @@ -74,6 +89,18 @@ Itinerary planning can be tuned by multiple arguments of the **plan** query.

2. Press play in GraphiQL to execute the query.

### Pagnation
The `first` argument in the GraphQL query specifies the number of itinerary plans (`nodes`) to be returned. To retrieve more results, you can use the after argument with the value of `endCursor` from the previous query's response.

```graphql
{
planConnection(
origin: {location: {coordinate: {latitude: 60.168992, longitude: 24.932366}}}
destination: {location: {coordinate: {latitude: 60.175294, longitude: 24.684855}}}
first: 2
after: <endCursor from previous query>
)....
```
### Basic route from Kamppi (Helsinki) to Pisa (Espoo)

* Origin and destination locations can be named by using arguments `fromPlace` and `toPlace` instead of `to` and `from`
Expand Down

0 comments on commit 042ae4e

Please sign in to comment.