RoutingTask Error 9004$LAYER_NOT_EXIST

3001
3
10-30-2015 09:29 AM
wcESRI
by
New Contributor

 

Hello,

 

I am attempting to solve a route.  My code is below.

 

To create my service, I added the following URL to my ArcGIS Online content.

 

I then made it accessible to everyone and used the REST URL in my code.

 

 

 

//prepare parameters
 var myRouteParams = new RouteParameters();
 myRouteParams.stops = new FeatureSet();
 myRouteParams.stops.features.push(myStartingGraphic);
 myRouteParams.stops.features.push(myEndingGraphic);
 myRouteParams.returnRoutes = true;
 myRouteParams.returnDirections = true;
 myRouteParams.outSpatialReference = new SpatialReference({ wkid:4326 });
      
 //perform route between addresses  
 var myRouteTask = new RouteTask("url_goes_here");       
 myRouteTask.solve(myRouteParams); 

 

 

However, I get the following error in the debugger.

 

dojo.io.script error Error: 9004$LAYER_NOT_EXIST

"dojo.io.script error"

[object Error]{code: 500, description: "", details: Array[0], httpCode: 500, log: undefined, message: "9004$LAYER_...", name: "Error", number: 0}

 

What is causing this error?  Do I need something else in my routing parameters?

0 Kudos
3 Replies
RickeyFight
MVP Regular Contributor

Christopher,

When you try to browse to the layer you linked I get

0 Kudos
wcESRI
by
New Contributor

I noticed that.  However, is something supposed to be listed?

I am also not sure what URL to use.

0 Kudos
RickeyFight
MVP Regular Contributor

Christopher,

You are right.

This example works with the same route layer you provided above.

Find a route | ArcGIS API for JavaScript

0 Kudos