oslew docs
Console
Menu

RoutingroutingoperationId match

POST/v1/match

Match a GPS trace onto the roads (Newson–Krumm HMM): per point the edge and position it most likely lies on, the matched route, its length and duration, and a confidence.

Send Authorization: Bearer sk_live_…. The key's plan must include therouting product; which plans do.

Explained in Map matching and Cleaning GPS traces.

Example

A two-minute GPS trace.

curl
curl -X POST "https://api.oslew.com/v1/match" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"points":[{"lat":19.419276,"lon":-99.179338,"time":1790175600},{"lat":19.418751,"lon":-99.179701,"time":1790175605},{"lat":19.41867,"lon":-99.179614,"time":1790175610},{"lat":19.418502,"lon":-99.179014,"time":1790175615},{"lat":19.418286,"lon":-99.178608,"time":1790175620},{"lat":19.417033,"lon":-99.179268,"time":1790175625},{"lat":19.416802,"lon":-99.179338,"time":1790175630},{"lat":19.416776,"lon":-99.178855,"time":1790175635},{"lat":19.416914,"lon":-99.178812,"time":1790175640},{"lat":19.418012,"lon":-99.178069,"time":1790175645},{"lat":19.418268,"lon":-99.178079,"time":1790175650},{"lat":19.418769,"lon":-99.177802,"time":1790175655},{"lat":19.419165,"lon":-99.177555,"time":1790175660},{"lat":19.419798,"lon":-99.177323,"time":1790175665},{"lat":19.419971,"lon":-99.177179,"time":1790175670},{"lat":19.420875,"lon":-99.177583,"time":1790175675},{"lat":19.421131,"lon":-99.177514,"time":1790175680},{"lat":19.42292,"lon":-99.177679,"time":1790175685},{"lat":19.423246,"lon":-99.176215,"time":1790175690},{"lat":19.42322,"lon":-99.175986,"time":1790175695},{"lat":19.423306,"lon":-99.175722,"time":1790175700},{"lat":19.423814,"lon":-99.174224,"time":1790175705},{"lat":19.424459,"lon":-99.172921,"time":1790175710},{"lat":19.424828,"lon":-99.172014,"time":1790175715},{"lat":19.425023,"lon":-99.171867,"time":1790175720}],"geometry":false}'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.match(
    {
    "points": [
        {"lat": 19.419276, "lon": -99.179338, "time": 1790175600},
        {"lat": 19.418751, "lon": -99.179701, "time": 1790175605},
        {"lat": 19.41867, "lon": -99.179614, "time": 1790175610},
        {"lat": 19.418502, "lon": -99.179014, "time": 1790175615},
        {"lat": 19.418286, "lon": -99.178608, "time": 1790175620},
        {"lat": 19.417033, "lon": -99.179268, "time": 1790175625},
        {"lat": 19.416802, "lon": -99.179338, "time": 1790175630},
        {"lat": 19.416776, "lon": -99.178855, "time": 1790175635},
        {"lat": 19.416914, "lon": -99.178812, "time": 1790175640},
        {"lat": 19.418012, "lon": -99.178069, "time": 1790175645},
        {"lat": 19.418268, "lon": -99.178079, "time": 1790175650},
        {"lat": 19.418769, "lon": -99.177802, "time": 1790175655},
        {"lat": 19.419165, "lon": -99.177555, "time": 1790175660},
        {"lat": 19.419798, "lon": -99.177323, "time": 1790175665},
        {"lat": 19.419971, "lon": -99.177179, "time": 1790175670},
        {"lat": 19.420875, "lon": -99.177583, "time": 1790175675},
        {"lat": 19.421131, "lon": -99.177514, "time": 1790175680},
        {"lat": 19.42292, "lon": -99.177679, "time": 1790175685},
        {"lat": 19.423246, "lon": -99.176215, "time": 1790175690},
        {"lat": 19.42322, "lon": -99.175986, "time": 1790175695},
        {"lat": 19.423306, "lon": -99.175722, "time": 1790175700},
        {"lat": 19.423814, "lon": -99.174224, "time": 1790175705},
        {"lat": 19.424459, "lon": -99.172921, "time": 1790175710},
        {"lat": 19.424828, "lon": -99.172014, "time": 1790175715},
        {"lat": 19.425023, "lon": -99.171867, "time": 1790175720},
    ],
    "geometry": False,
},
)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.match({
  points: [
    { lat: 19.419276, lon: -99.179338, time: 1790175600 },
    { lat: 19.418751, lon: -99.179701, time: 1790175605 },
    { lat: 19.41867, lon: -99.179614, time: 1790175610 },
    { lat: 19.418502, lon: -99.179014, time: 1790175615 },
    { lat: 19.418286, lon: -99.178608, time: 1790175620 },
    { lat: 19.417033, lon: -99.179268, time: 1790175625 },
    { lat: 19.416802, lon: -99.179338, time: 1790175630 },
    { lat: 19.416776, lon: -99.178855, time: 1790175635 },
    { lat: 19.416914, lon: -99.178812, time: 1790175640 },
    { lat: 19.418012, lon: -99.178069, time: 1790175645 },
    { lat: 19.418268, lon: -99.178079, time: 1790175650 },
    { lat: 19.418769, lon: -99.177802, time: 1790175655 },
    { lat: 19.419165, lon: -99.177555, time: 1790175660 },
    { lat: 19.419798, lon: -99.177323, time: 1790175665 },
    { lat: 19.419971, lon: -99.177179, time: 1790175670 },
    { lat: 19.420875, lon: -99.177583, time: 1790175675 },
    { lat: 19.421131, lon: -99.177514, time: 1790175680 },
    { lat: 19.42292, lon: -99.177679, time: 1790175685 },
    { lat: 19.423246, lon: -99.176215, time: 1790175690 },
    { lat: 19.42322, lon: -99.175986, time: 1790175695 },
    { lat: 19.423306, lon: -99.175722, time: 1790175700 },
    { lat: 19.423814, lon: -99.174224, time: 1790175705 },
    { lat: 19.424459, lon: -99.172921, time: 1790175710 },
    { lat: 19.424828, lon: -99.172014, time: 1790175715 },
    { lat: 19.425023, lon: -99.171867, time: 1790175720 },
  ],
  geometry: false,
});
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 294
ratelimit-reset: 1

{
  "points": [
    {
      "lat": 19.419265833691888,
      "lon": -99.1793149055659,
      "from": 362390,
      "to": 362686,
      "along": 0.16342062635322144,
      "distance_m": 2.6727302657997343
    },
    {
      "lat": 19.418717279588495,
      "lon": -99.1795863931191,
      "from": 362686,
      "to": 362687,
      "along": 0,
      "distance_m": 12.590083383713226
    },
    {
      "lat": 19.418717279588495,
      "lon": -99.1795863931191,
      "from": 362686,
      "to": 362687,
      "along": 0,
      "distance_m": 6.001708302961281
    },
    {
      "lat": 19.418447264747087,
      "lon": -99.17902412186542,
      "from": 362688,
      "to": 361352,
      "along": 0,
      "distance_m": 6.1781608772235606
    },
    {
      "lat": 19.41828749262708,
      "lon": -99.17860207985096,
      "from": 361352,
      "to": 362389,
      "along": 0.045549726075291,
      "distance_m": 0.6426478129502552
    }
  ],
  "speed_limits_kmh": [
    50,
    null,
    null,
    null,
    null
  ],
  "classes": [
    "primary",
    "residential",
    "residential",
    "residential",
    "residential"
  ],
  "geometry": [],
  "distance_m": 1835,
  "duration_s": 154.9,
  "confidence": 0.8,
  "matched": 25,
  "unmatched": 0,
  "provenance": {
    "name": "overture-transportation",
    "release": "2026-08-19.0",
    "license": "ODbL-1.0"
  },
  "took_us": 3881
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call. Shortened for the page: points shows 5 of 25. Shortened for the page: speed_limits_kmh shows 5 of 25. Shortened for the page: classes shows 5 of 25.

Body

application/json, required.

  • pointsobject[]required≤ 10000 items
    • latnumberrequired
    • lonnumberrequired
    • timeinteger | null
  • geometryboolean
  • profilestring
    The mode whose network to match onto.
    driving | walking | cycling | rail
  • search_mnumber≥ 5, ≤ 200
    How far from a point a road may be, metres.
  • sigma_mnumber≥ 1, ≤ 50
    The GPS noise, metres.

Responses

200 — The match.

  • classes(string | null[])required
    The class of each matched edge.
  • confidencenumberrequired≥ 0, ≤ 1
  • distance_mnumberrequired
  • duration_snumberrequired
  • geometrynumber[][]required
  • matchedintegerrequired
  • points(Matched | null[])required
    • alongnumberrequired
      0..1 along the edge.
    • distance_mnumberrequired
      From the observed point.
    • fromintegerrequired
    • latnumberrequired
    • lonnumberrequired
    • tointegerrequired
  • provenanceSourcerequired
    • licensestringrequired
    • namestringrequired
    • releasestringrequired
  • speed_limits_kmh(integer | null[])required
    The posted limit on each matched edge.
  • took_usintegerrequired
  • unmatchedintegerrequired

With RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset(and their X-RateLimit-* aliases); see rate limits.

Refusals

Every refusal is a JSON object with an error string, except where noted.

400Bad request.
401No key, or one that is unknown, revoked or suspended.
403The key's plan does not include this route's product, or the request is larger than the plan allows. The body names the plan that does.
429This product's bucket is empty: the key is going faster than its plan's sustained rate. Wait Retry-After seconds; nothing is used up. Carries Retry-After.
503The pod cannot reach the control plane and its entitlements are too old to trust. Retry.

A malformed query string or JSON body is refused by the framework before this route runs, in plain text rather than JSON; see errors.

Rendered from the OpenAPI document at commit b8f4bde-dirty; the same document is served at/v1/openapi.json and generates both clients.