Speeding report

API endpoint

https://analytics.api.sygic.com/v0/api/speeding

Request parameters

To create a valid request, coordinates must be included in the request body.

Parameters Type Values Descripion
coordinates array of strings {latitude},{longitude} Set of GPS coordinates for speeding

Example: "coordinates": ["48.37362,17.595033","48.37397,17.59686"]
accuracies array of decimal values Set of radiuses of uncertainty for the corresponding locations, measured in meters. This field is not required. When ommitted, default values for best results will be used.

Example: "accuracies": [9,10]
speeds array of integers Set of the speeds for corresponding locations.

Example: "speeds": [48,48,48]
timestamps array of integers array of UTC time Set of timestamps in seconds since midnight, January 1, 1970 UTC.

Example: "timestamps":[1464691627,1464691698]

If provided, number of accuracies, speeds and timestamps must match number of coordinates.

Parameters with default value don't have to be included in the request.

Default parameter Type Default Value Description
units string metric metric
imperial
Units’ format.

Request example

Example body of request:

{
    "coordinates": [
        "51.321075,-0.7619",
        "51.321075,-0.7619",
        "51.32107,-0.761935",
        "51.321026,-0.76222",
        "51.321056,-0.762356",
        "51.321327,-0.762678",
        "51.321327,-0.762678",
        "51.321335,-0.762686",
        "51.322136,-0.763151",
        "51.322205,-0.763136",
        "51.32243,-0.76319",
        "51.322445,-0.763276",
        "51.322407,-0.763443",
        "51.32229,-0.763601",
        "51.322025,-0.763736",
        "51.320778,-0.762741",
        "51.318855,-0.760593",
        "51.317833,-0.759043",
        "51.317833,-0.759043",
        "51.317753,-0.759006",
        "51.317585,-0.759088",
        "51.31751,-0.759166",
        "51.31689,-0.759473",
        "51.316772,-0.759421",
        "51.316387,-0.758868",
        "51.317085,-0.755328",
        "51.31854,-0.751173",
        "51.320248,-0.74707",
        "51.322178,-0.74304",
        "51.32423,-0.739085",
        "51.326355,-0.735376",
        "51.32851,-0.731793"
    ],
    "accuracies": [
        9,9,10,10,10,11,11,11,11,10,11,11,11,11,11,10,10,10,10,10,10,9,11,10,11,11,11,11,11,11,11,9
    ],
    "speeds": [
        48, 48, 48, 0, 0, 48, 48, 48, 48, 48, 48, 0, 0, 48, 48, 80, 80, 97, 97, 97, 97, 113, 113, 113, 113, 97, 113, 113, 113, 113, 113, 113
    ],
    "distance": {
        "value": 3349,
        "text": "3.35 km"
    }
}

Response properties

Property Data type Descripion
route string Continuous route matched to map and created from input data

Example: "route": "ubhxH~nqCuEiL}CoHwCwGwLgWeK}R"
speeding_segments array of objects Continuous segments of the route matched on map, grouped by max speed, speeding and continuity of segments.
distance integer Calculated distance of matched continuous route.

Speeding segment properties

Property Data type Descripion
max_speed integer General speed limit on matched segment.

Example: "max_speed": 97
speeding integer Relative speeding expressed by decimal number rounded to one decimal (20% speeding ~ 1.2)

Example: "speeding": 1.2
route string Geometry of matched segment.

Example: "route": "ezexHjjsCh@Il@i@??Xi@Pu@FyAEY"
original_coordinates array of strings Coordinates from input used to calculate current segment.

Example: "original_coordinates": [ "51.31689,-0.75947", "51.31677,-0.75942", "51.31639,-0.75887" ]
snapped_coordinates array of strings Coordinates snapped to road network.

Example: "snapped_coordinates": [ "51.31687,-0.75955", "51.31671,-0.75947", "51.31634,-0.75888" ]
original_speeds array of integers Respective speeds from original collection.

Example: "original_speeds": [ 113, 113,113 ]
is_implicit boolean Flag indicates whether an implicit speed limit per country is used (urban/rural/highway roads)

Example: "is_implicit": false
{
    "route": "krfxHzzsC??eBnB]J[Cc@n@sAGYZEj@JLFZj@^hAOzAgAtAiAhGyGxEsGjB_D?ML_@\\AHLt@p@r@VPDh@Il@i@Xi@Pu@FyAEY}@}HY{ASaAI_@OmAaB_HeCwJ
    _@qA{B{HGWsF{PqCeIuCsHuEiL}CoHwCwGwLgWeK}R",
    "speeding_segments": [
        {
            "max_speed": 97,
            "speeding": 1,
            "route": "sqfxHzrsCAbALbBEb@]r@eBnB]J",
            "original_coordinates": [
                "51.32108,-0.76190",
                "51.32108,-0.76190",
                "51.32107,-0.76194",
                "51.32103,-0.76222",
                "51.32106,-0.76236",
                "51.32133,-0.76268",
                "51.32133,-0.76268",
                "51.32134,-0.76269"
            ],
            "snapped_coordinates": [
                "51.32086,-0.76222",
                "51.32086,-0.76222",
                "51.32086,-0.76222",
                "51.32093,-0.76230",
                "51.32101,-0.76239",
                "51.32130,-0.76271",
                "51.32130,-0.76271",
                "51.32131,-0.76272"
            ],
            "original_speeds": [
                48,48,48,0,0,48,48,48
            ],
            "is_implicit": false
        },
        {
            "max_speed": 97,
            "speeding": 1,
            "route": "kwfxHr~sCc@n@sAGYZ??Ej@??JL",
            "original_coordinates": [
                "51.32214,-0.76315",
                "51.32220,-0.76314",
                "51.32243,-0.76319",
                "51.32244,-0.76328",
                "51.32241,-0.76344"
            ],
            "snapped_coordinates": [
                "51.32213,-0.76303",
                "51.32219,-0.76302",
                "51.32239,-0.76319",
                "51.32240,-0.76328",
                "51.32238,-0.76342"
            ],
            "original_speeds": [
                48,48,48,0,0
            ],
            "is_implicit": false
        },
        {
            "max_speed": 97,
            "speeding": 1,
            "route": "o{fxHlctCj@^hAO",
            "original_coordinates": [
                "51.32229,-0.76360",
                "51.32202,-0.76374"
            ],
            "snapped_coordinates": [
                "51.32229,-0.76360",
                "51.32202,-0.76373"
            ],
            "original_speeds": [
                48,48
            ],
            "is_implicit": false
        },
        {
            "max_speed": 80,
            "speeding": 1,
            "route": "}tfxHtatCtAiAhGyGxEsGjB_D",
            "original_coordinates": [
                "51.32078,-0.76274",
                "51.31886,-0.76059"
            ],
            "snapped_coordinates": [
                "51.32071,-0.76280",
                "51.31880,-0.76063"
            ],
            "original_speeds": [
                80,80
            ],
            "is_implicit": false
        },
        {
            "max_speed": 182,
            "speeding": 1,
            "route": "w_fxHnhsCL_@\\A??HL",
            "original_coordinates": [
                "51.31783,-0.75904",
                "51.31783,-0.75904",
                "51.31775,-0.75901",
                "51.31758,-0.75909"
            ],
            "snapped_coordinates": [
                "51.31781,-0.75912",
                "51.31781,-0.75912",
                "51.31775,-0.75911",
                "51.31763,-0.75914"
            ],
            "original_speeds": [
                97,97,97,97
            ],
            "is_implicit": true
        },
        {
            "max_speed": 97,
            "speeding": 1.2,
            "route": "a~exHzgsCt@p@r@V",
            "original_coordinates": [
                "51.31751,-0.75917"
            ],
            "snapped_coordinates": [
                "51.31756,-0.75922"
            ],
            "original_speeds": [
                113
            ],
            "is_implicit": false
        },
        {
            "max_speed": 97,
            "speeding": 1.2,
            "route": "ezexHjjsCh@Il@i@??Xi@Pu@FyAEY",
            "original_coordinates": [
                "51.31689,-0.75947",
                "51.31677,-0.75942",
                "51.31639,-0.75887"
            ],
            "snapped_coordinates": [
                "51.31687,-0.75955",
                "51.31671,-0.75947",
                "51.31634,-0.75888"
            ],
            "original_speeds": [
                113,113,113
            ],
            "is_implicit": false
        },
        {
            "max_speed": 97,
            "speeding": 1,
            "route": "uyexHfrrCOmA",
            "original_coordinates": [
                "51.31708,-0.75533"
            ],
            "snapped_coordinates": [
                "51.31699,-0.75533"
            ],
            "original_speeds": [
                97
            ],
            "is_implicit": false
        },
        {
            "max_speed": 113,
            "speeding": 1,
            "route": "mbfxHnxqC{B{H",
            "original_coordinates": [
                "51.31854,-0.75117"
            ],
            "snapped_coordinates": [
                "51.31848,-0.75115"
            ],
            "original_speeds": [
                113
            ],
            "is_implicit": false
        },
        {
            "max_speed": 113,
            "speeding": 1,
            "route": "qffxHzmqCsF{P",
            "original_coordinates": [
                "51.32025,-0.74707"
            ],
            "snapped_coordinates": [
                "51.32018,-0.74704"
            ],
            "original_speeds": [
                113
            ],
            "is_implicit": false
        },
        {
            "max_speed": 113,
            "speeding": 1,
            "route": "mwfxHdhpCuEiL",
            "original_coordinates": [
                "51.32218,-0.74304"
            ],
            "snapped_coordinates": [
                "51.32210,-0.74300"
            ],
            "original_speeds": [
                113
            ],
            "is_implicit": false
        },
        {
            "max_speed": 113,
            "speeding": 1,
            "route": "acgxHjqoCwCwG??wLgW??_Yoi@",
            "original_coordinates": [
                "51.32423,-0.73908",
                "51.32636,-0.73538",
                "51.32851,-0.73179"
            ],
            "snapped_coordinates": [
                "51.32416,-0.73904",
                "51.32626,-0.73533",
                "51.32844,-0.73175"
            ],
            "original_speeds": [
                113,113,113
            ],
            "is_implicit": false
        }
    ],
    "status": "OK",
    "copyright": "© 2018 Sygic a.s."
}

Route format

Sygic Routing API is using Google Encoded Polyline that stores a series of coordinates into a single string. More information about Encoded Polyline can be found on this link.

Tool for visualization of the Google Encoded Polyline can be found on this link.

Make sure to always escape the backslashes in encoded strings! Not doing so will result in the backslash to be interpreted as an escape character, yielding either wrong polyline or a polyline that can't be decoded. This problem will not occur if the polylines are passed around programatically in memory.

Polyline below is encoded from two coordinates "41.6076,-88.21549","41.60745,-88.21537":

on}|FxqlyO\W

it contains characters ['o', 'n', '}', '|', 'F', 'x', 'q', 'l', 'y', 'O', '\', 'W'], therefore if used as string literal in code, it has to be declared as:

var polyline = "on}|FxqlyO\\W";

Overview

Analyze speeding with Speeding report function. Speeding report can be enhanced using time stamp and GPS accuracy data.

Live Example

This example demonstrates the use of the Speeding report function. Click on icons to see code on Github or play with it in JSFiddle:

  • Legend:
    blue for no speeding (0%)
    yellow for 10% speeding
    orange for 20% speeding
    red for 30% speeding
    black for more

    Request

    API Reference

    https://analytics.api.sygic.com/v0/api/speeding?key=yourAPIkey

    Request authentication is done via parameter key, which must be included in the request URL.

    Methods

    • POST

    Parameters

    Required Parameters

    Parameter Data type Description
    coordinates array of strings Set of GPS coordinates for speeding

    Example: "coordinates": ["48.37362,17.595033","48.37397,17.59686"]

    Optional Parameters

    Parameter Data type Description
    accuracies array of decimal values Set of radiuses of uncertainty for the corresponding locations, measured in meters. This field is not required. When ommitted, default values for best results will be used.

    Example: "accuracies": [9,10]
    speeds array of integers Set of the speeds for corresponding locations.

    Example: "speeds": [48,48,48]
    timestamps array of integers Set of timestamps in seconds since midnight, January 1, 1970 UTC.

    Example: "timestamps":[1464691627,1464691698]
    units string Units’ format. Default value is "metric".
    Determines units for: input attribute speeds; output attributes estimated_average_speed; and text of distance attribute. Attribute value is always in meters.

    Values: metric, imperial
    include_estimated_segments boolean Attribute indicates whether the timestamps array should be used to estimate speed in segments, where no points could be matched. In such segments, there will be a new estimated_average_speed property.

    If provided, number of accuracies, speeds and timestamps must match number of coordinates.
    Parameters with default value don't have to be included in the request.

    Response

    POST

    POST https://analytics.api.sygic.com/v0/api/speeding?key=yourAPIkey
    
    Content-Type: application/json

    Request Body

    {
        "coordinates": ["48.18087,17.19454", "48.18298,17.19728", "48.18595,17.20209", "48.18705,17.20424"],
        "timestamps": [1553155199, 1553155200, 1553155215, 1553155280],
        "accuracies": [10, 9, 10, 8],
        "speeds": [100, 85, 100, 92],
        "include_estimated_segments": true,
    }

    Response Body

    {
        "route": "miaeHwh}gBeAqAoCuDcF_Ia@q@kD{FmDyGkDqHKUsIsSkEeL",
        "speeding_segments": [
            {
                "max_speed": 90,
                "speeding": 1.1,
                "route": "miaeHwh}gBeAqAoCuDcF_I",
                "original_coordinates": [
                    "48.18087,17.19454",
                    "48.18298,17.19728"
                ],
                "snapped_coordinates": [
                    "48.18087,17.19452",
                    "48.18297,17.19728"
                ],
                "original_speeds": [
                    100,
                    85
                ],
                "is_highway": true,
                "is_urban": false,
                "distance": 326
            },
            {
                "max_speed": 90,
                "speeding": 1.2,
                "route": "gwaeH_{}gBa@q@kD{FmDyGkDqHKU",
                "original_coordinates": [],
                "snapped_coordinates": [],
                "original_speeds": [],
                "is_highway": true,
                "is_urban": false,
                "distance": 459,
                "estimated_average_speed": 110
            },
            {
                "max_speed": 90,
                "speeding": 1.1,
                "route": "{hbeHow~gBsIsSkEeL",
                "original_coordinates": [
                    "48.18595,17.20209",
                    "48.18705,17.20424"
                ],
                "snapped_coordinates": [
                    "48.18594,17.20208",
                    "48.18705,17.20423"
                ],
                "original_speeds": [
                    100,
                    92
                ],
                "is_highway": true,
                "is_urban": false,
                "distance": 502
            }
        ],
        "distance": {
            "value": 1287,
            "text": "1.29 km"
        },
        "status": "OK",
        "copyright": "© 2019 Sygic a.s."
    } 

    Response Properties

    Property Data type Description
    route string Continuous route matched to map and created from input data

    Example: "route": "ubhxH~nqCuEiL}CoHwCwGwLgWeK}R"
    speeding_segments array of objects Continuous segments of the route matched on map, grouped by max speed, speeding and continuity of segments.
    distance integer Calculated distance of matched continuous route.

    Speeding segment properties:

    Property Data type Description
    max_speed integer General speed limit on matched segment.

    Example: "max_speed": 97
    speeding integer Relative speeding expressed by decimal number rounded to two decimals (20% speeding ~ 1.21)

    Example: "speeding": 1.21
    route string Geometry of matched segment.

    Example: "route": "ezexHjjsCh@Il@i@??Xi@Pu@FyAEY"
    original_coordinates array of strings Coordinates from input used to calculate current segment.

    Example: "original_coordinates": [ "51.31689,-0.75947", "51.31677,-0.75942", "51.31639,-0.75887" ]
    snapped_coordinates array of strings Coordinates snapped to road network.

    Example: "snapped_coordinates": [ "51.31687,-0.75955", "51.31671,-0.75947", "51.31634,-0.75888" ]
    original_speeds array of integers Respective speeds from original collection.

    Example: "original_speeds": [ 113, 113,113 ]
    is_highway boolean Flag indicates whether the speeding segment is on a highway.
    is_urban boolean Flag indicates whether the speeding segment is in a city.
    distance integer Length of the speeding segment in meters.
    estimated_average_speed integer Estimated average speed of a speeding segment calculated from timestamps array provided as input.