OD Cost Matrix service - connect layer by common ID

305
0
07-08-2020 02:14 AM
FilipeTeixeira1
New Contributor

In ArcGIS online it's quite easy to create an OD matrix based on matching ID points. If I have a layer with origins and a layer with destinations, I can easily create a matrix based on a common field. Lets say that origin layer A has a column airport, and destination layer B has the same column, I can generate all routes based on that matching column.

However, using the REST API, I can't find any documentation showing how to do that.

I'm having problems as well using an url to create the OD cost matrix.

When I use an feature service url:

origins =

{"url":"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/1?query?where=Name=%27Indian%20Consulate,%20San%20Francisco%27&outFields=Name,RouteName&f=json"}

destinations = {"url":"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/MapServer/1?query?where=Name=%27Ghirardelli%20Square%27&outFields=Name,RouteName&f=json"}

I always get this error

{
"type": "esriJobMessageTypeInformative",
"description": "Submitted."
},
{
"type": "esriJobMessageTypeInformative",
"description": "Executing..."
},
{
"type": "esriJobMessageTypeError",
"description": "Invalid value for parameter Origins - Details : invalid URL json "
},
{
"type": "esriJobMessageTypeError",
"description": "Failed."
}
]
}

0 Kudos
0 Replies