Skip to main content
APIs 5 min read

How to enrich your applications with real-time traffic data from HERE Traffic API

HERE Traffic API

Traffic information has become a vital consideration in many decisions, in both personal and business scenarios. We all need efficient and reliable traffic data to plan our daily commutes and travels; corporations rely on this for deliveries, logistics, fleet management, and transit planning for efficiency, safety, and security. In this blog post, I provide an overview of HERE real-time traffic data, and how developers can access the traffic flow and incidents with the HERE Traffic API service.

HERE Real-Time Traffic is one of the largest databases of aggregated real-time data. The data is collected from multiple anonymized sources globally. These include but are not limited to sensor data from connected cars, road sensors, cameras, probes, and incident source providers. This data covers more than 70 countries and over 13 million kilometers of roads in total. 

Real-time traffic contains two types of traffic data – flow and incidents. Flow has qualitative information on how traffic is moving along a certain roadway. It also includes speed and congestion data that is updated every minute. Incidents are events that impact the flow of traffic. This is timely information that drivers should have to allow proper decision making. Examples include accidents, construction, lane restrictions, planned events, road closures, etc. This information is updated every two minutes and can be accessed through the HERE Traffic API. The results can be integrated into web and mobile applications to provide real-time traffic updates and re-routing suggestions.  

For example, governments that are monitoring traffic incidents in a specific geographic area can use this information to notify emergency response teams and citizens to help manage traffic flow in the impacted areas. Similarly, a Transport and Logistics company can use the Traffic API response to gather real-time traffic. By analyzing the traffic data through their custom routing applications, T&L companies can choose optimal routes to avoid congestion, reducing delivery times and costs. 

Traffic API v7 - Requests & Responses

Traffic flow and incidents requests need two mandatory parameters:

  1. in - which is the geospatial filter, like circle, bounding box or a corridor
  2. locationReferencing - how the roadway locations are described, it can be TMC (Traffic Message Channel), OLR (OpenLR Location Referencing) or Shape Points.

Requesting flow data

Copied
        curl "https://data.traffic.hereapi.com/v7/flow?locationReferencing=shape&in=circle:51.50643,-0.12719;r=1000&apiKey=YOUR_API_KEY"
  

Requesting the traffic flow within circle of 1 km radius in London, returns information for several road segments in the requested area, such as it's length, street name (if available), and the flow item. The flow item carries the data we are looking for - freeFlow speed, expected speed, jam factor, jam tendency, traversability and lane level flow data. Getting lane-level precision on highways and ramps is an industry first feature that HERE data offers. Also reports traffic congestion data on roads with changeable directions.

Copied
        {
    "sourceUpdated": "2023-02-14T19:47:14Z",
    "results": [{
            "location": {
                "description": "Covent Garden",
                "length": 545.0,
                "shape": {
                    "links": [{
                            "points": [{
                                    "lat": 51.51330001652241,
                                    "lng": -0.1291399821639061
                                },
                                {
                                    "lat": 51.51340998709202,
                                    "lng": -0.12896999716758728
                                }
                            ],
                            "length": 17.0
                        },
       . . . more points
                        {
                            "points": [{
                                    "lat": 51.51704002171755,
                                    "lng": -0.12627001851797104
                                },
                                {
                                    "lat": 51.51708997786045,
                                    "lng": -0.12578998692333698
                                }
                            ],
                            "length": 34.0
                        }
                    ]
                }
            },
            "currentFlow": {
                "speed": 4.7222223,
                "speedUncapped": 4.7222223,
                "freeFlow": 5.555556,
                "jamFactor": 0.2,
                "confidence": 0.91,
                "traversability": "open"
            }
        }
   . . . more locations
    ]
}
  

Requesting incidents data

Similarly, you can request all traffic incidents within the 1 km radius in the center of London. Some optional parameters also allow you to filter based on incident type, incident criticality and road functional classes. 

Copied
        curl "https://data.traffic.hereapi.com/v7/incidents?locationReferencing=shape&in=circle:51.50643,-0.12719;r=1000&apiKey=YOUR_API_KEY"
  

The response for incidents is pretty detailed. It gives incidentID, the start and end time, if the road is closed, type of incident, criticality and more.

Copied
        {
    "sourceUpdated": "2023-02-14T20:16:53Z",
    "results": [{
        "location": {
            "length": 49.0,
            "shape": {
                "links": [{
                    "points": [{
                            "lat": 51.511170007288456,
                            "lng": -0.12230001389980316
                        },
                        {
                            "lat": 51.511530010029674,
                            "lng": -0.12270997278392315
                        }
                    ],
                    "length": 49.0
                }]
            }
        },
        "incidentDetails": {
            "id": "3128607558450902252",
            "hrn": "here:traffic:incident:3128607558450902252",
            "originalId": "3128607558450902252",
            "originalHrn": "here:traffic:incident:3128607558450902252",
            "startTime": "2021-12-08T08:00:00Z",
            "endTime": "2023-06-08T16:00:00Z",
            "entryTime": "2023-02-13T15:52:00Z",
            "roadClosed": false,
            "criticality": "major",
            "type": "construction",
            "codes": [
                701
            ],
            "description": {
                "value": "Road construction",
                "language": "en-US"
            },
            "summary": {
                "value": "Road construction",
                "language": "en-US"
            }
        }
    }
 . . . more incidents
]
}
  

Summary

HERE Real-Time Traffic provides real-time information for a wide-ranging set of analysis and decision making. The developer community can leverage the HERE Traffic API to build web and mobile applications allowing individuals, corporates, and governments to make informed decisions. Explore the API and feel free to leave a comment or reach us on Twitter at @heredev, we are excited to see how you use the HERE Traffic API! 

 

Mohini Todkari

Mohini Todkari

Sr. Developer Evangelist

Have your say

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts
  • Tailored content delivered weekly
  • Exclusive events
  • One click to unsubscribe