Matrix API

GET /v1/table (parameter)

Matrix API computes the distance and duration of the fastest route between all pairs of supplied coordinates. Full URL for requests is https://api.strues-maps.lt/v1/table. Only successful requests are counted towards soft limits and are billed.

Request parameters

points=long1,lat1;long2,lat2;long3,lat3;

Longitudes and latitudes must be supplied in WGS84 projection, also known as EPSG 4326. Number of coordinates supplied are only limited by maximum length of URI.

sources=point_index[;point_index[;point_index[;...]]

Optional point indexes used as sources in distance and duration matrix.

destinations=point_index[;point_index[;point_index[;...]]

Optional point indexes used as destinations in distance and duration matrix.

api_key=your_personal_api_key

Api key is provided after registration. Api key is used for service configuration like soft limits and billing.

Response codes

200 - Successful response

Request was successfully. Response body contains distance and duration of the fastest route between all pairs of supplied coordinates.

400 - Bad request exception

Returned if parameters are not provided or provided in an invalid format.

401 - Unauthorized

Returned if api key is invalid.

429 - Too many requests

Returned if soft limits are reached.

402 - Payment required

Returned if user has insufficient funds to make a request.

500 - Internal server error

Returned if unexpected error has occurred. We are working on it to resolve it.

Response body

{
    "code": "Ok",
    "durations": [
        [
            0,
            524.3,
        ],
        [
            574.5,
            0,
        ]
    ],
    "distances": [
        [
            0,
            5225.7,
        ],
        [
            5740.6,
            0,
        ]
    ],
    "sources": [
        [
            "location": [24.1, 55.1],
            "name": ["gatve g. 10"],
            "distance": 10.5,
        ],
        [
            "location": [24.2, 55.2],
            "name": ["gatve g. 20"],
            "distance": 20.5,
        ]
    ],
    "destinations": [
        [
            "location": [24.3, 55.3],
            "name": ["gatve g. 30"],
            "distance": 30.5,
        ]
    ]
}

code - "Ok" or "NoTable"

durations[i][j] - array of arrays that stores the matrix in row-major order. durations[i][j] gives the travel time from the i-th waypoint to the j-th waypoint. Values are given in seconds.

distances[i][j] - array of arrays that stores the matrix in row-major order. distances[i][j] gives the travel distance from the i-th waypoint to the j-th waypoint. Values are given in meters.

sources[k].location - longitude and latitude of snapped location.

sources[k].name - name of snapped location.

sources[k].distance - distance from original point to snapped location in meters.

destinations[l].location - longitude and latitude of snapped location.

destinations[l].name - name of snapped location.

destinations[l].distance - distance from original point to snapped location in meters.

GET /v1/table (url template)

Matrix API computes the distance and duration of the fastest route between all pairs of supplied coordinates. Full URL for requests is https://api.strues-maps.lt/v1/table/{points}. Only successful requests are counted towards soft limits and are billed.

URL template

{points} - long1,lat1;long2,lat2;long3,lat3;

Longitudes and latitudes must be supplied in WGS84 projection, also known as EPSG 4326. Number of coordinates supplied are only limited by maximum length of URI.

Request parameters

sources=point_index[;point_index[;point_index[;...]]

Optional point indexes used as sources in distance and duration matrix.

destinations=point_index[;point_index[;point_index[;...]]

Optional point indexes used as destinations in distance and duration matrix.

api_key=your_personal_api_key

Api key is provided after registration. Api key is used for service configuration like soft limits and billing.

GET /v1/table (polyline)

Matrix API computes the distance and duration of the fastest route between all pairs of supplied coordinates. Full URL for requests is https://api.strues-maps.lt/v1/table/polyline({polyline}). Only successful requests are counted towards soft limits and are billed.

URL template

{polyline} - geometry encoded in polyline format

Polyline encoded list of points. Coordinates must be supplied in WGS84 projection, also known as EPSG 4326.

Request parameters

sources=point_index[;point_index[;point_index[;...]]

Optional point indexes used as sources in distance and duration matrix.

destinations=point_index[;point_index[;point_index[;...]]

Optional point indexes used as destinations in distance and duration matrix.

api_key=your_personal_api_key

Api key is provided after registration. Api key is used for service configuration like soft limits and billing.