Geometry analysis
The analyzeGeometry 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.
/graphqlAnalyze surface and way type of an existing geometry. An analysis the routing engine failed on in part is answered as analysis states.
Arguments
inputAnalyzeGeometryInput!
The geometry to analyze and the activity to analyze it for.
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 analysis.
See ActivitySlug.
coordinates[[Float!]!]!
Ordered list of [longitude, latitude] coordinate pairs forming the geometry (WGS 84). Between 2 and 10,000 positions; a count outside that range is VALIDATION_FAILED at ["input", "coordinates"]. The line, measured along its positions, is at most 500 km long; a longer one is VALIDATION_FAILED at ["input", "coordinates"], decided before any elevation or routing work. Each 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", "coordinates", i]. Example: [[6.8667, 45.9195], [6.8712, 45.9231], [6.8790, 45.9160]] (a short trail segment).
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"], never answered at the activity default), replacing the activity's default as the pace duration is anchored to. Omitted uses the activity default. Each stretch's resolved speed is capped at the activity's maximum speed (see SpeedInfo).
Returns
analyzeGeometryAnalyzeGeometryResult!
The result of analyzeGeometry.
analysisGeometryAnalysis!
The analysis of the submitted geometry: elevation, slope, surface, way type, trail difficulty and route-level advisories.
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.
durationFloat!
Estimated travel duration of the submitted geometry in seconds, over the terrain the analysis just read.
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 AnalyzeGeometry($input: AnalyzeGeometryInput!) { analyzeGeometry(input: $input) { analysis { elevations } duration } }",
"variables": {
"input": {
"activity": "HIKING_AND_TRAIL",
"coordinates": [
[6.91692, 45.93976],
[6.91732, 45.93898],
[6.91722, 45.93799],
[6.91713, 45.93745],
[6.91787, 45.93614]
]
}
}
}'