External travel distance and times matrix file

From ODL Studio release 1.3.4 onwards you can store the matrix of travel times and distances for vehicle routing in an external text file. This lets you generate travel times and distances from a provider of your choice - e.g. Google maps distance matrix API or HERE maps - and use these to model your truck fleet routes within ODL Studio. The matrix text file should be in tab-separated format with the following fields:

  1. FromLatitude - from point latitude in decimal degrees (e.g. 52.342)
  2. FromLongitude- from point longitude in decimal degrees (e.g. 100.342)
  3. ToLatitude - to point latitude in decimal degrees
  4. ToLongitude - to point longitude in decimal degrees
  5. DistanceKM - distance in kilometres
  6. Time - time in standard ODL Studio time format, which is hours:minutes:seconds, for example 01:43:23. If the travel time is greater than 24 hours, you should include a days component as well - e.g. 1d 01:23:12

The file must have a header line containing the field names on the first line. Each row after the header line contains a single A to B travel time and distance combination. The latitude and longitude coordinates in the text file must match the latitude and longitudes in your Excel, to an accuracy of approximately a metre. The text file must also contain rows for each combination of from-locationto-location in your Excel file, otherwise ODL Studio will report an error when you use it.

To use this file, edit your vehicle routing .odlx script and set your distances to use the EXTERNAL_MATRIX option:

external-matrix-config1

The click on settings and set the file location of the matrix. You can set the file location of the text file in two ways:

  1. Automatic. This is based on the filename of the current loaded Excel spreadsheet. If the loaded Excel filename is myexcel.xlsx, then the system will look for a matrix text file at myexcel.matrix.txt. With this method you can use different matrices (e.g. for different geographic regions) without editing the script file.
  2. Explicitly set the filename. The filename could be either (a) an absolute file on your file system e.g. c:\files\matrix.txt or (b) a relative filename, relative to the data\travelmatrices subdirectory of the ODL Studio directory. So for example, if you set the file to be matrix.txt, it will be assumed to live in c:\program files\ODL Studio\data\travelmatrices.txt. ODL Studio uses this pattern for several types of file, allowing an ODL Studio installation setup to be copied between computers.

This zip file contains an example .xlsx spreadsheet with matrix text file and vehicle routing .odlx script, set to use automatic mode. Try it out!

Support sessions

We provide all the configuration, consultancy and training you need to get the best out of ODL Studio. Contact us to arrange a Skype or join.me support session today. Details of our support session pricing options are available here.

ODL Studio screenshots

ODL Newsletter

Want to know when a new version of ODL Studio is released? Click below to join our newsletter.

Recent posts

View all posts