Digitraffic
magnifying glass

Road traffic

Open data from Finnish roads.

General info

Road traffic information is gathered from the operational traffic management systems of ITM Finland Ltd (a subsidiary of Fintraffic). Currently the open data API includes:

  • Road weather cameras. Cameras provide information on current traffic flow and weather conditions. Currently, there are over 470 road weather cameras.

  • Road weather station data. The road weather stations measure e.g. temperature, wind, rain, relative humidity and dew point. Data is updated once per minute. Currently, there are over 350 road weather stations on the Finnish road network.

  • Road weather forecasts. Content is updated every five minutes.

  • Traffic measurement system (TMS) data. Information about average speeds and traffic amounts.

  • Traffic messages. Traffic disorders, weight restrictions, roadworks and weight restrictions are available in Datex2 and Simple-JSON format.

  • TMC/ALERT-C location data which is used in Traffic messages.

  • Variable signs

  • Road maintenance information

  • Walking and cycling counting site values

  • Metadata for all services is updated twice per day

Contents

REST/JSON -APIs

Swagger API descriptions

Full API descriptions can be found in Swagger-documentation at https://tie.digitraffic.fi/swagger/

Road weather cameras

https://tie.digitraffic.fi/api/v1/data/camera-data

https://tie.digitraffic.fi/api/v1/data/camera-data/{id}

Response message contains weather camera information and URL for the camera image. For example preset image C0450701 is located at https://weathercam.digitraffic.fi/C0450701.jpg. Weather camera images are updated approximately about every 10 minutes.

Weather camera image C0450701

Related metadata:

https://tie.digitraffic.fi/api/v3/metadata/camera-stations

You should check from the metadata at the least field below to make sure the camera or preset is in collection.

  • Camera fields state and collectionStatus
  • Preset field inCollection

Weather camera image history for the last 24 hours

History can be fetched by API call:

https://tie.digitraffic.fi/api/v3/data/camera-history/history?id={preset or camera id}

API call returns links to history images. You can also give time to get single image of given moment.

History presence tells if history exists for given time interval and it can be fetched by API call:

https://tie-test.digitraffic.fi/api/v3/data/camera-history/presences?id={preset or camera id}&from={ISO 8601 -aika}2&to={ISO 8601 -aika}

Current data of road weather stations

https://tie.digitraffic.fi/api/v1/data/weather-data

https://tie.digitraffic.fi/api/v1/data/weather-data/{id}

Response message contains latest weather measurement data.

Data is updated almost in real time but information is cached. Actual update interval is one minute. Real time data can be read from WebSocket.

Related metadata:

https://tie.digitraffic.fi/api/v3/metadata/weather-stations

https://tie.digitraffic.fi/api/v3/metadata/weather-sensors

Sensor history for the last 24 hours

Sensor history from the weather road station can be fetched by API call:

https://tie.digitraffic.fi/api/beta/weather-history-data/{stationId}

Single sensor history can be fetched by API call:

https://tie.digitraffic.fi/api/beta/weather-history-data/{stationId}/{sensorId}

Time interval can be adjusted with from={ISO 8061 -time} and to={ISO 8061 -time} parameters.

History for the last 24 hours is currently only in beta-API.

Current road weather forecasts

Message contains road sections weather forecasts. Reports are updated every 5 minutes.

https://tie.digitraffic.fi/api/v3/data/road-conditions

Road specific weather forecasts.

https://tie.digitraffic.fi/api/v3/data/road-conditions/{minLongitude}/{minLatitude}/{maxLongitude}/{maxLatitude}

Road specific weather forecasts for given area.

https://tie.digitraffic.fi/api/v3/data/road-conditions/{roadNumber}

Road specific weather forecasts for given road.

Related metadata:

https://tie.digitraffic.fi/api/v3/metadata/forecast-sections

https://tie.digitraffic.fi/api/v3/metadata/forecast-sections/{minLongitude}/{minLatitude}/{maxLongitude}/{maxLatitude}

https://tie.digitraffic.fi/api/v3/metadata/forecast-sections/{roadNumber}

Traffic measurement system (TMS) dataCurrent data from TMS stations

Documentation

The TMS documentation contains descriptions of TMS data.

Statistics

Statistics web form

Raw data

Raw data

Real time data

https://tie.digitraffic.fi/api/v1/data/tms-data

https://tie.digitraffic.fi/api/v1/data/tms-data/{id}

Response message contains TMS (Traffic Measurement System)–stations measurement data.

Every TMS station provides information about traffic amounts and measured average speeds.

Data is updated almost in real time but information is cached. Actual update interval is one minute. Real time data can be read from WebSocket.

Related metadata:

https://tie.digitraffic.fi/api/v3/metadata/tms-stations

https://tie.digitraffic.fi/api/v3/metadata/tms-sensors

Traffic messages

Traffic messages are possible to get in standard DATEX II and Simple JSON -formats that is based on GeoJSON specification. Because of that JSON format contains also the geometries of the traffic messages unlike DATEX II. It is possible to get JSON formatted traffic messages also without area geometries to save time and bandwidth as the areas are quite large. The area geometries can be then cached locally from specific API for geometries eiter getting them one by one or all at once. This makes a big difference in size of the messages that have an area geometry.

Traffic messages contains TMC/ALERT-C locations to identify the affected area or location of the announcement. More information at TMC/ALERT-C location data

Dates in message texts are include in multiple formats. Fixed date time fields are in ISO 8601 date format and in UTC (Zulu) time. Best practice is to use some library that can parse date and times properly with any offset from ISO 8601 date format.

Types of traffic messages

  • Exempted transport EXEMPTED_TRANSPORT
    • Message contains information of transports causing disruptions for other road users.
  • Road work ROAD_WORK
    • Message contains information of road works including progress and disruptions for other road users.
  • Traffic announcement TRAFFIC_ANNOUNCEMENT
    • Message contains traffic incidents those have significant impact on traffic flow, e.g. traffic accidents and temporary traffic rearrangements.
  • Weight restriction WEIGHT_RESTRICTION
    • Message contains weight restriction limiting usage of the roads.

Traffic messages DATEX II -APIs

Traffic messages Simpele JSON -APIs

Traffic messages area geometries

Traffic message can contain area geometries that can be found from JSON-path: properties.announcements[x].locationDetails.areaLocation.areas[x].locationCode If value of API-parameter includeAreaGeometry is false the geometry is not returned in JSON-response. It is better practice caching geometries locally and get them from a local cache than to get them every time from the API.

Open an example of Simple JSON traffic message that contains ALERT-C area geometry with location code 27:
    {
      "type": "Feature",
      "geometry": null,
      "properties": {
        "situationId": "GUID50379079",
        "situationType": "TRAFFIC_ANNOUNCEMENT",
        "trafficAnnouncementType": "general",
        "version": 1,
        "releaseTime": "2021-01-31T15:57:29.105Z",
        "announcements": [
          {
            "language": "FI",
            "title": "Liikennetiedote. ",
            "location": {
              "countryCode": 6,
              "locationTableNumber": 17,
              "locationTableVersion": "1.11.37",
              "description": "Lappi Norjan vastaiset rajanylityspaikat."
            },
            "locationDetails": {
              "areaLocation": {
                "areas": [
                  {
                    "name": "Lappi",
                    "locationCode": 27,
                    "type": "PROVINCE"
                  }
                ]
              }
            },
            "features": [
              {
                "name": "Liikenne pysäytetään"
              }
            ],
            "roadWorkPhases": [],
            "comment": "Rajoituksia henkilöliikenteen rajanylitykseen Norjan suuntaan:
Polmak, Karigasniemi ja Kivilompolo suljettu klo 21:00-09:00.

Näätämö suljettu 24/7
Utsjoki suljettu 24/7
Kilpisjärvi avoinna 24/7

Lisätietoa Norjaan matkustamisesta on osoitteessa www.entrynorway.no",
            "timeAndDuration": {
              "startTime": "2021-01-06T14:58:00Z"
            },
            "additionalInformation": "Liikenne- ja kelitiedot verkossa: https://liikennetilanne.fintraffic.fi/",
            "sender": "Fintraffic Tieliikennekeskus Oulu"
          }
        ],
        "contact": {
          "phone": "02002100",
          "email": "oulu.liikennekeskus@fintraffic.fi"
        }
      }
    }
    


Area geometries are served from the API:

TMC/ALERT-C location data

TMC/ALERT-C material contains location data which is used in Traffic information such as road works, accidents, traffic jams and weather. More information can be found at TMC Data -page.

https://tie.digitraffic.fi/api/v3/metadata/locations-versions

https://tie.digitraffic.fi/api/v3/metadata/locations-types

https://tie.digitraffic.fi/api/v3/metadata/locations

Variable signs

https://tie.digitraffic.fi/api/v3/data/variable-signs

https://tie.digitraffic.fi/api/v3/data/variable-signs/{id}

https://tie.digitraffic.fi/api/v3/data/variable-signs/history/{id}

Response message contains latest variable sign data. Currenty supported sign types are speed limits and warnings. Digitraffic publishes the data only from the master device of a device group. Data from slave devices on the left side of the road or on ramps is not available.

Warning sign types(in Finnish):

https://tie.digitraffic.fi/api/v2/metadata/variable-signs/code-descriptions

Warning sign images:

https://vayla.fi/tieverkko/liikennemerkit

Data is also available in datex2-format:

https://tie.digitraffic.fi/api/v1/variable-signs/datex2

Warnings text can contain sign symbols enclosed with []. It is possible to render those in svg-format:

https://tie.digitraffic.fi/api/v1/variable-signs/images/ramppi_123

https://tie.digitraffic.fi/api/v1/variable-signs/images/tie_321

Road maintenance information

The Finnish Transport Infrastructure Agency receives real-time location and operation information for maintenance vehicles from road maintenance contractors. The information is transmitted from the vehicles to the contractors’ information systems, from where it is further transmitted to the Finnish Transport Infrastructure Agency’s Harja system. Digitraffic also receives this information and publishes it as open data at the API’s described below. The data is updated every minute on average. Harja data domain is state-roads.

In additon to Harja-data we also receive some data from municipalities. This data’s domain is other than state-roads.

The Finnish Transport Infrastructure Agency is also preparing publication of maintenance realization data for data older than one day in its own open data services.

Maintenance domain

The api returns possible values for domains. Domain tells the system where the data is coming.

https://tie.digitraffic.fi/api/maintenance/v1/tracking/domains

Vehicle task types

The API returns more detailed explanations of the tasks performed by the vehicles.

https://tie.digitraffic.fi/api/maintenance/v1/tracking/tasks

Vehicle tracking data

The API returns the route taken by the vehicle. The route does not fully correspond to the road route of the vehicle, because the route to be published is formed by combining the location information from the vehicle into a line and separate routing to the road network is not done. The route can also be a point if no more waypoints have been obtained from the vehicle.

A new tracking object is created whenever:

  • the task performed by the vehicle changes
  • the interval between two consecutive received position messages is more than 5 minutes
  • the calculated driving speed between two consecutive received position messages is more than 140 km/h

These treatments eliminate the largest possible errors in the data generated by the vehicles.

https://tie.digitraffic.fi/api/maintenance/v1/tracking/routes?domain=state-roads

Vehicle latest location

The API returns the latest location and task information received from the maintenance vehicles.

https://tie.digitraffic.fi/api/maintenance/v1/tracking/routes/latest?domain=state-roads

Walking and cycling counting site values

Walking and cycling counting site values are currently received from Oulu region.

All counters in GeoJSON

https://tie.digitraffic.fi/api/counting-site/v1/counters

More metadata

https://tie.digitraffic.fi/api/counting-site/v1/directions

https://tie.digitraffic.fi/api/counting-site/v1/domains

https://tie.digitraffic.fi/api/counting-site/v1/user-types

Counting site values in json

https://tie.digitraffic.fi/api/counting-site/v1/values

Counting site values in CSV

https://tie.digitraffic.fi/api/counting-site/v1/values.csv

WebSocket API

TMC-data can be tracked from following Web Socket APIs. Protocol is MQTT over WebSockets. This allows you to subscibe only those topics you are interested in.

Production address is wss://tie.digitraffic.fi:61619/mqtt

You must use SSL when connecting. Also, you need to use following credentials:

  • userName: digitraffic
  • password: digitrafficPassword

When using Paho JS-client the address is plain tie.digitraffic.fi and port 61619, see example below.

Address for test is tie-test.digitraffic.fi and port is 443.

Topics

You can replace <id>-part in topic with #-character to listen all messages. E.g.. tms/#

Topics are constructed like shown below.

Current data from TMS stations

  • tms/<roadStationId>/<sensorId>
  • tms/status
TMS station sensor measurement message
{
  "id": 5122,
  "roadStationId": 23307,
  "name": "KESKINOPEUS_5MIN_LIUKUVA_SUUNTA1",
  "oldName":" averageSpeed1",
  "shortName": "km/h1",
  "sensorValue": 84,
  "sensorUnit":" km/h",
  "measuredTime": "2019-01-23T08:25:02Z"
}

Current data of road weather stations

  • weather/<roadStationId>/<sensorId>
  • weather/status
Weather station sensor measurement message
{
  "id": 1,
  "roadStationId": 1158,
  "name": "ILMA",
  "oldName": "airtemperature1",
  "shortName": "Ilma ",
  "sensorValue": -2.2,
  "sensorUnit": "°C",
  "measuredTime": "2019-01-23T08:35:00Z"
}

Road maintenance information of latest location

  • maintenance/tracking/#
  • maintenance/tracking/<trackingId>
  • maintenance/tracking/status
Road maintenance tracking message
{
  "type": "Feature",
  "properties": {
    "id": 247694,
    "time": "2020-06-08T13:23:52Z",
    "tasks": [
      "PAVING"
    ],
    "direction": 72
  },
  "geometry": {
    "type": "Point",
    "coordinates": [
      25.689415,
      62.598124,
      0
    ]
  }
}

A simple JavaScript Web Socket client

The code below refers to the missing variable clientName. Initialize it with the name of your application.

Note! If your application is not constantly fetching data, close the connection by calling client.disconnect().)
The example code disconnects after 30 s.

<html>
<head>
    <title>Test mqtt tms-messages</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js" ></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.2/mqttws31.min.js"></script>

    <script>
        'use strict';
        const lines = [];
        let messagesLastMinuteCount = 0, client;

        function connect() {
            console.log('trying to connect to road mqtt...');

            // enter a valid client name to fix the syntax error
            client = new Paho.MQTT.Client("tie.digitraffic.fi", 61619, clientName);

            client.onConnectionLost = function (response) {
                console.info(Date.now() + ' Connection lost:' + response.errorMessage);
            };
            client.onMessageArrived = function(message) {
                messagesLastMinuteCount++;

                addMessage(JSON.parse(message.payloadString));

                updateList();
            };

            const connectionProperties = {
                onSuccess:onConnect,
                mqttVersion:4,
                useSSL:true,
                userName:"digitraffic",
                password:"digitrafficPassword"
            };

            client.connect(connectionProperties);

            window.setInterval(logMessageCount, 60*1000);
        }
        
        function disconnect() {
            client.disconnect();
        }

        function logMessageCount() {
            console.info(Date.now() + ' ' + messagesLastMinuteCount + ' messages per minute');
            $("#messagesPerMinute").text(messagesLastMinuteCount);
            messagesLastMinuteCount = 0;
        }

        function onConnect() {
            console.info(Date.now() + ' Connection open');
            client.subscribe("tms/#");
        }

        function addMessage(message) {
            const text = JSON.stringify(message);

            if (lines.length > 100) {
                lines.shift();
            }

            lines.push(text);
        }

        function updateList() {
            $(".messages").html(lines.join('<br/>'));
        }

        connect();
        
        // disconnect after 30 seconds
        setTimeout(disconnect, 30000);
    </script>
</head>
<body>
Messages (<span id="messagesPerMinute">&lt;counting&gt;</span> messages per minute):
<div class="messages" />
</body>
</html>

Restrictions

See Information and instructions for using APIs > General considerations

Outdated and deprecated APIs

Current journey times

NOTE! This information is not updated. The old journey time system has been shut down in the end of 2017.

Old history data can be downloaded from the following link.

Current free flow speeds

https://tie.digitraffic.fi/api/v1/data/free-flow-speeds

https://tie.digitraffic.fi/api/v1/data/free-flow-speeds/tms/{id}

Response message contains currently valid free flow speeds.

Message is updated once a day and it ready be loaded after 6:00 AM EET. The actual data is updated much less frequently.

This api will be deprecated at some point and the same information can be read from Current data from TMS stations -metadata-api.

Related metadata:

https://tie.digitraffic.fi/api/v3/metadata/tms-stations

bug_reportDid you find an error? Help us improve this page.