Visualization of trips returned by XTour

This forum deals with any kind of trip optimization whether it is automatic planning or manual dispatching, refering to transport orders or service planning.

Visualization of trips returned by XTour

Postby jakubkurchan » Tue Mar 17, 2020 9:25 am


How can I obtain paths of the individual trips returned by XTour.planTours? I'm primarily looking for a polyline or list of coordinates that I can convert to polyline and display on Google Maps. Or perhaps xServer offers a way to display that? Of course I mean real path that goes on a road, not airline.
Posts: 2
Joined: Tue Mar 17, 2020 9:00 am

Re: Visualization of trips returned by XTour

Postby Bernd Welter » Tue Mar 17, 2020 9:55 am

Hello Jakub,

for the required feature you need to act as follows:
  • Use xTour to determine the tours, trips and stop sequences of the orders/locations. This will help you to get the proper sequence of (x,y) coordinates from each stop but not the detailed polygon line
  • Use xRoute2.calculateRoute and gather the detailed polygons of each partial trip or tour. This requires the resultfield.polyline=true. The RouteResponse object will then provide the polyline in a format specified by the RouteRequest.geometryOptions
  • FInally you can display the polygon lines on a mapping framework (xServer.NET for .NET developers, LEAFLET or OPENLAYERS for JavaScript developers, ...) in combination with a mapping engine (e.g. PTV xMapServer).
The step 2 is somehow optional: quite often dispatching user interfaces need to display the stop sequence but not necessarily the detailed route.
Both maps: same sequence of stops, both tour responses based on routing dima
Left: displayed with simple airline connection
Right: after polygon has been calculated via xRoute

Does this answer the question?
Best regards,
Bernd Welter
Senior Technical Consultant Developer Components
PTV GROUP - Germany

Bernd at Youtube
User avatar
Bernd Welter
Site Admin
Posts: 1545
Joined: Mon Apr 14, 2014 10:28 am

Return to PTV xTourServer