Live traffic API

The API returns live traffic information about the specific road segments in Riga and Pieriga.

API URL

The request URL should match the following pattern:

https://api.kartes.lv/v3//trafficjam?

The response is given in JSON.

The HTTP GET request method is used.

Query parameters

The request consists of the following GET parameters:

Parameter Description Possible values
cs CRS
  • wgs84 - Latitude and longitude in the WGS-84 projection (EPSG:4326).
  • lks - x- and y- coordinates in the TM Baltic93 CRS (EPSG:25884).

Response parameters

The response consists of GeoJSON objects featuring the street segment geometry and its live traffic information (name, actual drive time, normal drive time).

Error codes

Status code Description
400 Wrong input data. Server can’t respond due to client error.
404 No location found. The URL is not recognized; the resource does not exist.
5xx Server error.

Example

Input:

https://api.kartes.lv/v3//trafficjam?

{
  "type": "Feature",
  "geometry": {
    "type": "LineString",
    "coordinates": [
      [
        24.141023,
        56.946954
      ],
      [
        24.14071,
        56.946955
      ],
      ...
    ]
  },
  "properties": {
    "width": 3,
    "r": 192,
    "g": 192,
    "b": 192,
    "opacity": 90,
    "name": "Valmieras iela (Ģertrūdes – Lāčplēša)",
    "auto_count": "0",
    "normal_drive_time": "76",
    "drive_time": "0",
    "date": "2019-05-27 17:37:37",
    "level": 0,
    "line_id": "399",
    "last_drive_time": "0",
    "info": [
      {
        "id": "name",
        "value": "Valmieras iela (Ģertrūdes – Lāčplēša)"
      },
      {
        "id": "drive_time",
        "value": "0"
      },
      {
        "id": "last_drive_time",
        "value": "0"
      },
      {
        "id": "level",
        "value": 0
      },
      {
        "id": "normal_drive_time",
        "value": "76"
      },
      {
        "id": "date",
        "value": "2019-05-27 17:37:37"
      }
    ]
  }
}