Route card to print

POST https://api.trailsplits.com/v1/route-card

Checked by a live probe Key optional · 500 credits a day without one 10 credits per call

A card to print and keep for a line you send, as one self-contained HTML page (works offline, no scripts) or a PDF on A4 or Letter: the map, the elevation profile, legs between your waypoints with distance, climb and moving time, water and huts along the line, weather and sun only when you give a date (models named), a cue sheet if you send one, the sources, and a QR code to the trailsplits.com link you give. Nothing is stored or published, and it carries no identity. Climb is "not measured" without heights and "≈" for a terrain estimate; times are your own (leg_seconds) or the hike model’s. 10 credits.

Example

Route card to print (curl)
# Without a key, leave out the Authorization line (500 credits a day per address).
curl --fail-with-body 'https://api.trailsplits.com/v1/route-card' \
  -H "Authorization: Bearer $TRAILSPLITS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"geometry":{"type":"LineString","coordinates":[[6.97178,45.79266],[6.98409,45.80185],[6.98629,45.80488],[6.98231,45.80634],[6.9782,45.80782],[6.9784,45.81286],[6.98961,45.82424],[7.00303,45.82901],[7.0139,45.83525],[7.02084,45.83669],[7.02859,45.84621],[7.03402,45.84664]]},"name":"Courmayeur – Rifugio Bonatti","waypoints":[{"lon":6.971776,"lat":45.792663,"name":"Courmayeur"},{"lon":6.979459,"lat":45.817503,"name":"Midway"},{"lon":7.034022,"lat":45.846641,"name":"Rifugio Bonatti"}],"link":"https://trailsplits.com/planner"}'

The answer is a file to keep (an HTML page or a PDF), so try it from the command line: the curl example saves card.html; add "format": "pdf" for a PDF.

Request body

FieldTypeDescription
gpxstringThe line as GPX (parts kept, no line drawn across a gap). Or geometry, not both. Limits: 5,000 points, 300 km.
geometryobjectA GeoJSON LineString or MultiLineString, [lon, lat].
namestringThe card’s title.
waypointsarrayStart and finish included; placed on the line forward only. Legs run between them.
leg_secondsarrayYour own moving seconds per leg, so the card matches your screen; one per leg.
pace_factorobjectrelaxed, usual, brisk, or a number from 0.5 to 2; used without leg_seconds.
profilestring: hike | run | bike
cuesarrayFor the cue sheet.
unitsstring: metric | imperial
paperstring: a4 | letter
formatstring: html | pdf
departurestringISO time with offset, for a one-part line: adds the weather and sun at the hour each point is reached. Without it there is no weather section.
linkstringThe QR code’s target: a https://trailsplits.com/ address of at most 300 characters. Without it, no QR code.

Errors

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

Contract

A card to print and keep, for a line you post. It comes as self-contained HTML (images inline, so it works offline) or as a PDF on A4 or Letter paper. It carries:

  • the map;
  • the elevation profile;
  • legs between your waypoints, with distance, climb and moving time;
  • water and huts along the line;
  • weather and sun, only when you give a date;
  • a cue sheet, when you send one;
  • the sources;
  • a QR code to the link you give.

What it is, and what it is not.

  • Nothing is stored or published. Making a card saves nothing and carries no identity. The QR code points only where you say, and only to a trailsplits.com address: your /r/ share or the Planner.
  • Hazards and caveats. Fords, aided passages and via ferratas the analysis finds come first, with where they are. The analysis' caveats follow, such as a stretch off any mapped path. When the hike time is outside its calibration (T4 or harder, or much of the line off paths), the time note says it may be too fast.
  • Figures add up to the line. Surfaces, roads and untagged paths are counted on the matched paths, so they are scaled to the line's length.
  • Water and huts are always said. Either listed, or "none within 150 m", or "not available" when the index did not answer.
  • The same facts as the route pages. Climb is "not measured" without heights (never +0 m), and "≈" when it is a terrain estimate. The hardest SAC grade comes with where it starts. Untagged paths are unknown, not easy, and roads are reported apart. Surfaces are tagged on the map or inferred from the kind of way.
  • Weather only for a date. With no departure there is no weather section, never an implied "today". With one, the forecast is read at the hour you reach each point (route weather), the start is printed in the route's own time, and each model is named. On ECMWF hours near freezing, the card says that rain and snow are not told apart.
  • Times and climb are yours when you send them. leg_seconds or moving_seconds makes the card match your screen, and climb makes it state your route page's climb (one route, one climb). Without them, the TrailSplits hike time model's total is shared across legs by their effort, at your pace. Breaks are not included.

Request

A flat object: only the line is required.

{ "geometry": { "type": "MultiLineString", "coordinates": [[[lon, lat], …], [[lon, lat], …]] }, "name": "Tour du Mont Blanc, days 1–2",
  "waypoints": [{ "lon": 6.87, "lat": 45.92, "name": "Les Houches" }, …], "leg_seconds": [16200, 19800],
  "units": "metric", "paper": "a4", "format": "pdf", "link": "https://trailsplits.com/r/abc123" }
FieldDefault
gpx or geometryone of themParts and the gaps between them are kept, and no line is drawn across a gap. Limits as route analysis: 5,000 points, 300 km
name"Route card"The card's title, up to 120 characters
waypointsnoneUp to 60 { lon, lat, name? }, start and finish included. Names at most 80 characters. Each is placed on the line forward only, so an out-and-back's way back is not its way out. A last waypoint that repeats the first, on a closed line, ends at the end. A waypoint within 50 m of the previous one merges into it. One more than 500 m from the line ahead is left out. The card says so for each merge or omission. A start or finish not sent is added, so the legs cover the whole line. Legs run between consecutive waypoints, and one that spans a gap between parts says so. Without waypoints, each part is one leg
leg_secondsnoneMoving seconds per leg, one per leg after placing and merging. A different count is refused with legs_mismatch
moving_secondsnoneA total moving time (your screen's), shared across the card's legs by their distance and climb. Not with leg_seconds
climbnone`{ up_m, down_m, kind: measured \estimated }: your own climb (the route page's), printed as given, with ≈` for an estimate. The legs' climbs add up to it
pace_factorusualrelaxed (1.25), usual (1), brisk (0.85), the Planner's paces, or a number from 0.5 to 2. Used when leg_seconds is not given
profilehikehike, run or bike. Only a hike has a calibrated time; for the others, send leg_seconds
cuesnoneUp to 400 { at_m, text } (text at most 160 characters; e.g. the router's maneuvers) for the cue sheet. Cues beyond the end of the line are left out, and the card says so
unitsmetricmetric or imperial (miles, feet, °F, mph)
papera4a4 or letter
formathtmlhtml or pdf
departurenoneAn ISO time with its offset, for a one-part line. It adds the weather and sun at the hour each point is reached
linknoneThe QR code's target: a https://trailsplits.com/ address of a share (/r/), a route (/route/) or the Planner (/planner), at most 200 characters (what one QR code holds). Without it, there is no QR code
callerOptional label

Response

  • format: html: 200, text/html; charset=utf-8. One self-contained page, with the map as an inline PNG, the profile and the QR code as inline SVG, a print size for the paper, and no scripts or outside resources.
  • format: pdf: 200, application/pdf. Pages of the chosen size in Helvetica: the map, a vector profile, the QR code, the legs, the water and huts, the weather, the cue sheet and the sources. Characters outside WinAnsi print as "?", and "≈" prints as "~".
  • Missing parts: a part that could not be had (the map, the places index, the forecast) is left out, and the card lists it under "Not on this card".

Errors

JSON, { "error": { "code", "message" } }.

HTTPcodeWhen
400invalid_requestNot JSON, an unknown field, a bad name, waypoint, cue, pace, unit, paper, format or link
400invalid_gpx, invalid_coordinatesAs for route analysis
405method_not_allowedAny method but POST (and OPTIONS)
413body_too_large, too_many_pointsOver 1 MB, or over 5,000 points
422too_long, no_lineAs for route analysis
422several_partsA departure with a line of several parts: weather is for one day's line
422legs_mismatchleg_seconds does not have one value per leg
422departure_in_past, beyond_forecastAs for route weather
422budget_exhausted, corridor_too_largeThe job's limit, as for route analysis
503overloaded, tiles_unavailableAs for route analysis

Versioning

Additive content may appear in route-card/1. A change of what a card states, or of a request field's meaning, is route-card/2.