Use Cases > PTV xMap > How to Install TrafficInfoLoader

How to use real-time Traffic Information with TrafficInfoLoader

Caution: The service "TrafficInfoLoader" is deprecated. PTV recommends implementing Feature Layer theme "PTV_TrafficIncidents" to obtain real-time traffic information for route planning. Benefit from the time-dependent attributes!

This section describes the installation and configuration of PTV xServer add-on TrafficInfoLoader. Due of different deployment scenarios PTV recommends using the below described deployment.

PTV xServer add-on TrafficInfoLoader stands for loading traffic information provided by PTV via PTV Traffic Information Server. Please note that this server is not external visible.

The following chapter contains the installation and configuration of PTV xServer add-on TrafficInfoLoader. Additionally it describes how you can setup an environment that provides all the basic infrastructure and functionality to handle the traffic tasks and gives you hints on how to make your application being traffic-aware.

Benefits

PTV customers often want to integrate traffic information into their applications, either to only display them on maps or to use them for routing e.g. avoiding jams or getting better travel times.

Traffic information is real-time data which doesn't include forecasts. In contrast to traffic patterns, it contains data on current traffic incidents. It further includes information on long-term construction work and events (e.g. parade on Saturday, from 10:00 a.m. - 3:00 p.m.). It is thus appropriate for current route planning, but not for any planning in advance. This traffic information that is saved to a Traffic server is transmitted in short configurable intervals by an add-on module (servlet), the so-called TrafficInfoLoader.

 

Concept

Basic Architecture

This following actions are required:

  1. Information about the current traffic situation has to be integrated into the PTV xServer environment. Besides access to the traffic messages this especially includes geocoding of jams with respect to the installed network.

  2. PTV xServer have to be configured to be able to use the traffic information. They need to be able to access the information produced in an earlier step.

  3. PTV xServer based applications need to be made traffic-aware. This means you have to use the API in a way that traffic information is respected in a way you want it to be.

The PTV xServer add-on TrafficInfoLoader accesses the PTV Traffic Information Server and periodically downloads traffic messages from there. Since the downloaded messages are not yet geo-related to your local map version, they cannot be used for routing purposes directly. However you can store them in a database and use PTV xRoute Server to link them to your local map. PTV xRoute Server will transform a message into a binary route description that can then be stored into your database and be used for routing later on.

The traffic information database needs to be accessible from PTV xServer and the Loader module. It consists of simply one flat table that provides a simplified view on the traffic information. This table contains the reference coordinates of messages, message texts in several languages, the geometry (line string) and the binary route that can be used for avoiding jams.

Deployment scenarios

Two deployment scenarios could be executed in general:

Deploy TrafficInfoLoader into the PTV xServer

Technically it is possible to deploy the TrafficInfoLoader into an existing PTV xServer e.g. the PTV xRoute Server. But there are reasons why this is not recommended:

Deploy TrafficInfoLoader into a single Tomcat

We recommend deploying the TrafficInfoLoader into a single Tomcat. Then you have a separated instance, accessing the external service and providing it to the other PTV xServer. This leads to the following typical scenario for scalable service backends which is described in the following chapters.

Installation

Installation Apache TomcatTM

Download the latest version of Apache’s open-source servlet container Tomcat and install it on your operating system.

In the document RUNNING.txt you will find installation and configuration instructions, e.g. as prerequisite you need to install a Java SE Runtime Environment (JRE). Please note the corresponding license agreement.

Installation TrafficInfoLoader

Download the latest version of TrafficInfoLoader from the PTV’s Developer Zone and unzip the file TrafficInfoLoader-<Version>.zip.

Basic settings
Traffic Info for visualization
Traffic Info for routing calculation

Setting up traffic information database

Typically you will want to use your own database for the traffic information. In order to do so you need to create a table and add indices to it. PTV provides an example database script for an Apache Derby database TrafficInfo_table_Derby.sql in order to create the necessary traffic table T_DATA_TRAFFIC_INFORMATION. This table is used for loading, updating or deleting traffic information and must be created before starting the TrafficInfoLoader. PTV also provides an example database script for Microsoft SQL Server TrafficInfo_table_MSSQL.sql. Both scripts serve as an example and may need to be tailored to your needs.

Moreover the Tomcat of the TrafficInfoLoader needs the client database library. So you have to copy the corresponding JAR file into the folder <Tomcat folder>/lib . In case of an Apache Derby database you can get the library derbyclient-<version>.jar e.g. from the folder <PTV xRoute folder>/shared/lib .

Configuration

The configuration depends on your environment. As the PTV xRoute Server is equipped with an Apache Derby database by default, we use this database in the following to give you an example for one possible deployment. Therefore we create the traffic table T_DATA_TRAFFIC_INFORMATION as part of the table schema POI with the help of the provided script earlier mentioned.

Please use the instructions in this chapter as a template for your environment.

Configuration TrafficInfoLoader

You have to adapt the configuration file of the TrafficInfoLoader TrafficInfoLoader-<Version>.properties to fit to your needs. Typically you need to change the proxy settings and the database section. Most probably you would like to alter the list of information providers, e.g. for which country the traffic information should be fetched (entry provider). The default period for downloading traffic messages is five minutes which should be sufficient for the majority of our customers (entry interval). If you want to integrate traffic information in the routing calculation and not only for visualization, you also have to configure the URL to the PTV xRoute Server (entry xrouteUrl).

In order to use the Apache Derby database of the PTV xRoute Server you have to adapt the database section:

trafficstore.connection=jdbc:derby://localhost:50036/poi
trafficstore.user=POI
trafficstore.passwd=POI

Configuration PTV xServer

The file traffic-geodatasource.xml contains the database settings used by the PTV xServer to access the traffic information. Typically you need to define the driver, database URL, user and password to match your database environment.

In order to use the Apache Derby database of the PTV xRoute Server you have to adapt the following entry in the PTV xRoute Server and PTV xMap Server:

<Datasource driver="org.apache.derby.jdbc.ClientDriver" url="jdbc:derby://localhost:50036/poi" user="POI" password="POI"/>

Testing the configuration

For a first check of the above configuration you have to start respectively restart the PTV xRoute Server and the PTV xMap Server. Then you can use the startup.bat in the folder <Tomcat folder>/bin to start the TrafficInfoLoader.

Verify the following messages, otherwise an error occurred and you have to check your installation and configuration again:

Test TrafficInfoLoader

Test visualization

Test with PTV xServer add-on AJAX Maps

An easy way of testing the installation is to use the PTV xServer add-on AJAX Maps. You can download the latest version of this add-on from the PTV’s Developer Zone and install it on your operating system. Additional steps are:

Test with PTV xMap Server Testtool

Another easy test for visualization of traffic information is possible with the PTV xMap Server Testtool. The tool is designed to create and send requests directly to PTV xMap Server. It is also possible to import and export XML requests. To display the traffic information you just have to define the SMOLayer traffic.ptv-traffic .

Test routing calculation

To consider traffic information in routing calculation is quite simple. In the service method calulateRoute of the PTV xRoute Server you have to reference the corresponding traffic layer. Therefore set in the request the routing parameter GEODATASOURCE_LAYER to the value traffic.ptv-traffic. Then the calculated route avoids traffic jams if a better route exists. The decision in which cases to avoid traffic jams and in which cases not is configured in the file geodata-ptv-traffic.xml .


Disabled geodata source layer

Enabled geodata source layer