LocationServiceRoutesV2 / Client / snap_to_roads

snap_to_roads#

LocationServiceRoutesV2.Client.snap_to_roads(**kwargs)#

The SnapToRoads action matches GPS trace to roads most likely traveled on.

See also: AWS API Documentation

Request Syntax

response = client.snap_to_roads(
    Key='string',
    SnappedGeometryFormat='FlexiblePolyline'|'Simple',
    SnapRadius=123,
    TracePoints=[
        {
            'Heading': 123.0,
            'Position': [
                123.0,
            ],
            'Speed': 123.0,
            'Timestamp': 'string'
        },
    ],
    TravelMode='Car'|'Pedestrian'|'Scooter'|'Truck',
    TravelModeOptions={
        'Truck': {
            'GrossWeight': 123,
            'HazardousCargos': [
                'Combustible'|'Corrosive'|'Explosive'|'Flammable'|'Gas'|'HarmfulToWater'|'Organic'|'Other'|'Poison'|'PoisonousInhalation'|'Radioactive',
            ],
            'Height': 123,
            'Length': 123,
            'Trailer': {
                'TrailerCount': 123
            },
            'TunnelRestrictionCode': 'string',
            'Width': 123
        }
    }
)
Parameters:
  • Key (string) – Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.

  • SnappedGeometryFormat (string) –

    Chooses what the returned SnappedGeometry format should be.

    Default Value: FlexiblePolyline

  • SnapRadius (integer) –

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

    Unit: meters

    Default value: 300

  • TracePoints (list) –

    [REQUIRED]

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

    • (dict) –

      TracePoint indices for which the provided notice code corresponds to.

      • Heading (float) –

        GPS Heading at the position.

      • Position (list) – [REQUIRED]

        Position defined as [longitude, latitude].

        • (float) –

      • Speed (float) –

        Speed at the specified trace point .

        Unit: KilometersPerHour

      • Timestamp (string) –

        Timestamp of the event.

  • TravelMode (string) –

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

    Default Value: Car

  • TravelModeOptions (dict) –

    Travel mode related options for the provided travel mode.

    • Truck (dict) –

      Travel mode options when the provided travel mode is “Truck”.

      • GrossWeight (integer) –

        Gross weight of the vehicle including trailers, and goods at capacity.

        Unit: Kilograms

      • HazardousCargos (list) –

        List of Hazardous cargos contained in the vehicle.

        • (string) –

      • Height (integer) –

        Height of the vehicle.

        Unit: centimeters

      • Length (integer) –

        Length of the vehicle.

        Unit: centimeters

      • Trailer (dict) –

        Trailer options corresponding to the vehicle.

        • TrailerCount (integer) –

          Number of trailers attached to the vehicle.

          Default Value: 0

      • TunnelRestrictionCode (string) –

        The tunnel restriction code.

        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.

        • Tunnel Category B

          • Risk Level: Limited risk

          • Restrictions: Few restrictions

        • Tunnel Category C

          • Risk Level: Medium risk

          • Restrictions: Some restrictions

        • Tunnel Category D

          • Risk Level: High risk

          • Restrictions: Many restrictions occur

        • Tunnel Category E

          • Risk Level: Very high risk

          • Restrictions: Restricted tunnel

      • Width (integer) –

        Width of the vehicle in centimenters.

Return type:

dict

Returns:

Response Syntax

{
    'Notices': [
        {
            'Code': 'TracePointsHeadingIgnored'|'TracePointsIgnored'|'TracePointsMovedByLargeDistance'|'TracePointsNotMatched'|'TracePointsOutOfSequence'|'TracePointsSpeedEstimated'|'TracePointsSpeedIgnored',
            'Title': 'string',
            'TracePointIndexes': [
                123,
            ]
        },
    ],
    'PricingBucket': 'string',
    'SnappedGeometry': {
        'LineString': [
            [
                123.0,
            ],
        ],
        'Polyline': 'string'
    },
    'SnappedGeometryFormat': 'FlexiblePolyline'|'Simple',
    'SnappedTracePoints': [
        {
            'Confidence': 123.0,
            'OriginalPosition': [
                123.0,
            ],
            'SnappedPosition': [
                123.0,
            ]
        },
    ]
}

Response Structure

  • (dict) –

    • Notices (list) –

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

      • (dict) –

        Notices provide information around factors that may have influenced snapping in a manner atypical to the standard use cases.

        • Code (string) –

          Code corresponding to the issue.

        • Title (string) –

          The notice title.

        • TracePointIndexes (list) –

          TracePoint indices for which the provided notice code corresponds to.

          • (integer) –

    • PricingBucket (string) –

      The pricing bucket for which the query is charged at.

    • SnappedGeometry (dict) –

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

      • LineString (list) –

        An ordered list of positions used to plot a route on a map.

        Note

        LineString and Polyline are mutually exclusive properties.

        • (list) –

          • (float) –

      • Polyline (string) –

        An ordered list of positions used to plot a route on a map in a lossy compression format.

        Note

        LineString and Polyline are mutually exclusive properties.

    • SnappedGeometryFormat (string) –

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

    • SnappedTracePoints (list) –

      The trace points snapped onto the road network.

      • (dict) –

        TracePoints snapped onto the road network.

        • Confidence (float) –

          Confidence value for the correctness of this point match.

        • OriginalPosition (list) –

          Position of the TracePoint provided within the request, at the same index.

          • (float) –

        • SnappedPosition (list) –

          Snapped position of the TracePoint provided within the request, at the same index.

          • (float) –

Exceptions