Import own distance matrix data

deals with computation of distance matrices
Post Reply
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Import own distance matrix data

Post by Bernd Welter »

Hi there,

recently I've been asked:
Can we pass an external road network’s result the algorithm as the time and distance matrix input to the algorithm?
The answer in the context of xServer2 (2.27 and above) is "yes": we invented a com.ptvgroup.xserver.xdima.ImportDistanceMatrixRequest which enables you to import your Here are some constraints - seen in the context of the current v2.27 / v2.28 / v2.28.1 (23.3.2023)
  • It is not possible to extend such a custom matrix. This might be subject to change.
  • You can't import multi travel time dimas (travel time profiles)
  • You can't import toll data
  • The size of a custom dima could be limited (depends on server configuration)
Here's some more background info about when users want to apply such a technique in the context of xServer2. Take it from a meta perspective:
  • A party has neither a routing source nor an optimization algorithm: in this case xDima2 is used to craete one or more dima's on the service and then the xtour2 calls can refer to the data. This works pretty fine: it's been designed for such scenarios!
  • Some players have their own optimization algorithms which considers specific needs of dedicated industries. These players create the distance matrix and export it (download it) on client side to provide it to their optimization infrastructure.
  • Some players compute their own traveltimes and distances through some remote source, e.g. based on public transport schedules or a non-ptv routing engine. They want to consider these KPIs in a PTV based optimization because they don't have their own algorithms. These parties would have to use the IMPORT approach mentioned above.
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:
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Import own distance matrix data

Post by Bernd Welter »

Here's a sample request... a simple 2x2 dima upload - also works fine in xServer Internet 2...

Code: Select all

{
  "$type" : "ImportDistanceMatrixRequest",
 "startLocations": [
    {
      "$type": "OffRoadRouteLocation",
      "offRoadCoordinate": {
        "x": 6.22029,
        "y": 49.61513
      }
    },
    {
      "$type": "OffRoadRouteLocation",
      "offRoadCoordinate": {
        "x": 6.1029,
        "y": 49.6432
      }
    }
  ],
  "destinationLocations": [
    {
      "$type": "OffRoadRouteLocation",
      "offRoadCoordinate": {
        "x": 6.22029,
        "y": 49.61513
      }
    },
    {
      "$type": "OffRoadRouteLocation",
      "offRoadCoordinate": {
        "x": 6.1029,
        "y": 49.6432
      }
    }
  ],
  "label":"My Import Matrix",
  "contents":
  
{
    "$type": "DistanceMatrixContentsArrays",
    "distances": [
      0,
      24056,
      17363,
      0
    ],
    "travelTimes": [
      0,
      1728.128,
      1752.477,
      0
    ],
    "violated": [
      false,
      false,
      false,
      false
    ],
    "estimatedByDirectDistance": [
      false,
      false,
      false,
      false
    ]
  }
}
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