Nearest Point on Line
nearest_point_on_line_toolFind the closest point on a line or route to any location. Returns the nearest coordinate and distance, enabling offline 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.
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 |