Maps API for JavaScript Developer's Guide

Traffic

The Maps API provides a means of retrieving and displaying traffic data on the map for major urban areas around the globe.

Showing Traffic Flow on the Map

The example below uses the traffic component in the Maps API to show a map of part of Germany, indicating the traffic conditions. Roads where traffic flows freely are marked in green, roads where congestion is moderate are in orange, while those that are congested are shown in red.

The API provides access to map tiles with traffic information through the HERE Map Tile API. It automatically adds layers using traffic map tiles to the default layer collection (accessed through the method createDefaultLayers() on the H.service.Platform instance). The application user can switch the traffic flow information display on and off for the available map types via the MapSettingsControl.

Figure 1. Map showing traffic flow data

Showing Traffic Incidents on the Map

In addition to traffic flow, the API integrates traffic incident data by providing a marker overlay that can be added to the map.

The code below adds to the map the pre-configured traffic incidents marker layer available in the default layer collection to show traffic incidents.

map.addLayer(defaultLayers.incidents);

This code assumes that map is a previously instantiated and initialized instance of H.Map.

The MapSettingsControl includes an entry for switching traffic incidents display on and off if the traffic incident layer is detected in the collection of layers passed to the UI.

Figure 2. Map showing traffic data

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.