Get started
Data API

Terrain

Terrain

Three queries read the ground itself, with no route involved: terrainSamples at points you know, terrainProfile along a line, and terrainGrid across an area. All three return the same sample: elevation in meters, slope in degrees, and the direction the slope faces.

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)

Samples at points

Read the ground at Chamonix and at the summit of Mont Blanc.

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 TerrainSamples($input: TerrainSamplesInput!) { terrainSamples(input: $input) { count coveredCount samples { point elevation slope aspectOctant steepnessBand } } }",
    "variables": {
      "input": { "locations": [[6.8712, 45.9231], [6.8650, 45.8326]] }
    }
  }'
Response
{
  "data": {
    "terrainSamples": {
      "count": 2,
      "coveredCount": 2,
      "samples": [
        {
          "point": [6.8712, 45.9231],
          "elevation": 1037.6000000000006,
          "slope": 5.436244171334218,
          "aspectOctant": "EAST",
          "steepnessBand": null
        },
        {
          "point": [6.865, 45.8326],
          "elevation": 4801.800000000001,
          "slope": 18.393596328301967,
          "aspectOctant": "SOUTH",
          "steepnessBand": null
        }
      ]
    }
  }
}

Samples come back in the order you sent them. steepnessBand is set only from 25 degrees up, so both points here carry null.

Profile along a line

Read the ground every kilometer on the straight line from Chamonix to Argentière.

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 TerrainProfile($input: TerrainProfileInput!) { terrainProfile(input: $input) { count coveredCount samples { distanceMeters elevation slope } } }",
    "variables": {
      "input": {
        "coordinates": [[6.8712, 45.9231], [6.9271, 45.9822]],
        "spacingMeters": 1000
      }
    }
  }'
Response
{
  "data": {
    "terrainProfile": {
      "count": 9,
      "coveredCount": 9,
      "samples": [
        { "distanceMeters": 0, "elevation": 1037.6000000000006, "slope": 5.436244171334218 },
        { "distanceMeters": 983.1547318196226, "elevation": 1051.3000000000006, "slope": 1.2190580160833666 },
        { "distanceMeters": 1966.3094636406552, "elevation": 1060.2000000000007, "slope": 1.7242231086313489 },
        { "distanceMeters": 2949.4641954601093, "elevation": 1071.6000000000006, "slope": 1.219393890682155 },
        { "distanceMeters": 3932.6189272816146, "elevation": 1088.9000000000005, "slope": 1.724698145275401 },
        { "distanceMeters": 4915.773659101667, "elevation": 1159.7000000000007, "slope": 32.582660614011125 },
        { "distanceMeters": 5898.928390921725, "elevation": 1182.6000000000006, "slope": 3.1079888715479957 },
        { "distanceMeters": 6882.083122743601, "elevation": 1215.1000000000006, "slope": 9.742966980440148 },
        { "distanceMeters": 7865.237854563283, "elevation": 1244.8000000000006, "slope": 0.8630202026282467 }
      ]
    }
  }
}

Read each sample's distanceMeters: the spacing is a target, so samples land 983 m apart here, not 1,000. To profile a saved route, send its segment geometry as coordinates, each position reduced to [longitude, latitude].

Grid over an area

Read the ground on a regular grid to find high, steep, or north-facing terrain. This 2 by 2 grid covers the Mont Blanc summit area.

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 TerrainGrid($input: TerrainGridInput!) { terrainGrid(input: $input) { cols rows coveredCount cells { point elevation aspectOctant steepnessBand } } }",
    "variables": {
      "input": { "bbox": [6.85, 45.83, 6.89, 45.86], "cols": 2, "rows": 2 }
    }
  }'
Response
{
  "data": {
    "terrainGrid": {
      "cols": 2,
      "rows": 2,
      "coveredCount": 4,
      "cells": [
        {
          "point": [6.859999999999999, 45.8525],
          "elevation": 3556.600000000001,
          "aspectOctant": "NORTH_EAST",
          "steepnessBand": "FROM_35_TO_40"
        },
        {
          "point": [6.88, 45.8525],
          "elevation": 4018.900000000001,
          "aspectOctant": "NORTH_WEST",
          "steepnessBand": null
        },
        {
          "point": [6.859999999999999, 45.8375],
          "elevation": 4284.400000000001,
          "aspectOctant": "NORTH_WEST",
          "steepnessBand": "FROM_40_TO_45"
        },
        {
          "point": [6.88, 45.8375],
          "elevation": 3864.000000000001,
          "aspectOctant": "NORTH_EAST",
          "steepnessBand": "FROM_35_TO_40"
        }
      ]
    }
  }
}

Cells run row by row from the north-west corner, each read at its center. aspectOctant and steepnessBand use the same values as the aspect and steepness map overlays.

Elevation tile ceiling

Each query reads at most 256 elevation tiles. If a grid or a long profile is refused, use a smaller box, fewer cells, or a shorter line.

Next steps

Last updated