GuidesPipeline API ReferenceChangelog
Guides

HERE Real-Time Traffic data

HERE Real-Time Traffic data on the platform is visualized with the dedicated GeoJSON rendering plugin. By editing the default plugin code, you can customize your visualization as needed.

The plugin for HERE Real-Time Traffic data is included in the data schema of the Flow layer: Traffic flow data visualization with the rendering plugin

Example app

Before you can visualize traffic flow data, you need to know the HERE Resource Name (HRN) of the layer that contains this data and the zoom level of the layer with traffic data. You can find the catalog HRN in the Data section of the portal.

To visualize HERE Real-Time Traffic Data from a catalog, follow these steps:

  1. Install the web app generator and enter your application name when prompted.

  2. When prompted What kind of data will you visualize on top of the Base map?, select the option Traffic Flow data.

  3. When prompted HRN of the Catalog you want to visualize?, enter the HRN of the catalog that has traffic data.

  4. When prompted Name of the layer you want to visualize?, enter the name of the layer that contains traffic data.

  5. When prompted On which level the data is stored?, enter the level of the layer with traffic data.

  6. Once the code is generated, you can build and serve the web app by running the following command:

    npm run start

    To see the web app, open http://localhost:8080 in a web browser.

    To render the base map, enter the credentials that you obtained from the platform. {/* ## The Speed Limit Data Source You could build your own Data Source to visualize Data even if it doesn't contain latitude and longitude. Instead, you could map your data to the topology segments from HERE Map Content. For that purpose your could use Geometry Data Provider that provides geometry from topology-geometry layer from HERE Map Content. To understand how to use this data provider, let's examine an implementation of sample SpeedLimitsDataSource from speed limits example. You can find source code of this datasource in src/datasources/speedLimitsDataSource of an @here/olp-examples package. Constructor of SpeedLimitsDataSource accepts an instance of SegmentAnchorGeometryDataProvider as one of its parameters. This class provides geometry for a specific SegmentAnchor from RIB topology data. SegmentAnchor is an object which describes a linear chains of road segments. This is a common way of mapping data to road geometries from RIB road topology layer. You can find more information on SegmentAnchor in HERE Map Content Data Specification. Actual creating of geometry is implemented in SpeedLimitsTile class. It accepts decoded speed limits data from datasource and creates line geometries in createRoadGeometries method. In this method you can see a call to getSegmentAnchorCoordinates method of data provider. It returns an array of geographical coordinate [long; lat] pairs which are then projected to world coordinates using MapView's projection. Please note that getSegmentAnchorCoordinates is asynchronous - it returns a promise which resolves with coordinates array. Corresponding technique is picked according to speed limit value so roads with different limits will have different colors. Final geometry is then generated from these coordinates and technique. SegmentAnchorGeometryDataProvider can also be used by external rendering plugins of GeoJSON datasource to visualize custom data mapped to RIB road topology. There is an example of using geometry data provider in rendering plugins. There are also two other road geometry data providers - OmvRoadSegmentsDataProvider and RibRoadSegmentsDataProvider which are used by traffic datasource from olp-traffic-datasource package. They work in somewhat different way - return all road segment for a certain tile. The first one gets road information from OMV catalogs while the latter one retrieves data from HERE Map Contents road topology layer. It is preferable to use HERE Map Contents-based data provider because it has smaller memory footprint, performance overhead, and provides full road segments. (OMV data may have partial segments.)*/} Changelog API reference