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.
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.
This following actions are required:
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.
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.
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.
Two deployment scenarios could be executed in general:
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:
PTV xServer are designed to be backend services, i.e. components that are typically deployed in the restricted area of customers IT-infrastructure. Hence simply accessing an external service is usually not feasible, which means that a traffic access module will typically not be part of a single PTV xServer.
PTV xServer are designed to be stateless so that they can easily be scaled up by simply adding new servers, if your application needs higher throughput. Hence it doesn’t make sense in such environments to access an external service every few minutes from each server.
PTV xServer use the Tomcat Web Application Server. This version of the Tomcat container is frozen. Neither security patches could be added nor could the Tomcat container be replaced by a more recent version.
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.
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.
Download the latest version of TrafficInfoLoader from the PTV’s Developer Zone and unzip the file TrafficInfoLoader-<Version>.zip.
Copy
TrafficInfoLoader-<Version>.war
into the folder
<Tomcat folder>/webapps
.
Copy
TrafficInfoLoader-<Version>.properties
into the folder
<Tomcat folder>/conf
.
As the TrafficInfoLoader is available for purchase you need a
license file license.ptv in the basic Tomcat folder. The license
file is the same as in the PTV xServer and needs the entry
traffic.download=true
. Otherwise TrafficInfoLoader rejects to start. From version 3.1 on
there is the additional entry
traffic.providers
available with the name of the licensed provider (NAVTEQ or TOMTOM).
In case of no entry the default provider is NAVTEQ. From version 3.2
on the provider NAVTEQ is renamed to HERE, but older licenses with
NAVTEQ still work.
Copy
geodata-ptv-traffic.xml
and
traffic-geodatasource.xml
for visualization of traffic information into the folder <PTV
xMap folder>/conf of your already installed PTV xMap Server (1.10
or later).
Copy the folder
bitmaps/traffic
into the folder
<PTV xMap folder>/data/bitmaps
. Then there are icons for traffic signs like accident, danger, jam
or road work available.
Copy
geodata-ptv-traffic.xml
and
traffic-geodatasource.xml f
or integrating traffic information in the routing calculation into
the folder
<PTV xRoute folder>/conf
of your already installed PTV xRoute Server (1.10 or later).
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
.
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.
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
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"/>
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:
INFO: Server startup in <milliseconds> ms
Traffic info poll service is up and running.
loading traffic messages…
Downloading traffic messages from …
New traffic information is now available - received <message count> messages.
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:
Copy the provided demo html page
ajax-traffic-sample.html
into the folder
<Tomcat folder>/webapps/ajaxmaps
of your already installed PTV xServer add-on AJAX Maps.
Start the demo html page with
http://localhost:8080/ajaxmaps/ajax-traffic-sample.html
and the traffic information should appear on the map.
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
.
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
Copyright © 2024 PTV Logistics GmbH All rights reserved. | Imprint