Get started
Data API

Analysis

Analysis

analyzeGeometry reads a line you already have, such as a GPX track or a line drawn on a map. It tells you what kind of way each stretch follows, how steep it is, and how long the line takes to travel.

Every routed result already carries this analysis under routes[].analysis. Call analyzeGeometry for a line that came from somewhere else.

Set up

Every sample on this page reuses this setup. It mints a session token with your secret key, so run it on your server.

export MOUNTAYA_PUBLISHABLE_KEY="pk_your_publishable_key"
export MOUNTAYA_SESSION_TOKEN=$(curl -s -X POST https://api.mountaya.com/v1/sessions \
  -H "X-API-Key: $MOUNTAYA_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"publishable_key\": \"$MOUNTAYA_PUBLISHABLE_KEY\"}" | jq -r .data.token)

Analyze a line

This line climbs a trail toward Montenvers, above Chamonix. Coordinates are [longitude, latitude].

curl https://data.mountaya.com/graphql \
  -H "X-API-Key: $MOUNTAYA_PUBLISHABLE_KEY" \
  -H "X-Session-Token: $MOUNTAYA_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query AnalyzeGeometry($input: AnalyzeGeometryInput!) { analyzeGeometry(input: $input) { duration analysis { wayTypeInfo { fromIndex toIndex value } slopeInfo { fromIndex toIndex value } advisories { tollway restrictedAccess } } } }",
    "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], [6.91852, 45.9339],
          [6.91807, 45.93243], [6.91741, 45.93211], [6.91771, 45.93116],
          [6.91826, 45.92968]
        ]
      }
    }
  }'
Response
{
  "data": {
    "analyzeGeometry": {
      "duration": 3134.0508572402764,
      "analysis": {
        "wayTypeInfo": [
          { "fromIndex": 0, "toIndex": 7, "value": "PATH" },
          { "fromIndex": 7, "toIndex": 8, "value": "FOOTWAY" },
          { "fromIndex": 8, "toIndex": 9, "value": "PATH" }
        ],
        "slopeInfo": [
          { "fromIndex": 0, "toIndex": 1, "value": 11.8 },
          { "fromIndex": 1, "toIndex": 2, "value": 16.9 },
          { "fromIndex": 2, "toIndex": 3, "value": 24.2 },
          { "fromIndex": 3, "toIndex": 4, "value": 23.4 },
          { "fromIndex": 4, "toIndex": 5, "value": 16.7 },
          { "fromIndex": 5, "toIndex": 6, "value": 14.2 },
          { "fromIndex": 6, "toIndex": 7, "value": 27.9 },
          { "fromIndex": 7, "toIndex": 8, "value": -2.9 },
          { "fromIndex": 8, "toIndex": 9, "value": -8.9 }
        ],
        "advisories": {
          "tollway": false,
          "restrictedAccess": false
        }
      }
    }
  }
}

Each entry covers the positions from fromIndex to toIndex in the coordinates you sent. Slopes are in degrees, positive uphill. duration is the travel time in seconds over that ground, with the same model directions uses.

What it classifies

ListEach value
wayTypeInfoThe kind of way: PATH, TRACK, FOOTWAY, STREET, and more
surfaceInfoWhat the way is paved with: ASPHALT, GRAVEL, GROUND, and more
slopeInfoThe slope in degrees
trailDifficultyInfoThe trail's difficulty grade
speedInfoThe travel speed the model gives that stretch, in km/h

advisories reports any tollway or access-restricted way the line crosses. See hazards and avoidance.

ActivityAPI valueWire formDirections
Hiking and trail runningHIKING_AND_TRAILhiking-and-trailYes
Professional trailPROFESSIONAL_TRAILprofessional-trailYes, off-network
RunningRUNNINGrunningYes
Road cyclingROAD_CYCLINGroad-cyclingYes
Gravel bikingGRAVEL_BIKEgravel-bikeUnavailable
Mountain bikingMOUNTAIN_BIKEmountain-bikeUnavailable
Backcountry skiingBACKCOUNTRY_SKIINGbackcountry-skiingFreehand line only
Ski touringSKI_TOURINGski-touringYes, off-network
Cross-country skiingCROSS_COUNTRY_SKIINGcross-country-skiingYes
Snowshoe walkingSNOWSHOE_WALKINGsnowshoe-walkingYes

Each routed activity uses a profile tuned to its terrain and movement style. Most activities support turn-by-turn routing, road cycling among them. Backcountry skiing is freehand-line only: no query routes it. Gravel biking and mountain biking are unavailable: the activity catalog does not list them, and every query refuses them, analyzeGeometry included. The GraphQL ActivitySlug enum uses the uppercase value; the Map Studio and Tile APIs use the kebab-case wire form, the same value lowercased with each underscore turned into a hyphen.

Next steps

Last updated