Skip to main content

Route Matrix (POST)

Contents

The Route Matrix API returns the travel time and distance for a matrix of origins and destinations. It does not provide any detailed information about the route. The limit of origins and destinations is 10 * 10.

Requires add-on license

POST /route/matrix?dataset={dataset}

Resource URL

https://pcmiler.alk.com/apis/rest/v1.0/Service.svc/route/matrix?dataset={dataset}

Request Element

The POST Route Matrix operation requires a JSON-formatted RouteMatrixRequestBody object in the POST body.

Element Description Required
RouteMatrixRequestBody A RouteMatrixRequestBody System Object. (See sample below.) Y
RegionalDataSet The regional dataset. Possible value: Current (default), PCM_EU, PCM_OC, PCM_SA, PCM_AF, PCM_AS, PCM_ME, PCM_GT, PCM_WW and PCM_NA. Y

RouteMatrixRequestBody

Element Definition Required
Origins List of Location Object that makes up the origins.
Max number of origins is 10.
Y
Destinations List of Location Object that makes up the destinations.
Max number of destinations is 10.
Y
Options Route Options Object. N

Sample JSON POST Body

You can either pass in an Address or Coords for your Origins and Destinations.

{
  "Origins": [
    {
      "Address": {
        "StreetAddress": "416 Bear Creek Circle",
        "City": "Lamar",
        "State": "MS",
        "Zip": "38642",
        "County": "Marshall",
        "Country": "United States"
      },
      "Region": 4
    },
    {
      "Address": {
        "StreetAddress": "1260 Bluntzer Road",
        "City": "Goliad",
        "State": "TX",
        "Zip": "77963",
        "County": "Goliad",
        "Country": "United States"
      },
      "Region": 4
    },
    {
      "Address": {
        "StreetAddress": "Phillips Oil Field Road",
        "City": "Cameron",
        "State": "LA",
        "Zip": "70631",
        "County": "Cameron",
        "Country": "United States"
      },
      "Region": 4
    },
    {
      "Coords": {
        "Lon": "-87.17583265",
        "Lat": "39.35209383"
      },
      "Region": 4
    },
    {
      "Coords": {
        "Lon": "-101.7732569",
        "Lat": "34.20324049"
      },
      "Region": 4
    }
  ],
  "Destinations": [
    {
      "Coords": {
        "Lon": "-98.22538877",
        "Lat": "37.79842125"
      },
      "Region": 4
    },
    {
      "Coords": {
        "Lon": "-88.4959995",
        "Lat": "39.77010595"
      },
      "Region": 4
    },
    {
      "Coords": {
        "Lon": "-104.2990388",
        "Lat": "40.68677485"
      },
      "Region": 4
    },
    {
      "Address": {
        "StreetAddress": "",
        "City": "Potts Camp",
        "State": "MS",
        "Zip": "38659",
        "County": "Marshall",
        "Country": "United States"
      },
      "Region": 4
    },
    {
      "Address": {
        "StreetAddress": "",
        "City": "Elkhart",
        "State": "KS",
        "Zip": "67950",
        "County": "Morton",
        "Country": "United States"
      },
      "Region": 4
    }
  ],
  "Options": {
    "VehicleType": 0,
    "RoutingType": 1,
    "HighwayOnly": true,
    "FuelRoute": false,
    "ClassOverrides": 1,
    "DistanceUnits": 0,
    "TollDiscourage": true,
    "BordersOpen": true,
    "OverrideRestrict": false,
    "HazMatType": 3,
    "RouteOptimization": 2,
    "TruckCfg": {
      "Units": 0,
      "Height": "13\u00276\"",
      "Length": "53\u0027",
      "Width": "96\"",
      "Weight": "14000",
      "Axles": 8,
      "LCV": false
    },
    "HubRouting": false,
    "AFSetIDs": null,
    "ElevLimit": null,
    "FerryDiscourage": false,
    "UseSideofStreet": 1
  }
}

Sample Response

{
  "Origins": [
    {
      "Address": {
        "StreetAddress": "416 Bear Creek Circle",
        "City": "Lamar",
        "State": "MS",
        "Zip": "38642",
        "County": "Marshall",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "34.930632",
        "Lon": "-89.331208"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "CDT",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": null,
      "CrossStreet": null
    },
    {
      "Address": {
        "StreetAddress": "1260 Bluntzer Road",
        "City": "Goliad",
        "State": "TX",
        "Zip": "77963",
        "County": "Goliad",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "28.883464",
        "Lon": "-97.332268"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "CDT",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": null,
      "CrossStreet": null
    },
    {
      "Address": {
        "StreetAddress": "Phillips Oil Field Road",
        "City": "Cameron",
        "State": "LA",
        "Zip": "70631",
        "County": "Cameron",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "29.757106",
        "Lon": "-93.627893"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "CDT",
      "Errors": [
        {
          "Type": 0,
          "Code": 89,
          "LegacyErrorCode": 1000,
          "Description": "Input address does not contain a house or building number"
        }
      ],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": null,
      "CrossStreet": null
    },
    {
      "Address": {
        "StreetAddress": "3594 West Co Rd 250 South ",
        "City": "Cory",
        "State": "IN",
        "Zip": "47846",
        "County": "Clay",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "39.352094",
        "Lon": "-87.175833"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "EDT",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": 0.005,
      "CrossStreet": null
    },
    {
      "Address": {
        "StreetAddress": "1820 Route 80",
        "City": "Plainview",
        "State": "TX",
        "Zip": "79072",
        "County": "Hale",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "34.203240",
        "Lon": "-101.773257"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "CDT",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": 0.063,
      "CrossStreet": null
    }
  ],
  "Destinations": [
    {
      "Address": {
        "StreetAddress": "22150 South Peace Road",
        "City": "Arlington",
        "State": "KS",
        "Zip": "67514",
        "County": "Reno",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "37.798421",
        "Lon": "-98.225389"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "CDT",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": 0.182,
      "CrossStreet": null
    },
    {
      "Address": {
        "StreetAddress": "1681 2500 North",
        "City": "Arthur",
        "State": "IL",
        "Zip": "61911",
        "County": "Douglas",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "39.770106",
        "Lon": "-88.496000"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "CDT",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": 0.102,
      "CrossStreet": null
    },
    {
      "Address": {
        "StreetAddress": "Route 96",
        "City": "Briggsdale",
        "State": "CO",
        "Zip": "80611",
        "County": "Weld",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "40.686775",
        "Lon": "-104.299039"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "MST",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": 0.246,
      "CrossStreet": null
    },
    {
      "Address": {
        "StreetAddress": "",
        "City": "Potts Camp",
        "State": "MS",
        "Zip": "38659",
        "County": "Marshall",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "34.651448",
        "Lon": "-89.301208"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "CDT",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": null,
      "CrossStreet": null
    },
    {
      "Address": {
        "StreetAddress": "",
        "City": "Elkhart",
        "State": "KS",
        "Zip": "67950",
        "County": "Morton",
        "Country": "United States",
        "SPLC": null,
        "CountryPostalFilter": 0,
        "AbbreviationFormat": 0,
        "CountryAbbreviation": "US"
      },
      "Coords": {
        "Lat": "37.009147",
        "Lon": "-101.901739"
      },
      "Region": 4,
      "Label": "",
      "PlaceName": "",
      "TimeZone": "CDT",
      "Errors": [],
      "SpeedLimitInfo": null,
      "ConfidenceLevel": "Exact",
      "DistanceFromRoad": null,
      "CrossStreet": null
    }
  ],
  "MatrixInfo": [
    [
      {
        "Success": true,
        "Errors": [],
        "Time": "11:47:45",
        "Distance": "712.00"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "09:58:44",
        "Distance": "535.07"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "20:15:00",
        "Distance": "1189.01"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "01:17:20",
        "Distance": "74.62"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "13:36:18",
        "Distance": "818.00"
      }
    ],
    [
      {
        "Success": true,
        "Errors": [],
        "Time": "11:22:51",
        "Distance": "710.87"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "21:07:55",
        "Distance": "1216.81"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "18:45:32",
        "Distance": "1087.87"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "12:50:06",
        "Distance": "753.44"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "12:48:28",
        "Distance": "757.06"
      }
    ],
    [
      {
        "Success": true,
        "Errors": [],
        "Time": "12:03:00",
        "Distance": "742.49"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "19:04:22",
        "Distance": "1051.20"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "20:26:16",
        "Distance": "1212.64"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "10:16:12",
        "Distance": "570.95"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "13:47:34",
        "Distance": "841.64"
      }
    ],
    [
      {
        "Success": true,
        "Errors": [],
        "Time": "15:42:18",
        "Distance": "912.26"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "03:00:21",
        "Distance": "149.54"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "00:35:27",
        "Distance": "1416.33"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "08:18:25",
        "Distance": "442.31"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "19:16:40",
        "Distance": "1165.11"
      }
    ],
    [
      {
        "Success": true,
        "Errors": [],
        "Time": "07:15:14",
        "Distance": "414.96"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "21:57:36",
        "Distance": "1311.77"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "09:45:00",
        "Distance": "555.00"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "14:02:56",
        "Distance": "852.62"
      },
      {
        "Success": true,
        "Errors": [],
        "Time": "03:47:52",
        "Distance": "224.19"
      }
    ]
  ]
}
Last updated July 6, 2023.
API Endpoint:

Contents