Nearest Point on Line
nearest_point_on_line_toolSnap a point to the nearest position on a line or route and get the closest point plus distance. Works offline for map-matching without API calls.
Instructions
Snap a point to the nearest position on a line or route. Returns the closest point on the line and the distance to it. Useful for "which point on this route is closest to my location?" or map-matching without the API. Works offline without API calls.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"point": "<point>",
"line": "<line>"
},
"name": "nearest_point_on_line_tool"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | LineString coordinates as [longitude, latitude] pairs | |
| point | Yes | The point to snap to the line | |
| units | No | Units for the distance result | kilometers |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| units | Yes | Distance units | |
| nearest | Yes | The nearest point on the line | |
| distance | Yes | Distance from the input point to the nearest point on the line | |
| location | Yes | Distance along the line to the nearest point |