How to create AGSJob and use it

351
1
12-12-2019 02:51 AM
RAMESHBACHIRAJU
New Contributor II

We are trying to fetch origin cost matrix using this API

  Origin Destination Cost Matrix service—ArcGIS REST API: Directions and Routing Services | ArcGIS for... 

However as this is not there in the SDK we are calling rest api to fetch the data. This API results in a Job and we have to poll for the job status. Instead of writing our own code for it, we would like to create AGSJob and use the default functionality, however we do not see any mechanism to create AGSJob from an URL.

Is there a way to solve this?

0 Kudos
1 Reply
Nicholas-Furness
Esri Regular Contributor

Although we don't have an OD Cost Matrix specific API, the OD Cost Matrix service looks like a regular GP Service. You should be able to use the AGSGeoprocessingTask and create a AGSGeoprocessingJob. Here's an example: Viewshed (Geoprocessing) | ArcGIS for Developers 

Runtime will just make use of the cached credentials to run the GP job.

Also, a quick plug for the Job Manager toolkit component, in case you weren't familiar with it.

Let me know if that helps.

0 Kudos