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:
- FromLatitude - from point latitude in decimal degrees (e.g. 52.342)
- FromLongitude- from point longitude in decimal degrees (e.g. 100.342)
- ToLatitude - to point latitude in decimal degrees
- ToLongitude - to point longitude in decimal degrees
- DistanceKM - distance in kilometres
- 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-location - to-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:
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:
- 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.
- 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!