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 -G "https://api.oslew.com/v1/snap" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'at=19.4326,-99.1332'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")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");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
| Name | Type | Description |
|---|---|---|
atqueryrequired | string | lat,lon. |
profilequery | string driving | walking | cycling | rail default driving | The mode whose network to snap to. |
Responses
200 — The snap, or null beyond 9 km.
atnumber[]requiredclassstring | nullrequiredThe road's class.provenanceSource | nullrequiredlicensestringrequirednamestringrequiredreleasestringrequired
snappedEdgeSnap | nullrequireddistance_mnumberrequiredFrom the query point to the snapped position.fracnumberrequiredPosition along the edge, 0 at from, 1 at to.fromintegerrequiredlatnumberrequiredlen_mintegerrequiredlonnumberrequiredtime_dsintegerrequiredtointegerrequiredtwo_waybooleanrequired
speed_limit_kmhinteger | nullrequiredPosted 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.
| 400 | Bad request. |
| 401 | No key, or one that is unknown, revoked or suspended. |
| 403 | The 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. |
| 429 | This 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. |
| 503 | The 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.