Skip to content

Terrain pixel sampling

GET https://api.trailsplits.com/tiles/v1/elevation/{release}/sample

Checked by a live probe Key optional · 500 credits a day without one 1 credit per call (per 2,048 points) 5 requests/s

Pipe-separated lat,lon. Producer accepts up to 2048 points, clamps requested zoom to available backing data and returns one modelled metre height per point. null is missing, never zero. Does not densify or smooth a line. Example consumers impose smaller bounds. Unknown accuracy/source resolution is not surveyed truth.

Example

Terrain pixel sampling (curl)
# Without a key, leave out the Authorization line (500 credits a day per address).
curl --fail-with-body 'https://api.trailsplits.com/tiles/v1/elevation/current/sample?points=46.5369000%2C12.1352000%7C46.5367714%2C12.1348857%7C46.5366429%2C12.1345714%7C46.5365143%2C12.1342571%7C46.5363857%2C12.1339429%7C46.5362571%2C12.1336286%7C46.5361286%2C12.1333143%7C46.5360000%2C12.1330000&z=12&encoding=mapbox' \
  -H "Authorization: Bearer $TRAILSPLITS_API_KEY"

Sends a real request, with your key or the keyless allowance.

Parameters

NameInDescription
releaserequiredpathPublished terrain version, or mutable current. Demo resolves/pins a version.
pointsrequiredquery1–2048 lat,lon pairs separated by |; example uses 8/16/32.
zqueryRequested zoom; response z is the effective zoom.
encodingqueryUse mapbox for the published terrain. Other encoding is compatibility input, not a second dataset.

Response

FieldTypeDescription
releasestring
zinteger
z_requestedinteger
encodingstring: mapbox | terrarium
pointsarray
Full response schema (JSON Schema)
{
  "type": "object",
  "properties": {
    "release": {
      "type": "string"
    },
    "z": {
      "type": "integer",
      "minimum": 0,
      "maximum": 22
    },
    "z_requested": {
      "type": "integer"
    },
    "encoding": {
      "type": "string",
      "enum": [
        "mapbox",
        "terrarium"
      ]
    },
    "points": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "lat": {
            "type": "number"
          },
          "lon": {
            "type": "number"
          },
          "elevation_m": {
            "type": "number",
            "nullable": true
          }
        },
        "required": [
          "lat",
          "lon",
          "elevation_m"
        ]
      }
    }
  },
  "required": [
    "release",
    "z",
    "encoding",
    "points"
  ]
}

Errors

400, 404, 500, plus the gateway's 401, 429 and 503 (every error code). A refused request costs no credits.