oslew docs
Console
Menu

RoutingroutingoperationId snap

GET/v1/snap

The nearest point on a road to a point, with the road's class and posted limit.

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

Explained in Snapping to roads, Everything at a point and Cleaning GPS traces.

Example

The nearest road to a point.

curl
curl -G "https://api.oslew.com/v1/snap" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  --data-urlencode 'at=19.4326,-99.1332'
Python
from oslew import Client

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

answer = client.snap("19.4326,-99.1332")
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.snap("19.4326,-99.1332");
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 295
ratelimit-reset: 1

{
  "at": [
    19.4326,
    -99.1332
  ],
  "snapped": {
    "from": 355496,
    "to": 355490,
    "frac": 0.16199866758190418,
    "lat": 19.43200133133587,
    "lon": -99.13329035902773,
    "distance_m": 67.23995201279342,
    "time_ds": 110,
    "len_m": 92,
    "two_way": false
  },
  "class": "living_street",
  "speed_limit_kmh": 30,
  "provenance": {
    "name": "overture-transportation",
    "release": "2026-08-19.0",
    "license": "ODbL-1.0"
  },
  "took_us": 320
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Query

NameTypeDescription
at
queryrequired
string
lat,lon.
profile
query
string
driving | walking | cycling | rail
default driving
The mode whose network to snap to.

Responses

200 — The snap, or null beyond 9 km.

  • atnumber[]required
  • classstring | nullrequired
    The road's class.
  • provenanceSource | nullrequired
    • licensestringrequired
    • namestringrequired
    • releasestringrequired
  • snappedEdgeSnap | nullrequired
    • distance_mnumberrequired
      From the query point to the snapped position.
    • fracnumberrequired
      Position along the edge, 0 at from, 1 at to.
    • fromintegerrequired
    • latnumberrequired
    • len_mintegerrequired
    • lonnumberrequired
    • time_dsintegerrequired
    • tointegerrequired
    • two_waybooleanrequired
  • speed_limit_kmhinteger | nullrequired
    Posted limit, when the source gives one.
  • took_usintegerrequired

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.