originDestinationMatrix

originDestinationMatrix

Function
originDestinationMatrix(requestOptionsIOriginDestinationMatrixOptions): Promise<IOriginDestinationMatrixResponse>

Used to create an origin-destination (OD) cost matrix from multiple origins to multiple destinations. See the REST Documentation for more information.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { originDestinationMatrix } from '@esri/arcgis-rest-routing';

originDestinationMatrix({
  origins: [
    [-90.404302, 38.600621],
    [-90.364293, 38.620427],
  ],
  destinations: [
    [-90.444716, 38.635501],
    [-90.311919, 38.633523],
    [-90.451147, 38.581107]
  ],
  authentication
})
  .then(response) // => { ... }
Parameters
ParameterTypeNotes
requestOptions
IOriginDestinationMatrixOptions

Options to pass through to the routing service.

Returns 
Promise<IOriginDestinationMatrixResponse>

A Promise that will resolve with travel time and/or distance for each origin-destination pair. It returns either odLines or odCostMatrix for this information depending on the outputType you specify.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close