Translate traffic information

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
Post Reply
alex.mihov
Posts: 4
Joined: Thu Jan 04, 2018 8:59 am

Translate traffic information

Post by alex.mihov »

Hello together,

How can we translate the messages about traffic, closed roads etc into different languages?
Also what languages are supported?

For now we only have the german ones:
18 Richtung Delémont/Reinach-Nord bei Muttenz Veränderte Verkehrsführung im Baustellenbereich
Thanks in advance
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Translate traffic information

Post by Bernd Welter »

Hello together,

the language used in the traffic info loader descriptions is configured in a file named “traffic-geodatasource.xml” (left side of the screenshot).
Check the screenshot.
LEFT: configuration of the traffic info loader plugin. It consumes the events incl. the messages  and stores the info in the database table<br /><br />CENTER: the database table (in my system I used MS SQL Server but you can also use other RDBMS)<br /><br />RIGHT: the geodatasource configuration file which is responsible for the consumption of the geometry (display via xmap) and exception_path (detour via xroute)
LEFT: configuration of the traffic info loader plugin. It consumes the events incl. the messages and stores the info in the database table

CENTER: the database table (in my system I used MS SQL Server but you can also use other RDBMS)

RIGHT: the geodatasource configuration file which is responsible for the consumption of the geometry (display via xmap) and exception_path (detour via xroute)
The traffic info loader is based on a two step architecture:
  • The Traffic Info Loader plugin consumes the traffic events and messages via internet and stores them into a database
    My screenshot shows the table on the right. The table contains several description columns such as
    • C_DESCRIPTION_DE which contains the German text message
    • C_DESCRIPTION_EN which contains the English version
    • … and so on
    The configuration of the Traffic Info Loader is part of the file TrafficInfoLoader.properties
  • The second component is the reading access of xMap and xRoute which is based on the GEODATASOURCE layer.
    A geodatasource layer shows database content (not only traffic messages but also POIs or areas) and determines
    the relevant table columns based on a file such as traffic-geodatasource.xml (left side of the screenshot).
    The default text message refers to C_DESCRIPTION_DE. If you want to use English just reconfigure line14
    to use C_ DESCRIPTION_EN.
  • One sidenote: if you want to switch between several translations via API this is also possible but requires
    several configuration files.
  • Please be aware that the state-of-the-art approach of Traffic Message consumption is the feature layer PTV_TrafficIncidents (replaces geodatasource) which is updated via the Content Update Service (replaces traffic info loader).
Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
alex.mihov
Posts: 4
Joined: Thu Jan 04, 2018 8:59 am

Re: Translate traffic information

Post by alex.mihov »

Hi Bernd, thanks for the elaboration.

In our case, we are using PTV as a Service and consume the service as follows:

Code: Select all

this.traffic = new L.PtvLayer.TrafficInformation('https://xmap-eu-n.cloud.ptvgroup.com', {
      zIndex: 1,
      token: 'xxxxxxxxxxxxxxxx'
 });

We looked it up here:

https://github.com/ptv-logistics/Leafle ... er.js#L309

Can you explain to us how to get the different traffic information languages this way?

All the best!
User avatar
Oliver Heilig
Posts: 160
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: Translate traffic information

Post by Oliver Heilig »

Hello Alex,

i must say this is not that simple out-of-the-box. It requires a layer-configuration which returns multiple language fields. This is not supported by the default configration of the TrafficInformation layer. However, there's an alternative "map&guide-internet" TrafficInfoLayer that returns the description for multiple languages. Suported are 'DE', 'EN', 'FR', 'NL' and 'IT'. I've added a layer class L.PtvLayer.TrafficInformation.Mgi to the GitHub project:

https://github.com/ptv-logistics/Leafle ... #L341-L377

This supports a 'language' option (see code below). I've updated the sample of the project to display the english description http://ptv-logistics.github.io/Leaflet.PtvLayer/. We'll check if we can add the multi-language support to the default-configuration.

Code: Select all

// add traffic information - use the map&guide-internet configuration
var traffic = new L.PtvLayer.TrafficInformation.Mgi(xMapUrl, {
   zIndex: 1, 
   attribution: xMapAttribution,
   language: 'EN',
   token: token
}).addTo(map);
Regards

Oli
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
alex.mihov
Posts: 4
Joined: Thu Jan 04, 2018 8:59 am

Re: Translate traffic information

Post by alex.mihov »

Hi Oli,

I just today saw that you had answered... We have implemented the new solution, thanks :)

The one question that we have no is, is it possible to configure the units for the other languages?
For example in English we get the distances in yards instead of KM which would be a nice addition.

All the best,

Alex
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Translate traffic information

Post by Bernd Welter »

Hello ALex,

unfortunately the units are metric only.

Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
alex.mihov
Posts: 4
Joined: Thu Jan 04, 2018 8:59 am

Re: Translate traffic information

Post by alex.mihov »

Hello Bernd,

When we switch to English, the units are imperial, i.e. the distance is shown in yards:
Route de Veyrier bei Carouge 487 yards of traffic
What would be nice to have is a possibility to get everything metric or everything imperial; but i guess there is no way to set that?
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Translate traffic information

Post by Bernd Welter »

Hello Alex,

those texts are probably retrieved by the provider and forwarded 1:1, so you might be able to change the language but you still depend on what the provider wrote into the text.

For any businesscase I assume that you want to get the properties of a route in imperial units, such as segment length or route lenght. Afaik those values are metric only.

Regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply