Travel cost matrix

Travel cost matrix example

Figure :

A travel cost matrix between five major cities in Australia. Each row in the table represents the driving time in minutes and the driving distance in kilometers between a city pair.

What is a travel cost matrix?

A travel cost matrix, also known as the origin-destination (OD) cost matrix, is a table or a matrix containing the cost, such as the travel time or travel distance, from multiple origins to multiple destinations. It ranks the destinations that each origin connects to in ascending order based on the minimum cost required to travel from that origin to each destination.

You can use a travel cost matrix to build applications that:

  • Determine the accessibility of real estate by measuring the driving or walking time from the property to various nearby attractions.
  • Predict the travel behavior of people in a city by calculating the distances people would need to travel to reach certain attractions.
  • Calculate the shipping costs between postal codes using the travel distances from the cost matrix.
  • Use the travel cost matrix as an input in other mathematical models, for example, linear programming, that can be used to make better decisions.

The travel cost matrix service allows you to create an OD cost matrix using various modes of travel from every origin to every destination. You can optionally:

  • Specify the maximum number of destinations to find for each origin instead of all.
  • Provide the maximum time or distance to travel when searching for destinations. Once this cutoff is reached, the service will not search for any more destinations from an origin.
  • Apply current traffic conditions when calculating the cost of travel between origins and destinations.

How a travel cost matrix works

The typical workflow for generating a travel cost matrix is to define:

  1. Starting locations from which to travel to the destinations.
  2. Ending locations to travel to from the origins.
  3. The type of travel for the analysis.
  4. Call the service to find the travel cost matrix between origins and destinations.

URL requests

You can create travel cost matrix by making an HTTPS request to the origin-destination cost matrix service solveODCostMatrix operation or by using client APIs. Specify one or more origins and destinations, and optionally, additional parameters to refine the operation. Some of the most common parameters are described below.

Direct and job

The service supports both direct and job requests. Both Direct and Job request types support all of the capabilities of the service, however, Direct is better suited for shorter requests, and Job is better suited for longer, more complex requests.

The request you choose depends on the complexity of the problem you are trying solve and limits of the request.

Request limits

LimitDirectJob
Maximum number of origins:101,000
Maximum number of destinations:101,000
Maximum transaction time:5 minutes60 minutes
Maximum number of point barriers:250250
Maximum number of street features intersected by polyline barriers:500500
Maximum number of street features intersected by polygon barriers:2,0002,000
Maximum straight-line distance for the walking travel mode:

(If the straight-line distance between any incidents or facilities is greater than this limit, the analysis will fail when the walking restriction is used.)
27 miles (43.45 kilometers)27 miles (43.45 kilometers)
Force hierarchy beyond a straight-line distance of:

(If the straight-line distance between any origin or destination is greater than the limit shown here, the analysis uses hierarchy, even if the travel mode defines not to use hierarchy.)
50 miles (80.46 kilometers)50 miles (80.46 kilometers)
Maximum snap tolerance:

(If the distance between an input point and its nearest traversable street is greater than the distance specified here, the point is excluded from the analysis.)
12.42 miles (20 kilometers)12.42 miles (20 kilometers)
Direct requestJob request

URL

 
https://route-api.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/NAServer/OriginDestinationCostMatrix_World/solveODCostMatrix?<parameters>

Use for shorter transactions with up to 10 origins and 10 destinations that will complete in less than 5 minutes.

Key parameters

Name (Direct)DescriptionExamples
originsStarting locations from which to travel to the destinations.origins=-118.245843,34.057794;-117.16274,32.719178
destinationsEnding locations to travel to from the origins.destinations=-117.182676,34.055909;-118.144184,34.147832
travelModeThe mode of transportation such as driving a car or a truck or walking.travelMode=JSON Object
defaultTargetDestinationCountThe number of destinations to find per origin. A null value or no value for this parameter results in a search for all destinations from every origin.defaultTargetDestinationCount=null
defaultTargetDestinationCount=3
defaultCutoffThe travel time or travel distance value at which to stop searching for destinations from a given origin. The default value is null which means to search until all destinations are found for every origin. The units are time or distance based depending on your travel mode.defaultCutoff=5

Additional parameters: Set additional constraints when creating the travel cost matrix such as timeOfDay to use live traffic conditions or outputType to specify if the output is a table or a matrix representing travel costs.

URL

 
https://logistics.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/GPServer/GenerateOriginDestinationCostMatrix/submitJob?<parameters>

Use for longer transactions with up to 1,000 origins and 1,0000 destinations that will complete in less than 60 minutes..

Key parameters

Name (Direct)DescriptionExamples
originsStarting locations from which to travel to the destinations.origins={"features":[{"geometry":{"x":-118.245843,"y":34.057794}},{"geometry":{"x":-117.16274,"y":32.719178}}]}
destinationsEnding locations to travel to from the origins.destinations={"features":[{"geometry":{"x":-117.182676,"y":34.055909}},{"geometry":{"x":-118.144184,"y":34.147832}}]}
travel_modeThe mode of transportation such as driving a car or a truck or walking.travel_mode=JSON Object
number_of_destinations_to_findThe number of destinations to find per origin. A null value or no value for this parameter results in a search for all destinations from every origin.number_of_destinations_to_find=null
number_of_destinations_to_find=3
cutoffThe travel time or travel distance value at which to stop searching for destinations from a given origin. The default value is null which means to search until all destinations are found for every origin. The units are time or distance based depending on your travel mode.cutoff=5

Additional parameters: Set additional constraints when creating the travel cost matrix such as time_of_day to use live traffic conditions or output_format to specify if the output is a table or a file in CSV or GeoJSON format.

Examples

Direct: Create time-distance matrix

In this example, the travel cost matrix service is used to find the travel time and travel distance between five major cities in Australia. Such a matrix can be used to calculate the cost of shipping goods between these cities by using the travel time and travel distance between any city pair.

To create the travel cost matrix, you need to provide the origins and destinations. In this example, the origins and destinations are identical, but they can be different. By default, the output matrix contains a system-generated identifier to represent each origin and destination. If you need to use your own identifier, you must pass this identifier as the ObjectID field when specifying the inputs.

The response contains odCostMatrix that contains an array of travel costs in minutes, miles, and kilometers between each origin ID and all the destination IDs. The order of the travel costs are based on the costAttributeNames.

APIs

ArcGIS Python API
                                                                                           
"""Create time-distance matrix between major cities in Australia."""

import arcgis
import pandas as pd


def print_result(result):
    """Print useful information from the result."""
    pd.set_option("display.max_rows", None)
    pd.set_option("display.max_colwidth", None)

    output_matrix = result["odCostMatrix"]
    cost_names = output_matrix.pop("costAttributeNames")

    print("Travel costs in Minutes, Miles, Kilometers")
    for origin_id, matrix in output_matrix.items():
        for destination_id, costs in matrix.items():
            print(f"{origin_id} - {destination_id}: {costs}")
        print("-" * 50)


def main():
    """Program execution logic."""
    # inputs
    cities = {
        "spatialReference": {
            "wkid": 4326
        },
        "features": [
            {
                "geometry": {
                    "x": 153.03660,
                    "y": -27.486320
                },
                "attributes": {
                    "ObjectID": 101
                }
            },
            {
                "geometry": {
                    "x": 144.983120,
                    "y": -37.817870
                },
                "attributes": {
                    "ObjectID": 102
                }
            },
            {
                "geometry": {
                    "x": 151.223490,
                    "y": -33.891220
                },
                "attributes": {
                    "ObjectID": 103
                }
            },
            {
                "geometry": {
                    "x": 149.133490,
                    "y": -35.316850
                },
                "attributes": {
                    "ObjectID": 104
                }
            },
            {
                "geometry": {
                    "x": 138.596810,
                    "y": -34.917470
                },
                "attributes": {
                    "ObjectID": 105
                }
            }
        ]
    }

    # Connect to the origin destination cost matrix service and call it
    api_key = "YOUR-API-KEY"
    portal = arcgis.GIS("https://www.arcgis.com", api_key=api_key)
    od_cost_matrix = arcgis.network.ODCostMatrixLayer(portal.properties.helperServices.odCostMatrix.url,
                                                      gis=portal)
    result = od_cost_matrix.solve_od_cost_matrix(origins=cities,
                                                 destinations=cities,
                                                 )
    print_result(result)



if __name__ == "__main__":
    main()

REST API

RequestResponse
cURLHTTP
     
curl https://route-api.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/NAServer/OriginDestinationCostMatrix_World/solveODCostMatrix? \
-d "f=json" \
-d "token=YOUR-API-KEY" \
-d "origins={'spatialReference':{'wkid':4326},'features':[{'geometry':{'x':153.03660,'y':-27.486320},'attributes':{'ObjectID':101}},{'geometry':{'x':144.983120,'y':-37.817870},'attributes':{'ObjectID':102}},{'geometry':{'x':151.223490,'y':-33.891220},'attributes':{'ObjectID':103}},{'geometry':{'x':149.133490,'y':-35.316850},'attributes':{'ObjectID':104}},{'geometry':{'x':138.596810,'y':-34.917470},'attributes':{'ObjectID':105}}]}" \
-d "destinations={'spatialReference':{'wkid':4326},'features':[{'geometry':{'x':153.03660,'y':-27.486320},'attributes':{'ObjectID':101}},{'geometry':{'x':144.983120,'y':-37.817870},'attributes':{'ObjectID':102}},{'geometry':{'x':151.223490,'y':-33.891220},'attributes':{'ObjectID':103}},{'geometry':{'x':149.133490,'y':-35.316850},'attributes':{'ObjectID':104}},{'geometry':{'x':138.596810,'y':-34.917470},'attributes':{'ObjectID':105}}]}"
                                                                                                                                                 
{
  "messages": [],
  "odCostMatrix": {
    "costAttributeNames": [
      "TravelTime",
      "Miles",
      "Kilometers"
    ],
    "101": {
      "101": [
        0,
        0,
        0
      ],
      "102": [
        1092.7348608174257,
        1046.4209599692097,
        1684.0512934006936
      ],
      "103": [
        583.93318392067533,
        563.70453498501615,
        907.19451115092227
      ],
      "104": [
        746.17544921335616,
        737.77369464383673,
        1187.3316688328887
      ],
      "105": [
        1296.7529446594474,
        1256.0205704490879,
        2021.3691689288187
      ]
    },
    "102": {
      "101": [
        1095.9050794862903,
        1049.4433601208411,
        1688.9153749503184
      ],
      "102": [
        0,
        0,
        0
      ],
      "103": [
        537.31828459046574,
        548.37378391787627,
        882.52205890552796
      ],
      "104": [
        414.25754255968559,
        421.99536706373357,
        679.13571201181526
      ],
      "105": [
        474.980135194024,
        454.46359119426711,
        731.38825370694519
      ]
    },
    "103": {
      "101": [
        588.8083081323083,
        562.9725635778766,
        906.01651735867404
      ],
      "102": [
        533.97796000736321,
        544.84295792001888,
        876.83974527083444
      ],
      "103": [
        0,
        0,
        0
      ],
      "104": [
        182.17414666945652,
        180.29749721305072,
        290.16069535483996
      ],
      "105": [
        861.34457646327894,
        854.59014397762053,
        1375.329520669522
      ]
    },
    "104": {
      "101": [
        749.32873915119706,
        738.26328528359409,
        1188.1195885914346
      ],
      "102": [
        413.51139402318358,
        418.61610073734511,
        673.69731002504091
      ],
      "103": [
        184.95059941061567,
        180.65152460849413,
        290.730447219533
      ],
      "104": [
        0,
        0,
        0
      ],
      "105": [
        740.87801047909807,
        728.36328679494545,
        1172.1870854237254
      ]
    },
    "105": {
      "101": [
        1298.9225642865747,
        1256.0604460759289,
        2021.4333425296156
      ],
      "102": [
        473.58471456015383,
        454.5344381495164,
        731.50227082929825
      ],
      "103": [
        862.41794450171722,
        854.74645126263101,
        1375.581072860808
      ],
      "104": [
        739.35720247093627,
        728.36803440848689,
        1172.1947259670931
      ],
      "105": [
        0,
        0,
        0
      ]
    }
  }
}

Job: Calculate walkability

In this example, the walkability is calculated for the location of real estate property to basic amenities such as ATMs, restaurants, grocery stores, and parks. To determine walkability, you need to first find the walking distance (travel distance) to all of the amenities from the property location using the travel cost matrix service. Once you have all of the travel distances between the property location and the amenities, you can use them in a mathematical formula (such as a weighted mean) to calculate walkability.

The example uses some amenities in Seattle, USA. In case you need to adapt this example to your area of interest, you can use the ArcGIS Geocoding service for finding different amenities by category name. For example, the below request allows you to find three ATMs near a location in Seattle.

       
curl https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates? \
-d "f=json" \
-d "token=YOUR-API-KEY" \
-d "category=ATM" \
-d "outFields=LongLabel,Type" \
-d "maxLocations=3" \
-d "location=-122.340013,47.616004"

You specify the property location as origins and the amenities as destinations. The default travel_mode is driving time, so in this case the travel mode is set to walking distance.

APIs

ArcGIS Python API
                                                                                                                                                                                     
"""Calculate walking distance to all amenities from a starting location."""

import arcgis
import pandas as pd


def print_result(result):
    """Print useful information from the result."""
    pd.set_option("display.max_rows", None)
    pd.set_option("display.max_colwidth", None)

    output_matrix = result.output_origin_destination_lines.sdf
    print("\n-- Walking distances -- \n")
    print(output_matrix[["OriginName", "DestinationName", "DestinationRank",
                         "Total_Distance", "Total_Time"]].to_string(index=False))


def main():
    """Program execution logic."""
    # inputs
    origins = {
        "features": [
            {
                "geometry": {
                    "x": -122.341116,
                    "y": 47.61641
                },
                "attributes": {
                    "Name": "2200 6th Ave, Seattle, WA, 98121, USA"
                }
            }
        ]
    }
    destinations = {
        "features": [
            {
                "geometry": {
                    "x": -122.339910,
                    "y": 47.615270
                },
                "attributes": {
                    "Name": "Wells Fargo, 2121 6th Ave, Seattle, WA, 98121, USA",
                    "Type": "ATM"
                }
            },
            {
                "geometry": {
                    "x": -122.341360,
                    "y": 47.616220
                },
                "attributes": {
                    "Name": "Bank of America, 2200 6th Ave, Seattle, WA, 98121, USA",
                    "Type": "ATM"
                }
            },
            {
                "geometry": {
                    "x": -122.339400,
                    "y": 47.613800
                },
                "attributes": {
                    "Name": "Sound Community Bank, 2001 5th Ave, Seattle, WA, 98121, USA",
                    "Type": "ATM"
                }
            },
            {
                "geometry": {
                    "x": -122.337977,
                    "y": 47.618351
                },
                "attributes": {
                    "Name": "Whole Foods Market, 2210 Westlake Ave, Seattle, WA, 98121, USA",
                    "Type": "Grocery"
                }
            },
            {
                "geometry": {
                    "x": -122.337396,
                    "y": 47.618669
                },
                "attributes": {
                    "Name": "District H, 101 Terry Ave N, Seattle, WA, 98109, USA",
                    "Type": "Grocery"
                }
            },
            {
                "geometry": {
                    "x": -122.344450,
                    "y": 47.614170
                },
                "attributes": {
                    "Name": "Dans Belltown Grocery, 2221 3rd Ave, Seattle, WA, 98121, USA",
                    "Type": "Grocery"
                }
            },
            {
                "geometry": {
                    "x": -122.340099,
                    "y": 47.616020
                },
                "attributes": {
                    "Name": "Elm Coffee Roasters Doppler, 2121 7th Ave, Seattle, WA, 98121, USA",
                    "Type": "Snacks"
                }
            },
            {
                "geometry": {
                    "x": -122.340149,
                    "y": 47.616090
                },
                "attributes": {
                    "Name": "Amazon Go, 2131 7th Ave, Seattle, WA, 98121, USA",
                    "Type": "Fast Food"
                }
            },
            {
                "geometry": {
                    "x": -122.339474,
                    "y": 47.615646
                },
                "attributes": {
                    "Name": "General Porpoise, 2101 7th Ave, Seattle, WA, 98121, USA",
                    "Type": "Snacks"
                }
            },
            {
                "geometry": {
                    "x": -122.341109,
                    "y": 47.618590
                },
                "attributes": {
                    "Name": "Denny Park, 800 Denny Way, Seattle, WA, 98109, USA",
                    "Type": "Park"
                }
            },
            {
                "geometry": {
                    "x": -122.337480,
                    "y": 47.613740
                },
                "attributes": {
                    "Name": "Westlake Square, Westlake Ave, Seattle, WA, 98101, USA",
                    "Type": "Park"
                }
            },
            {
                "geometry": {
                    "x": -122.337530,
                    "y": 47.612810
                },
                "attributes": {
                    "Name": "McGraw Square, 5th Ave, Seattle, WA, 98101, USA",
                    "Type": "Park"
                }
            }
        ]
    }

    # Connect to the travel cost matrix service
    api_key = "YOUR-API-KEY"

    # Get the walking distance travel mode defined for the portal. Fail if the travel mode is not found.
    walking_distance_travel_mode = ""
    for feature in arcgis.network.analysis.get_travel_modes().supported_travel_modes.features:
        attributes = feature.attributes
        if attributes["AltName"] == "Walking Distance":
            walking_distance_travel_mode = attributes["TravelMode"]
            break
    assert walking_distance_travel_mode, "Walking Distance travel mode not found"

    # Call the travel cost service
    result = arcgis.network.analysis.generate_origin_destination_cost_matrix(origins=origins,
                                                                             destinations=destinations,
                                                                             travel_mode=walking_distance_travel_mode
                                                                             )
    print_result(result)



if __name__ == "__main__":
    main()

REST API

Unlike Direct request type which allows you to make a request and get back all the results in the response, when working with a Job request type, you need to follow a three step workflow:

  1. Make the submitJob request with the appropriate request parameters to get a job id.
  2. Using the job id, check the job status to see if the job completed successfully.
  3. Use the job id to get one or more results.
1. Submit job2. Check job status3. Get results (output_origin_destination_lines)
cURLHTTP
      
curl https://logistics.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/GPServer/GenerateOriginDestinationCostMatrix/submitJob? \
-d "f=json" \
-d "token=YOUR-API-KEY" \
-d "origins={'features':[{'geometry':{'x':-122.341116,'y':47.61641},'attributes':{'Name':'2200 6th Ave, Seattle, WA, 98121, USA'}}]}" \
-d "destinations={'features':[{'geometry':{'x':-122.339910,'y':47.615270},'attributes':{'Name':'Wells Fargo, 2121 6th Ave, Seattle, WA, 98121, USA','Type':'ATM'}},{'geometry':{'x':-122.341360,'y':47.616220},'attributes':{'Name':'Bank of America, 2200 6th Ave, Seattle, WA, 98121, USA','Type':'ATM'}},{'geometry':{'x':-122.339400,'y':47.613800},'attributes':{'Name':'Sound Community Bank, 2001 5th Ave, Seattle, WA, 98121, USA','Type':'ATM'}},{'geometry':{'x':-122.337977,'y':47.618351},'attributes':{'Name':'Whole Foods Market, 2210 Westlake Ave, Seattle, WA, 98121, USA','Type':'Grocery'}},{'geometry':{'x':-122.337396,'y':47.618669},'attributes':{'Name':'District H, 101 Terry Ave N, Seattle, WA, 98109, USA','Type':'Grocery'}},{'geometry':{'x':-122.344450,'y':47.614170},'attributes':{'Name':'Dans Belltown Grocery, 2221 3rd Ave, Seattle, WA, 98121, USA','Type':'Grocery'}},{'geometry':{'x':-122.340099,'y':47.616020},'attributes':{'Name':'Elm Coffee Roasters Doppler, 2121 7th Ave, Seattle, WA, 98121, USA','Type':'Snacks'}},{'geometry':{'x':-122.340149,'y':47.616090},'attributes':{'Name':'Amazon Go, 2131 7th Ave, Seattle, WA, 98121, USA','Type':'Fast Food'}},{'geometry':{'x':-122.339474,'y':47.615646},'attributes':{'Name':'General Porpoise, 2101 7th Ave, Seattle, WA, 98121, USA','Type':'Snacks'}},{'geometry':{'x':-122.341109,'y':47.618590},'attributes':{'Name':'Denny Park, 800 Denny Way, Seattle, WA, 98109, USA','Type':'Park'}},{'geometry':{'x':-122.337480,'y':47.613740},'attributes':{'Name':'Westlake Square, Westlake Ave, Seattle, WA, 98101, USA','Type':'Park'}},{'geometry':{'x':-122.337530,'y':47.612810},'attributes':{'Name':'McGraw Square, 5th Ave, Seattle, WA, 98101, USA','Type':'Park'}}]}" \
-d "travel_mode={'attributeParameterValues':[{'attributeName':'Avoid Private Roads','parameterName':'Restriction Usage','value':'AVOID_MEDIUM'},{'attributeName':'Walking','parameterName':'Restriction Usage','value':'PROHIBITED'},{'attributeName':'Preferred for Pedestrians','parameterName':'Restriction Usage','value':'PREFER_LOW'},{'attributeName':'WalkTime','parameterName':'Walking Speed (km/h)','value':5},{'attributeName':'Avoid Roads Unsuitable for Pedestrians','parameterName':'Restriction Usage','value':'AVOID_HIGH'}],'description':'Follows paths and roads that allow pedestrian traffic and finds solutions that optimize travel distance.','distanceAttributeName':'Kilometers','id':'yFuMFwIYblqKEefX','impedanceAttributeName':'Kilometers','name':'Walking Distance','restrictionAttributeNames':['Avoid Private Roads','Avoid Roads Unsuitable for Pedestrians','Preferred for Pedestrians','Walking'],'simplificationTolerance':2,'simplificationToleranceUnits':'esriMeters','timeAttributeName':'WalkTime','type':'WALK','useHierarchy':false,'uturnAtJunctions':'esriNFSBAllowBacktrack'}"
Response (JSON)
    
{
  "jobId": "je24b0da397c34b56956fda7107094872",
  "jobStatus": "esriJobSubmitted"
}
Request
cURLHTTP
   
curl https://logistics.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/GPServer/GenerateOriginDestinationCostMatrix/jobs/je24b0da397c34b56956fda7107094872? \
-d "f=json" \
-d "token=YOUR-API-KEY"
Response (JSON)
                                    
{
  "jobId": "je24b0da397c34b56956fda7107094872",
  "jobStatus": "esriJobSucceeded",
  "results": {
    "Solve_Succeeded": {
      "paramUrl": "results/Solve_Succeeded"
    },
    "Output_Origin_Destination_Lines": {
      "paramUrl": "results/Output_Origin_Destination_Lines"
    },
    "Output_Origins": {
      "paramUrl": "results/Output_Origins"
    },
    "Output_Destinations": {
      "paramUrl": "results/Output_Destinations"
    },
    "Output_Network_Analysis_Layer": {
      "paramUrl": "results/Output_Network_Analysis_Layer"
    },
    "Output_Result_File": {
      "paramUrl": "results/Output_Result_File"
    }
  },
  "inputs": {
    "Origins": {
      "paramUrl": "inputs/Origins"
    },
    "Destinations": {
      "paramUrl": "inputs/Destinations"
    },
    "Travel_Mode": {
      "paramUrl": "inputs/Travel_Mode"
    }
  },
  "messages": []
}
Request
cURLHTTP
   
curl https://logistics.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/GPServer/GenerateOriginDestinationCostMatrix/jobs/je24b0da397c34b56956fda7107094872/results/Output_Origin_Destination_Lines? \
-d "f=json" \
-d "token=YOUR-API-KEY"
Response (JSON)
                                      
{
  "paramName": "Output_Origin_Destination_Lines",
  "dataType": "GPFeatureRecordSetLayer",
  "value": {
    "geometryType": "esriGeometryPolyline",
    "spatialReference": {
      "wkid": 4326,
      "latestWkid": 4326
    },
    "fields": [
      // one or more field definitions
    ],
    "features": [
      {
        "attributes": {
          "DestinationRank": 1,
          "Total_Time": 0.11971298133015928,
          "Total_Distance": 0.0099760817775132737,
          "OriginName": "2200 6th Ave, Seattle, WA, 98121, USA",
          "DestinationName": "Bank of America, 2200 6th Ave, Seattle, WA, 98121, USA"
          // more field values
        }
      },
      {
        "attributes": {
          "DestinationRank": 2,
          "Total_Time": 1.1702233937864959,
          "Total_Distance": 0.097518616148874637,
          "OriginName": "2200 6th Ave, Seattle, WA, 98121, USA",
          "DestinationName": "Elm Coffee Roasters Doppler, 2121 7th Ave, Seattle, WA, 98121, USA"
          // more field values
        }
      }
      // Additional origin-destination distances
    ],
    "exceededTransferLimit": false
  }
}

Tutorials

Services

Routing service

Get turn-by-turn directions and solve advanced routing problems.

API support

RoutingFleet routingClosest facility routingService areasLocation-allocationTravel cost matrix
ArcGIS JS APIFully supportedAccess with geoprocessing taskFully supportedFully supportedAccess with geoprocessing taskAccess with geoprocessing task
ArcGIS Android APIFully supportedAccess with geoprocessing taskFully supportedFully supportedAccess with geoprocessing taskAccess with geoprocessing task
ArcGIS iOS APIFully supportedAccess with geoprocessing taskFully supportedFully supportedAccess with geoprocessing taskAccess with geoprocessing task
ArcGIS .Net APIFully supportedAccess with geoprocessing taskFully supportedFully supportedAccess with geoprocessing taskAccess with geoprocessing task
ArcGIS Qt APIFully supportedAccess with geoprocessing taskFully supportedFully supportedAccess with geoprocessing taskAccess with geoprocessing task
ArcGIS Java APIFully supportedAccess with geoprocessing taskFully supportedFully supportedAccess with geoprocessing taskAccess with geoprocessing task
ArcGIS Python APIFully supportedFully supportedFully supportedFully supportedFully supportedFully supported
Esri LeafletAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JS
MapBox GL JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JS
OpenLayersAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JSAccess via ArcGIS REST JS
ArcGIS REST JSFully supportedFully supportedFully supportedFully supportedFully supportedFully supported
Full supportPartial support (see notes)Not supported

Tools