---
title: "POST /v2/snap-to-roads"
method: POST
path: "/v2/snap-to-roads"
---

# POST /v2/snap-to-roads

`POST /v2/snap-to-roads`

`SnapToRoads` matches GPS trace to roads most likely traveled on.

For more information, see [Snap to Roads](https://docs.aws.amazon.com/location/latest/developerguide/snap-to-roads.html) in the _Amazon Location Service Developer Guide_.

## Query parameters

- `key` string, password

## Request body

- object
  - `SnappedGeometryFormat` 'FlexiblePolyline' | 'Simple' — <p>Chooses what the returned SnappedGeometry format should be.</p> <p>Default value: <code>FlexiblePolyline</code> </p>
  - `SnapRadius` integer — <p>The radius around the provided tracepoint that is considered for snapping.</p> <p> <b>Unit</b>: <code>meters</code> </p> <p>Default value: <code>300</code> </p>
  - `TracePoints` RoadSnapTracePoint[], required — List of trace points to be snapped onto the road network.
    - `Heading` number, double — GPS Heading at the position.
    - `Position` Double[], required — Position in World Geodetic System (WGS 84) format: [longitude, latitude].
    - `Speed` number, double — <p>Speed at the specified trace point .</p> <p> <b>Unit</b>: <code>kilometers per hour</code> </p>
    - `Timestamp` string, password — Timestamp of the event.
  - `TravelMode` 'Car' | 'Pedestrian' | 'Scooter' | 'Truck' — <p>Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility.</p> <p>Default value: <code>Car</code> </p>
  - `TravelModeOptions` object — Travel mode related options for the provided travel mode.
    - `Truck` object — Travel mode options when the provided travel mode is <code>Truck</code>.
      - `GrossWeight` integer — <p>Gross weight of the vehicle including trailers, and goods at capacity.</p> <p> <b>Unit</b>: <code>kilograms</code> </p>
      - `HazardousCargos` RoadSnapHazardousCargoType[] — List of Hazardous cargos contained in the vehicle.
      - `Height` integer — <p>Height of the vehicle.</p> <p> <b>Unit</b>: <code>centimeters</code> </p>
      - `Length` integer — <p>Length of the vehicle.</p> <p> <b>Unit</b>: <code>centimeters</code> </p>
      - `Trailer` object — Trailer options corresponding to the vehicle.
        - `TrailerCount` integer — <p>Number of trailers attached to the vehicle.</p> <p>Default value: <code>0</code> </p>
      - `TunnelRestrictionCode` string, password — <p>The tunnel restriction code.</p> <p>Tunnel categories in this list indicate the restrictions which apply to certain tunnels in Great Britain. They relate to the types of dangerous goods that can be transported through them.</p> <ul> <li> <p> <i>Tunnel Category B</i> </p> <ul> <li> <p> <i>Risk Level</i>: Limited risk</p> </li> <li> <p> <i>Restrictions</i>: Few restrictions</p> </li> </ul> </li> <li> <p> <i>Tunnel Category C</i> </p> <ul> <li> <p> <i>Risk Level</i>: Medium risk</p> </li> <li> <p> <i>Restrictions</i>: Some restrictions</p> </li> </ul> </li> <li> <p> <i>Tunnel Category D</i> </p> <ul> <li> <p> <i>Risk Level</i>: High risk</p> </li> <li> <p> <i>Restrictions</i>: Many restrictions occur</p> </li> </ul> </li> <li> <p> <i>Tunnel Category E</i> </p> <ul> <li> <p> <i>Risk Level</i>: Very high risk</p> </li> <li> <p> <i>Restrictions</i>: Restricted tunnel</p> </li> </ul> </li> </ul>
      - `Width` integer — Width of the vehicle in centimeters.

## Response `200`

Success

- SnapToRoadsResponse
  - `Notices` RoadSnapNotice[], required — Notices are additional information returned that indicate issues that occurred during route calculation.
    - `Code` 'TracePointsHeadingIgnored' | 'TracePointsIgnored' | 'TracePointsMovedByLargeDistance' | 'TracePointsNotMatched' | 'TracePointsOutOfSequence' | 'TracePointsSpeedEstimated' | 'TracePointsSpeedIgnored', password, required — Code corresponding to the issue.
    - `Title` string, password, required — The notice title.
    - `TracePointIndexes` Integer[], required — TracePoint indices for which the provided notice code corresponds to.
  - `SnappedGeometry` object — The interpolated geometry for the snapped route onto the road network.
    - `LineString` Position[] — <p>An ordered list of positions used to plot a route on a map.</p> <note> <p>LineString and Polyline are mutually exclusive properties.</p> </note>
      - Double[]
    - `Polyline` string, password — <p>An ordered list of positions used to plot a route on a map in a lossy compression format.</p> <note> <p>LineString and Polyline are mutually exclusive properties.</p> </note>
  - `SnappedGeometryFormat` 'FlexiblePolyline' | 'Simple', required — Specifies the format of the geometry returned for each leg of the route.
  - `SnappedTracePoints` RoadSnapSnappedTracePoint[], required — The trace points snapped onto the road network.
    - `Confidence` number, double, required — Confidence value for the correctness of this point match.
    - `OriginalPosition` Double[], required — Position of the TracePoint provided within the request, at the same index.
    - `SnappedPosition` Double[], required — Snapped position of the TracePoint provided within the request, at the same index.

## Other responses

- `480` — InternalServerException
- `481` — AccessDeniedException
- `482` — ValidationException
- `483` — ThrottlingException

---

[API](https://skmtc.net/aws/apis/geo-routes.md) · [All operations](https://skmtc.net/aws/apis/geo-routes/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/geo-routes/versions/530ae2662aa3/schema)
