Directions Widget with routeServiceUrl - JSAPI 4.7

4853
8
Jump to solution
04-19-2018 11:34 AM
TomSellsted
MVP Regular Contributor

Greetings,

I am trying to use the directions widget in JSAPI 4.7 with our own route service, but when doing this the widget won't load.  I realize that this widget is still in beta, but I am wondering if I am missing something in the configuration setup or maybe my ArcGIS Server, needs to be a certain version for this to work.  Here is the simple code I am using:

var dirWidget = new Directions({
    view: view,
    routeServiceUrl: "https://<<link to working route service>>",
    container: "directionsDiv"
 }); ‍‍‍‍‍

The result is:

Thanks very much for any feedback!

Regard,

Tom

0 Kudos
1 Solution

Accepted Solutions
BjornSvensson
Esri Regular Contributor

Tom Sellsted , testing your route service in the basic API sample, the console error message is

Directions.js:10 Uncaught TypeError: Cannot read property 'name' of null
at Object.b._renderTravelModeOptions (VM223 Directions.js:10)
at Object.b._renderReadyContent (VM223 Directions.js:9)
at Object.b._renderPanelContent (VM223 Directions.js:9)
at Object.b.render (VM223 Directions.js:8)
at q (dojo.js:2073)

If you look at the network traffic, you'll see there's a request for TravelModes that doesn't return any Travel Modes:
https://gis.yakimawa.gov/arcgis101/rest/services/Streets/StreetsNetwork/NAServer/Route/retrieveTrave... 

The widget should (a) handle this better, but (b) in the meantime you might look to something like http://desktop.arcgis.com/en/arcmap/10.5/extensions/network-analyst/travel-modes-steps.htm 

View solution in original post

8 Replies
BjornSvensson
Esri Regular Contributor

It should just work.  Does it work with other versions?

tsellste If you don't want to share your routeserver URL here, you might want to contact Esri Support for specific help.

0 Kudos
TomSellsted
MVP Regular Contributor

Bjorn,

It definitely works on 3.X versions.  I am trying to port a public safety app that uses the directions dijit into 4.x and this is as far as I have gotten.  The service URL is: Route (NAServer) 

Thanks very much!

Regards,

Tom

0 Kudos
TomSellsted
MVP Regular Contributor

Bjorn Svensson

Did you find anything out about this problem?  I had provided my REST service.  Thanks for any information you can offer!

Regards,

Tom

0 Kudos
BjornSvensson
Esri Regular Contributor

Tom Sellsted , testing your route service in the basic API sample, the console error message is

Directions.js:10 Uncaught TypeError: Cannot read property 'name' of null
at Object.b._renderTravelModeOptions (VM223 Directions.js:10)
at Object.b._renderReadyContent (VM223 Directions.js:9)
at Object.b._renderPanelContent (VM223 Directions.js:9)
at Object.b.render (VM223 Directions.js:8)
at q (dojo.js:2073)

If you look at the network traffic, you'll see there's a request for TravelModes that doesn't return any Travel Modes:
https://gis.yakimawa.gov/arcgis101/rest/services/Streets/StreetsNetwork/NAServer/Route/retrieveTrave... 

The widget should (a) handle this better, but (b) in the meantime you might look to something like http://desktop.arcgis.com/en/arcmap/10.5/extensions/network-analyst/travel-modes-steps.htm 

TomSellsted
MVP Regular Contributor

Bjorn,

Thanks very much!  I will look into adding a travel mode to my network. 

Regards,

Tom

0 Kudos
TomSellsted
MVP Regular Contributor

Bjorn,

I did add a travel mode and the widget is function properly now.  Thanks very much!

Regards,

Tom

0 Kudos
HeatherGonzago
Esri Contributor

This issue has been addressed and should no longer be an issue in our next 4.8 release.

Thanks for letting us know.

TomSellsted
MVP Regular Contributor

Thank you Heather!

0 Kudos