Directions dijit and ArcServer 10.7

409
1
06-10-2019 12:24 PM
EricO_Neal1
New Contributor III

I'm using JS 3.28 and the Directions dijit and a custom route service.  All is well with 10.6.1 (and earlier!), but the same service fails when published to 10.7.  

It is failing in Directions.js at _getCostAttribute()

_getCostAttribute: function(a) {
for (var b = this.serviceDescription && this.serviceDescription.networkDataset.networkAttributes || [], c, d = 0; d < b.length; d++)
if (b.name === a && "esriNAUTCost" === b.usageType) {
c = b;
break
}
return c
},

b is a collection of networkattributes ('OneWay, Length, Time') and 'a' is the impedanceAttributeName.  The impedance on the published service is "Time", but in the code 'a' is always "TravelTime", so in the loop above 'c=b' is never hit and this function always returns null.

This are also other places in Directions.js with lines like, which seems odd:

|| this.serviceDescription && 10.6 <= this.serviceDescription.currentVersion;

Anyway, the route stops are plotted, but the route is never returned because it always fails with the error:

TypeError: Cannot read property 'units' of undefined

Is this broken for 10.7? or do I need to do something different?

Thanks

0 Kudos
1 Reply
MortenHjelmsmark1
New Contributor II

Did you find a work around? I have exact same issue now.

I did find a solution.

By default the create Network Dataset widget in ArcMAP suggests that the traveltime parameter is called Minutes. This works in the directions widget using our route service shared on our old 10.4.0 portal but not with the same route service shared on our new 10.7.1 portal. The traveltime parameter must be renamed from Minutes to TravelTime, then it works.

0 Kudos