Directions
The directions query of the Data API. Every request is a POST to https://data.mountaya.com/graphql with a publishable key and a session token: see Authentication.
/graphqlCompute directions between waypoints for a given activity. Returns one or more routes with distance, duration, geometry, and analysis.
Arguments
inputDirectionsInput!
The waypoints to route between, the activity to route for, and the routing preferences to apply.
activityActivitySlug!
One of: HIKING_AND_TRAIL, PROFESSIONAL_TRAIL, RUNNING, ROAD_CYCLING, GRAVEL_BIKE, MOUNTAIN_BIKE, BACKCOUNTRY_SKIING, SKI_TOURING, CROSS_COUNTRY_SKIING, SNOWSHOE_WALKING
Activity to use for routing.
See ActivitySlug.
waypoints[[Float!]!]!
Ordered list of waypoints as [longitude, latitude] coordinate pairs (WGS 84). Must contain between 2 and 45 waypoints, and the straight-line polyline through them, waypoint to waypoint, may be at most 100 km long; either refusal is VALIDATION_FAILED at ["input", "waypoints"]. Each waypoint is exactly two numbers, a longitude between -180 and 180 and a latitude between -90 and 90, and one that is not is VALIDATION_FAILED at ["input", "waypoints", i]. The count, the length and speed are checked before any single waypoint, so an out-of-range waypoint that stretches the polyline past 100 km is first reported at ["input", "waypoints"]. Prefer the fewest waypoints that pin the intended route.
speedFloat
Travel speed in km/h on LEVEL ground, a finite number greater than 0 (anything else, NaN and Infinity included, is VALIDATION_FAILED at ["input", "speed"]). When provided, it replaces the selected activity's default as the flat pace the travel-time model starts from.
avoid[RouteHazard!]
One of: TOLLWAY, RESTRICTED_ACCESS
Hazards to route around. Omitted or empty routes normally.
See RouteHazard.
Returns
directionsDirectionsResult!
Result of a directions computation, containing one or more possible routes.
routes[DirectionsRoute!]!
List of computed routes between the provided waypoints.
distanceFloat!
Total route distance in meters, measured as the planimetric great-circle length of the geometry field, with elevation ignored. Example: 15200.0 for a 15.2 km route.
durationFloat!
Estimated route duration in seconds, computed over the terrain the route crosses rather than over its distance: the model charges for grade, surface and trail difficulty edge by edge, anchored on the requested speed (or the activity default) as the pace on level ground. Integrating analysis.speedInfo over the geometry reproduces this number exactly. Example: 18720.0 for a 5h12m route.
elevationElevationSummary!
Elevation summary including altitude bounds, total gain/loss, and gradient extremes.
altitudeMetricRange!
Altitude range along the route in meters above sea level.
maxFloat!
Upper bound of the range.
minFloat!
Lower bound of the range.
ascentFloat!
Total elevation gain (ascent) in meters.
descentFloat!
Total elevation loss (descent) in meters.
gradientMetricRange!
Gradient range along the route in degrees. Positive values indicate uphill, negative values indicate downhill.
maxFloat!
Upper bound of the range.
minFloat!
Lower bound of the range.
geometryGeoJSON!
GeoJSON geometry representing the route path.
analysisGeometryAnalysis!
Surface and way type analysis for the route geometry, including the advisories naming any tollway or access-restricted way it crosses.
elevationElevationSummary!
Elevation summary over the analyzed geometry, including altitude bounds, total elevation gain/loss, and gradient extremes.
altitudeMetricRange!
Altitude range along the route in meters above sea level.
maxFloat!
Upper bound of the range.
minFloat!
Lower bound of the range.
ascentFloat!
Total elevation gain (ascent) in meters.
descentFloat!
Total elevation loss (descent) in meters.
gradientMetricRange!
Gradient range along the route in degrees. Positive values indicate uphill, negative values indicate downhill.
maxFloat!
Upper bound of the range.
minFloat!
Lower bound of the range.
elevations[Float!]!
Elevation in meters above sea level, one value per vertex, in order: per input coordinate for analyzeGeometry, and per vertex of the returned route geometry for directions and suggestions. Lets the client build a 3D version of the line for an elevation profile. A vertex beyond 85.0511 degrees of latitude, north or south, lies past the elevation source's coverage: it reads 0, which is no data rather than an altitude, and is left out of the ascent, descent, altitude, gradient and slope figures, which describe the covered part alone.
slopeInfo[SlopeInfo!]!
Slope angle segments along the geometry in degrees, referencing coordinate indices.
fromIndexInt!
Start index in the coordinates array (inclusive).
toIndexInt!
End index in the coordinates array (inclusive).
valueFloat!
Slope angle in degrees. Positive values indicate uphill, negative values indicate downhill.
speedInfo[SpeedInfo!]!
Resolved travel speed segments along the geometry in km/h, referencing coordinate indices.
fromIndexInt!
Start index in the coordinates array (inclusive).
toIndexInt!
End index in the coordinates array (inclusive).
valueFloat!
Travel speed in km/h over this stretch. Always positive. Slower than the flat pace on a climb, faster on a descent, and reduced further by a coarse surface or a technical trail. Never above the activity's maximum speed, in km/h: 12 for HIKING_AND_TRAIL, 20 for PROFESSIONAL_TRAIL, 22 for RUNNING, 60 for ROAD_CYCLING, 40 for BACKCOUNTRY_SKIING and SKI_TOURING, 30 for CROSS_COUNTRY_SKIING and 8 for SNOWSHOE_WALKING. A stretch at that cap stays there whatever speed asks for.
surfaceInfo[SurfaceInfo!]!
Surface type segments along the geometry, referencing coordinate indices. analyzeGeometry covers a stretch it has no data for, or one the routing engine failed on (which errors then flags), with one UNKNOWN segment. Empty for the activities that carry no surface, way type or trail difficulty analysis: the four winter activities (BACKCOUNTRY_SKIING, SKI_TOURING, CROSS_COUNTRY_SKIING and SNOWSHOE_WALKING).
fromIndexInt!
Start index in the coordinates array (inclusive).
toIndexInt!
End index in the coordinates array (inclusive).
valueSurfaceType!
One of: UNKNOWN, PAVED, UNPAVED, ASPHALT, CONCRETE, COBBLESTONE, METAL, WOOD, COMPACTED_GRAVEL, FINE_GRAVEL, GRAVEL, DIRT, GROUND, ICE, PAVING_STONES, SAND, WOODCHIPS, GRASS, GRASS_PAVER
Surface type for this coordinate range.
See SurfaceType.
trailDifficultyInfo[TrailDifficultyInfo!]!
Trail difficulty segments along the geometry, referencing coordinate indices. Graded on the SAC hiking scale for walking activities and the mountain-biking scale for cycling ones. analyzeGeometry covers a stretch it has no data for, or one the routing engine failed on (which errors then flags), with one UNKNOWN segment. Empty for the activities with no analysis (see surfaceInfo), and on a route whose routing graph carries no trail-difficulty data.
fromIndexInt!
Start index in the coordinates array (inclusive).
toIndexInt!
End index in the coordinates array (inclusive).
valueTrailDifficultyType!
One of: UNKNOWN, HIKING, MOUNTAIN_HIKING, DEMANDING_MOUNTAIN_HIKING, ALPINE_HIKING, DEMANDING_ALPINE_HIKING, DIFFICULT_ALPINE_HIKING, MTB_0, MTB_1, MTB_2, MTB_3, MTB_4, MTB_5, MTB_6
Trail difficulty for this coordinate range, on the scale matching the activity.
See TrailDifficultyType.
wayTypeInfo[WayTypeInfo!]!
Way type segments along the geometry, referencing coordinate indices. analyzeGeometry covers a stretch it has no data for, or one the routing engine failed on (which errors then flags), with one UNKNOWN segment. Empty for the activities with no analysis (see surfaceInfo).
fromIndexInt!
Start index in the coordinates array (inclusive).
toIndexInt!
End index in the coordinates array (inclusive).
valueWayType!
One of: UNKNOWN, STATE_ROAD, ROAD, STREET, PATH, TRACK, CYCLEWAY, FOOTWAY, STEPS, FERRY, CONSTRUCTION
Way type for this coordinate range.
See WayType.
advisoriesRouteAdvisories!
Route-level hazards the analyzed geometry crosses: tollways and access-restricted ways. For analyzeGeometry this is the union over the whole geometry, so a hazard anywhere along it raises the flag. Both flags are false and both lists empty for the activities with no analysis (see surfaceInfo) under analyzeGeometry, and when the activity cannot be routed at all.
tollwayBoolean!
True when the route crosses at least one way that charges a toll for the activity's mode of travel.
restrictedAccessBoolean!
True when the route crosses at least one way carrying a genuine access restriction. PERMISSIVE grants access rather than restricting it, and AGRICULTURAL and FORESTRY are ordinary terrain on foot, so none of the three raises this flag where the routing engine returns per-stretch access data. Where it returns none, the flag follows the engine's route-level warning, which any access tag raises, those three included.
tollwayInfo[TollwayInfo!]!
The stretches that cross a tollway, referencing coordinate indices, and only those. Empty when there are none, or when the engine returned no per-stretch toll data (read tollway then).
fromIndexInt!
Start index in the coordinates array (inclusive).
toIndexInt!
End index in the coordinates array (inclusive).
valueTollwayType!
One of: NONE, TOLLWAY
Whether this coordinate range crosses a tollway for the activity's mode of travel.
See TollwayType.
roadAccessInfo[RoadAccessRestrictionInfo!]!
The stretches that carry an access tag, referencing coordinate indices, and only those. PERMISSIVE, AGRICULTURAL and FORESTRY stretches are listed too, as information. Empty when there are none, or when the engine returned no per-stretch access data (read restrictedAccess then).
fromIndexInt!
Start index in the coordinates array (inclusive).
toIndexInt!
End index in the coordinates array (inclusive).
values[RoadAccessRestrictionType!]!
One of: NO, CUSTOMERS, DESTINATION, DELIVERY, PRIVATE, PERMISSIVE, PERMIT, RESTRICTED, UNKNOWN, SERVICE, AGRICULTURAL, FORESTRY
Every access restriction tagged on this coordinate range, for the activity's mode of travel. A way can carry several at once. Never empty: a range with no restriction is not reported at all.
avoidanceAvoidanceOutcome!
One of: NOT_REQUESTED, NOT_NEEDED, APPLIED, NO_ROUTE
What the request's avoid list achieved for this route. NOT_REQUESTED when none was given.
See AvoidanceOutcome.
summaryString!
Human-readable route summary. Example: "15.2 km, ~4h12m, +720m / -430m elevation, 62% path, 28% track."
steps[DirectionsStep!]!
Turn-by-turn direction steps along the route, in travel order.
fromIndexInt!
Start index in the route coordinates array (inclusive).
toIndexInt!
End index in the route coordinates array (inclusive).
typeManeuverType!
One of: TURN_LEFT, TURN_RIGHT, SHARP_LEFT, SHARP_RIGHT, SLIGHT_LEFT, SLIGHT_RIGHT, CONTINUE, ENTER_ROUNDABOUT, EXIT_ROUNDABOUT, UTURN, GOAL, DEPART, KEEP_LEFT, KEEP_RIGHT, UNKNOWN
Maneuver to perform at the start of this step.
See ManeuverType.
nameString!
Name of the way/street for this step. May be empty or "-" when unnamed.
distanceFloat!
Length of this step in meters: the routing engine's figure for the step, rescaled by the factor that takes the engine's own route length to the route's measured distance.
durationFloat!
Estimated duration of this step in seconds, from the same travel-time model as the route's duration, over the step's stretch of the geometry.
exitNumberInt
For a roundabout maneuver, the 1-based exit to take. Null for any other maneuver, matching exit_number on the REST resource, which is nullable for the same reason.
Errors A field the API refuses is answered 200, its entry in errors beside the data that resolved. See Errors.
curl https://data.mountaya.com/graphql \
-H "X-API-Key: pk_your_publishable_key" \
-H "X-Session-Token: sess_your_session_token" \
-H "Content-Type: application/json" \
-d '{
"query": "query Directions($input: DirectionsInput!) { directions(input: $input) { routes { distance duration summary } } }",
"variables": {
"input": {
"activity": "HIKING_AND_TRAIL",
"waypoints": [[6.8712, 45.9231], [6.9271, 45.9822]]
}
}
}'