Street routing

Get attributes along a GPS trace

Match a sequence of coordinates to the road network and return attributes along the matched path, such as speed limits, road class, and surface type.

post/valhalla/trace_attributes

Request

  • Base URL: https://transit.land/api/v2/routing
  • URL: https://transit.land/api/v2/routing/valhalla/trace_attributes
  • Auth: one of:
    • API key in header apikey
    • API key in query parameter apikey

Request body

costing'auto' | 'bicycle' | 'pedestrian' | 'truck' | 'bus' | 'taxi' | 'motor_scooter' | 'motorcycle' | 'bikeshare' | 'auto_pedestrian' required

multimodal is not available. The street graph has no transit; use transit routing at /api/v2/routing/otp/plan.

format'json' | 'gpx' | 'osrm' | 'pbf' | 'geotiff' | 'mvt'

Not all formats are supported by all endpoints, e.g. geotiff is isochrone-only.

idstring

Arbitrary request identifier echoed in the response.

languagestring

BCP47 locale for narrative output. See locales/ for supported values.

units'km' | 'miles' | 'mi'
elevation_intervalnumber

Elevation sample interval in meters along the matched path. 0 = disabled.

encoded_polylinestring

Polyline6-encoded trace shape. Mutually exclusive with shape.

shape_format'polyline6' | 'polyline5' | 'geojson' | 'no_shape'

Not all formats are supported by all endpoints, e.g. no_shape is not valid for isochrone.

shape_match'map_snap' | 'edge_walk' | 'walk_or_snap'

Example request

{
  "costing": "auto",
  "exclude_locations": [
    {
      "preferred_side": "opposite",
      "search_filter": {
        "max_road_class": "primary",
        "min_road_class": "primary"
      },
      "street_side_cutoff": "primary",
      "type": "break"
    }
  ],
  "format": "json",
  "shape": [
    {
      "preferred_side": "opposite",
      "search_filter": {
        "max_road_class": "primary",
        "min_road_class": "primary"
      },
      "street_side_cutoff": "primary",
      "type": "break"
    }
  ],
  "shape_format": "polyline6",
  "shape_match": "walk_or_snap",
  "filters": {
    "action": "exclude"
  }
}

Response

Successful response

confidence_scorenumber

How confident the matcher is, from 0 to 1.

elevationnumber[]

Elevation along the path, sampled every elevation_interval. Present with elevation_interval.

elevation_intervalnumber

Spacing of the elevation samples, in meters, or feet when units is miles. Present when the request sets elevation_interval.

idstring

The request's id, echoed back. Absent when the request has none.

osm_changesetinteger

OpenStreetMap changeset the tiles were built from.

raw_scorenumber

Unnormalized matching score. Lower is a closer match.

shapestring

The matched path, as an encoded polyline.

units'kilometers' | 'miles'

Units the lengths, speeds, and elevations are expressed in.

Example response

{
  "admins": [
    {
      "country_code": "US",
      "country_text": "United States",
      "state_code": "CA",
      "state_text": "California"
    }
  ],
  "alternate_paths": [
    {
      "admins": [
        {
          "country_code": "US",
          "country_text": "United States",
          "state_code": "CA",
          "state_text": "California"
        }
      ]
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.