Getting sequence of original network line features in route analysis & accumulating non-impedance attribute value for each resulting path vertex

827
5
05-04-2021 09:50 AM
GISTaldor
New Contributor II

I'm using ArcGIS Network Analyst's (Enterprise server, not AGOL) Routing service:

https://developers.arcgis.com/rest/services-reference/route-sync-services.htm

I have 2 issues I'm missing:

1. I need to be able to accumulate some non-impedance attribute value per each vertex of the resulting calculated route and not only for each input/output stop. 

For instance, I'm using a "cost_length" attribute for the impedanceAttributeName parameter, but want to get an accumulated value of a "cost_seconds" attribute (which is another cost attribute defined in the network). If I specify outputlines=esriNAOutputLineTrueShapeWithMeasure, I do get a third value for each vertex in the resulting route, but that value represents an accumulated value of the "cost_length" attribute (which is the requested impedanceAttributeName ). Is there any way to get an accumulated value of any other attribute, which is not the impedance attribute?

2. The resulting route is given as a line geometry (list of vertices). 

  This is not enough for me. I need to know the actual sequence of the network's underlying line features,         which have been traversed to create the calculated route - i.e. feature class + ObjectIDs.

  I know that the behind-the-scenes algorithm traverses the line features, so is there any way to receive that sequence as a part of the routing service response?

 

If the above is not available - any suggestions how those can be implemented?

 

 

0 Kudos
5 Replies
MaxZeng
Esri Contributor

For issue 2, you could use async GP Service published on your enterprise if you use publish routing services utility to publish.  Async gp service supports populate_route_edges  parameter which would give you back the traversed edges. By default, publish routing services publish the geoprocessing service as async service, but you could also go to server manager to change it to sync geoprocessing service, so you get better performance. The sync service (NAServer service) as you pointed out doesn't support returning traversal result.

For issue 1, there are ways to do it. If this is something you do on the client side, then you could use Feature Vertices To Points tool to get the from vertex and to vertex of each route. Then you need to set the from vertex (the first vertex) 's Total_cost_seconds to 0. Then you could run Calibrate Routes to recalculate the M value to come from Total_cost_seconds field. The in_route_features would be your route, the in_point_features would be the vertices point, and measure_field would be Total_cost_seconds. Also make sure the point_id_field matches the route_id_field.

If this is something you want to do on the server side, then you will publish your own geoprocessing service that does routing, and then call those arcpy tools and write the routes with altered M value. Here is a doc that gives an example of writing a script tool and publish as geoprocessing service.

Hope this helps.

 

0 Kudos
GISTaldor
New Contributor II

Hi,  Max. 

 

Thanks for the suggestion. It looks very promising. 

I cannot find the option to publish the routing service as asynchronous. 

We have version 10.7.1 of ArcGIS Server, no option to upgrade right now (it's in production). 

 

Any ideas? 

0 Kudos
MaxZeng
Esri Contributor

Here is the doc for using publish routing services utility in Enterprise 10.7. Once you run the publish routing services utility, you will have a folder with these four services.

Routing Services.jpg

 

The NetworkAnalysis map service (second service in the screenshot) has network analysis capabilities turned on. And it corresponds to the NAServer synchronous service. The NetworkAnalysis geoprocessing service (the first service in the screensho), is published as asynchronous geoprocessing service by publish routing services utility. And it corresponds to GPServer asynchronous service. You could potentially go into the service parameters (by clicking the pencil next to the service) and change it to synchronous geoprocessing service. By doing this, instead of using submitJob on the geoprocessing service and query the job id for the job status, you will use execute on the geoprocessing service and wait for the job to finish. Here are some more information about executing sync geoprocessing service

MaxZeng_0-1622657907481.png

 

Does this answer your question?

 

0 Kudos
GISTaldor
New Contributor II

Thank you.

Another question though.

The documentation states that one of the conditions is that my network dataset is "stored in a file geodatabase". But in my case it is stored in an enterprise geodatabase (SDE for SQL Server).

Is there any chance of publishing this kind of service vs a network dataset inside an enterprise geodatabase?

It seems like later versions (10.8 & later) have removed this condition..

But my client is using 10.7.1 and cannot perform an upgrade for some internal reason.

0 Kudos
MaxZeng
Esri Contributor

I am so sorry that I missed your message somehow. Unfortunately publish routing services in 10.7.1 doesn't support network dataset in enterprise geodatabase. It is supported in 10.8 and later. We also have a major performance improvement to routing services published using publish routing services in 10.8 and later.

Is it still the case that the client cannot move to 10.8 and later? If that's the case, there are other ways you could potentially publish a geoprocessing service in 10.7.1 with network dataset in enterprise geodatabase.

0 Kudos