Was this helpful?
The Alpaca platform allows an Itinerary Direction to contain multiple different route sections which could represent multiple different transport modes when moving between locations.
An example of this use case could be suit presenting a route that includes
traveling using walk
, transit
, plane
all together. This is often useful in
presenting transit based routes, where a user may mix transportation to move
between locations.
omit-list
and omit-detail
flags, which can allow you to plot locations for each stop,
such as the start and stop of the walking leg, the start and stop of the
transit leg, then using the omit
flags to stop them being presented in the
list. There are other trade-offs with this approach.
When creating your Itinerary Directions, you are able to specify multiple segments that can represent different parts of the directions. These provide the opportunity to change the mode of transport.
1# Creates itinerary directions for between locations in an itinerary. Uses
2# the input variable of "segments" containing a sequence of segments, each
3# containing their own mode
4
5mutation createItineraryDirections(
6 $itineraryId: ID!
7 $originItineraryLocationId: ID!
8 $destinationItineraryLocationId: ID!
9 $segments: [RouteSegmentInput!]!
10) {
11 # use createItineraryDirections to create directions in an itinerary
12 createItineraryDirections(
13 # Supply the itinerary ID
14 itineraryId: $itineraryId
15 # Provide the model for directions
16 directions: {
17 # Provide the route for the directions
18 route: {
19 # Create segments for each mode. Add additional segments sequentially
20 # here as we support modal, e.g. Foot -> Car -> Foot etc. depending on
21 # the fidelity of the directions
22 segments: $segments
23 }
24 # Contextualise the directions from origin/destination
25 # Origin itinerary location
26 originId: $originItineraryLocationId
27 # Position under the destination itinerary location
28 positionAtEnd: {
29 # Destination itinerary location
30 parentId: $destinationItineraryLocationId
31 }
32 }
33 ) {
34 # Query what was affected as a response
35 cascaded {
36 created {
37 id
38 __typename
39 }
40 }
41 }
42}
Sandbox: Configure | Try Operation
Copyright © 2024 - Made with love ❤️ in Australia.