Skip to main content

Traffic Flow

Problem: I need current speed and congestion on the roads in an area.

Prerequisites

  • A HERE API key with Traffic entitlement
  • export HERE_API_KEY="..."
Traffic v7 is a data API, not a tile API. It returns JSON describing road segments, not images.Two parameters are mandatory on every request: in (geospatial filter) and locationReferencing. Omitting locationReferencing returns E608051.

The code

Geospatial filters

in accepts four formats. Choose the smallest that covers your question.
corridor: is the one most teams miss. It accepts a Flexible Polyline plus a radius.For “what is the traffic on this route right now,” a corridor around the route polyline is dramatically cheaper and more relevant than a bounding box containing the whole city.

Response walkthrough

Flow:
jamFactor runs 0.0 (free flow) to 10.0 (standstill or closed). It is the field you filter and alert on. speed and freeFlow are metres per second. Not km/h.
Flow indicates closed roads via jamFactor. For closures specifically, HERE recommends the Incidents endpoint, not Flow. If road closures drive a routing decision in your system, query /v7/incidents.
Incidents:
Descriptions default to the incident country’s language. Pass lang=en-US for English.

locationReferencing

Request only what you can interpret. Asking for shape when you use olr returns geometry you parse and discard.

Common mistakes

Omitting locationReferencing. E608051. It is mandatory. Filtering jam factor client-side. Use minJamFactor / maxJamFactor. Treating speed as km/h. Metres per second. Polling a city-wide bounding box for a live map. Use corridor: around your route, or tile: for a viewport. Using Flow to detect closures. Use Incidents. Requesting shape when you do not render geometry. Use none. Assuming Traffic replaces departureTime on a routing call. The Routing API applies traffic internally. This API is for displaying or analysing traffic, not for making routes traffic-aware.

Production considerations

Do not poll on map pan. Every drag becomes a request. Debounce, and cache per tile. Corridor filters for route-relevant traffic. Bounding boxes return everything. Cache with a short TTL. Traffic is near-real-time; it is not per-second. This is a separate meter. Traffic bills independently of routing and tiles. Traffic overlays left permanently enabled are a cost decision, not a styling one. functionalClasses narrows to major roads. A dispatcher watching highways does not need residential streets. E608xxx codes are malformed-query errors. Read the message; do not retry.

Maps

Traffic as a rendering layer, and why it bills separately.

ETA Calculation

departureTime on a routing call, not a Traffic query.

Fleet Routing

Where traffic enters dispatch decisions.

Cost Optimization Patterns

Pattern 1: the unit of work. Do not poll per pan.

HERE documentation


Need production HERE API keys or implementation support? Placematic is an official HERE Technologies reseller and implementation partner. Talk to us.