v1

latestOpenAPI 3.1.02026-08-0420183200.9 KB
Routing

Trace the attributes of roads visited on a route.

The trace attributes endpoint retrieves detailed information along a route, returning details for each section along the path, as well as any intersections encountered. In addition to tracing a recording route, this is great for providing just-in-time info to navigation applications, enabling them to conserve resources by omitting info like speed limits upfront that may be irrelevant if the user goes off-route.

post/trace_attributes/v1

Request body

idstring

An identifier to disambiguate requests (echoed by the server).

encoded_polylinestring

REQUIRED if shape is not present. An encoded polyline (https://developers.google.com/maps/documentation/utilities/polylinealgorithm). Note that the polyline must be encoded with 6 digits of precision rather than the default 5!

costing'auto' | 'auto_traffic' | 'auto_traffic_premium' | 'bus' | 'bus_traffic' | 'bus_traffic_premium' | 'taxi' | 'taxi_traffic' | 'taxi_traffic_premium' | 'truck' | 'truck_traffic' | 'truck_traffic_premium' | 'bicycle' | 'bikeshare' | 'motor_scooter' | 'motorcycle' | 'pedestrian' | 'low_speed_vehicle' required
shape_match'edge_walk' | 'map_snap' | 'walk_or_snap'

Three snapping modes provide some control over how the map matching occurs. edge_walk is fast, but requires extremely precise data that matches the route graph almost perfectly. map_snap can handle significantly noisier data, but is very expensive. walk_or_snap, the default, tries to use edge walking first and falls back to map matching if edge walking fails. In general, you should not need to change this parameter unless you want to trace a multi-leg route with multiple break locations in the shape.

elevation_intervalnumber float

If greater than zero, attempts to include elevation along the route at regular intervals. The "native" internal resolution is 30m, so we recommend you use this when possible. This number is interpreted as either meters or feet depending on the unit parameter. Elevation for route sections containing a bridge or tunnel is interpolated linearly. This doesn't always match the true elevation of the bridge/tunnel, but it prevents sharp artifacts from the surrounding terrain. This functionality is unique to the routing endpoints and is not available via the elevation API. NOTE: This has no effect on the OSRM response format.

units'km' | 'mi'

Example request

{
  "costing": "pedestrian",
  "encoded_polyline": "_grbgAh~{nhF?lBAzBFvBHxBEtBKdB?fB@dBZdBb@hBh@jBb@x@\\|@x@pB\\x@v@hBl@nBPbCXtBn@|@z@ZbAEbAa@~@q@z@QhA]pAUpAVhAPlAWtASpAAdA[dASdAQhAIlARjANnAZhAf@n@`A?lB^nCRbA\\xB`@vBf@tBTbCFbARzBZvBThBRnBNrBP`CHbCF`CNdCb@vBX`ARlAJfADhA@dAFdAP`AR`Ah@hBd@bBl@rBV|B?vB]tBCvBBhAF`CFnBXtAVxAVpAVtAb@|AZ`Bd@~BJfA@fAHdADhADhABjAGzAInAAjAB|BNbCR|BTjBZtB`@lBh@lB\\|Bl@rBXtBN`Al@g@t@?nAA~AKvACvAAlAMdAU`Ac@hAShAI`AJ`AIdAi@bAu@|@k@p@]p@a@bAc@z@g@~@Ot@Bz@f@X`BFtBXdCLbAf@zBh@fBb@xAb@nATjAKjAW`BI|AEpAHjAPdAAfAGdAFjAv@p@XlAVnA?~A?jAInAPtAVxAXnAf@tBDpBJpBXhBJfBDpAZ|Ax@pAz@h@~@lA|@bAnAd@hAj@tAR~AKxAc@xAShA]hAIdAAjA]~A[v@BhB?dBSv@Ct@CvAI~@Oz@Pv@dAz@lAj@~A^`B^|AXvAVpAXdBh@~Ap@fCh@hB\\zBN`Aj@xBFdA@jALbAPbAJdAHdAJbAHbAHfAJhALbA\\lBTvBAdC@bC@jCKjASbC?`CM`CDpB\\xAj@tB\\fA\\bAVfAJdAJbAXz@L|BO`AOdCDdA@~B\\z@l@v@l@v@l@r@j@t@b@x@b@r@z@jBVfCJdAJdANbCPfCF|BRhBS~BS`AYbAe@~BQdA",
  "shape_match": "map_snap",
  "units": "miles"
}

Response

The edges along the traced route with detailed info.

osm_changesetinteger
shapestring
confidence_scorenumber double
idstring

An identifier to disambiguate requests (echoed by the server).

units'miles' | 'kilometers'

Example response

{
  "edges": [
    {
      "sign": {
        "exit_number": [
          "91B"
        ],
        "exit_branch": [
          "I 95 North"
        ],
        "exit_toward": [
          "New York"
        ],
        "exit_name": [
          "Gettysburg Pike"
        ]
      },
      "end_node": {
        "time_zone": "America/New_York"
      }
    }
  ],
  "id": "kesklinn",
  "alternate_paths": [
    {
      "edges": [
        {
          "sign": {
            "exit_number": [
              "91B"
            ],
            "exit_branch": [
              "I 95 North"
            ],
            "exit_toward": [
              "New York"
            ],
            "exit_name": [
              "Gettysburg Pike"
            ]
          },
          "end_node": {
            "time_zone": "America/New_York"
          }
        }
      ]
    }
  ]
}