SnapToRoads - Amazon Location Service

SnapToRoads

SnapToRoads matches GPS trace to roads most likely traveled on.

Request Syntax

POST /snap-to-roads?key=Key HTTP/1.1 Content-type: application/json { "SnappedGeometryFormat": "string", "SnapRadius": number, "TracePoints": [ { "Heading": number, "Position": [ number ], "Speed": number, "Timestamp": "string" } ], "TravelMode": "string", "TravelModeOptions": { "Truck": { "GrossWeight": number, "HazardousCargos": [ "string" ], "Height": number, "Length": number, "Trailer": { "TrailerCount": number }, "TunnelRestrictionCode": "string", "Width": number } } }

URI Request Parameters

The request uses the following URI parameters.

Key

Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.

Length Constraints: Minimum length of 0. Maximum length of 1000.

Request Body

The request accepts the following data in JSON format.

SnappedGeometryFormat

Chooses what the returned SnappedGeometry format should be.

Default Value: FlexiblePolyline

Type: String

Valid Values: FlexiblePolyline | Simple

Required: No

SnapRadius

The radius around the provided tracepoint that is considered for snapping.

Unit: meters

Default value: 300

Type: Long

Valid Range: Minimum value of 0. Maximum value of 10000.

Required: No

TracePoints

List of trace points to be snapped onto the road network.

Type: Array of RoadSnapTracePoint objects

Array Members: Minimum number of 2 items. Maximum number of 5000 items.

Required: Yes

TravelMode

Specifies the mode of transport when calculating a route. Used in estimating the speed of travel and road compatibility.

Default Value: Car

Type: String

Valid Values: Car | Pedestrian | Scooter | Truck

Required: No

TravelModeOptions

Travel mode related options for the provided travel mode.

Type: RoadSnapTravelModeOptions object

Required: No

Response Syntax

HTTP/1.1 200 x-amz-geo-pricing-bucket: PricingBucket Content-type: application/json { "Notices": [ { "Code": "string", "Title": "string", "TracePointIndexes": [ number ] } ], "SnappedGeometry": { "LineString": [ [ number ] ], "Polyline": "string" }, "SnappedGeometryFormat": "string", "SnappedTracePoints": [ { "Confidence": number, "OriginalPosition": [ number ], "SnappedPosition": [ number ] } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The response returns the following HTTP headers.

PricingBucket

The pricing bucket for which the query is charged at.

The following data is returned in JSON format by the service.

Notices

Notices are additional information returned that indicate issues that occurred during route calculation.

Type: Array of RoadSnapNotice objects

SnappedGeometry

The interpolated geometry for the snapped route onto the road network.

Type: RoadSnapSnappedGeometry object

SnappedGeometryFormat

Specifies the format of the geometry returned for each leg of the route.

Type: String

Valid Values: FlexiblePolyline | Simple

SnappedTracePoints

The trace points snapped onto the road network.

Type: Array of RoadSnapSnappedTracePoint objects

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

You don't have sufficient access to perform this action.

HTTP Status Code: 403

InternalServerException

The request processing has failed because of an unknown error, exception or failure.

HTTP Status Code: 500

ThrottlingException

The request was denied due to request throttling.

HTTP Status Code: 429

ValidationException

The input fails to satisfy the constraints specified by an AWS service.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: