Get started
Data API

Analysis

Analysis

analyzeGeometry classifies an existing line: it segments the geometry by surface (paved, gravel, dirt, and so on), by way type (path, track, footway, and so on), and by slope angle. Every routing result already carries this analysis under route.analysis; call analyzeGeometry directly when you have a geometry from elsewhere, for example a GPX track or a user-drawn line, and want the same breakdown.

All coordinates are [longitude, latitude] in WGS 84.

ActivityAPI valueWire formDirections
Hiking and trail runningHIKING_AND_TRAILhikingandtrailYes
Professional trailPROFESSIONAL_TRAILprofessionaltrailYes, off-network
RunningRUNNINGrunningYes
Backcountry skiingBACKCOUNTRY_SKIINGbackcountryskiingFreehand line only
Ski touringSKI_TOURINGskitouringYes, off-network
Cross-country skiingCROSS_COUNTRY_SKIINGcrosscountryskiingYes
Snowshoe walkingSNOWSHOE_WALKINGsnowshoewalkingYes
Gravel bikingGRAVEL_BIKEgravelbikeNot yet available
Mountain bikingMOUNTAIN_BIKEmountainbikeNot yet available
Road cyclingROAD_CYCLINGroadcyclingNot yet available

Each activity routes on a profile tuned to its terrain and movement style. Directions availability varies: most activities support turn-by-turn routing, backcountry skiing is freehand-line only, and cycling activities are not yet available for routing. The GraphQL ActivitySlug enum uses the uppercase value; the Map Studio and Tile APIs use the lowercase, underscore-free wire form.

analyzeGeometry

Input

analyzeGeometry(input: AnalyzeGeometryInput!)

activity

ActivitySlug!

required

Activity to analyze for. Selects the profile used to interpret way and surface suitability.

coordinates

[[Float!]!]!

required

Ordered list of [longitude, latitude] pairs forming the geometry.

Example

query AnalyzeGeometry($input: AnalyzeGeometryInput!) {
  analyzeGeometry(input: $input) {
    surfaceInfo {
      fromIndex
      toIndex
      value
    }
    waytypeInfo {
      fromIndex
      toIndex
      value
    }
    slopeInfo {
      fromIndex
      toIndex
      value
    }
  }
}

Response

GeometryAnalysis returns lists of segments plus the route-level advisories. Each segment references a range of the input coordinates by index, so you can map a classification back onto the exact part of the line it covers.

surfaceInfo

[SurfaceInfo!]!

Surface-type segments. Each entry has fromIndex, toIndex, and a value of SurfaceType (for example ASPHALT, GRAVEL, DIRT).

waytypeInfo

[WaytypeInfo!]!

Way-type segments. Each entry has fromIndex, toIndex, and a value of WaytypeType (for example PATH, TRACK, FOOTWAY).

slopeInfo

[SlopeInfo!]!

Slope segments. Each entry has fromIndex, toIndex, and a value slope angle in degrees. Positive is uphill, negative is downhill.

advisories

RouteAdvisories!

Any tollway or access-restricted way the geometry crosses, as the union over the whole line. The same shape directions and suggestions return — see hazards and avoidance.

The fromIndex and toIndex of each segment are inclusive indices into the coordinates array you sent. See routing for the same analysis attached to computed routes, and the playground for the full SurfaceType and WaytypeType value lists.

Next steps