I'm trying to port over some desktop functionality of mapping road locations into a webmap using the JS API but it's creating some confusion for me. I have a route layer- but not in the traditional sense. I took a dataset of streets and then routed it (Linear Referencing Tools->Create Routes) in ArcToolbox based on a field containing the full name of the roads. In Arcmap, that's all you really need to solve for a route between point A & B using VBA & .NET using the RouteMeasureLocator object. In other words, you don't need a Network Analyst license, stops, restrictions, etc to just return a line between point A & B. That's basically what I want to replicate, but as a web service.
I took that routed layer and tried publishing this as a service to our AGS 10.4.x server. I clicked the Network Analysis checkbox under the Capabilities options while publishing and it craps out saying that the "...Data frame does not contain a required layer type for Network Analysis capability". When I turned on our Network Analyst extension, it doesn't seem to like my layer because all the options remain grayed out.
I guess there's more to it when providing a route service but I'm not sure what other prep I need to do to get it up & running. What more do I need to do?
(My route is set up this way because I'm trying to facilitate non-technical staff who need to map a road closure. Under desktop, they select the road name, click on the map for the starting/ending points, and the route function draws the line between the two dots. I routed based on full road names to ensure that the solved route doesn't jump over a block and travel on a different road.)
Network Analyst is meant to solve shortest paths (routes) based on a network dataset. The "routes" you are doing fall under the domain of linear referencing. The route, measure terminology from linear referencing does not mean the same as finding a shortest path route. So in case you do want to publish a network analyst routing service then you need to have a network dataset (that contains the topology and costs associated with each edge, with appropriate restrictions such as oneway, turns, etc), and then use the make route layer tools, etc.
If that is not your intent, then if you have a model that does exactly what you want (using linear referencing tools), you should be able to publish it without involving network analyst.
Thanks, Jay, I would agree with you that Network Analyst is overkill for what I have previously done but it appears that unless you purchase the Roads and Highways extension for ArcGIS Server- or develop a SOE for Server, linear referencing isn't supported via JS API. Guess I have to build and publish a Network Analysis Service. Way overkill for what I need but I don't think I have a choice.
So if you can find a route based on the measure value of your start and end points using one or more GP tools, you can then publish this GP workflow as a gp service and consume it from JS API.
Based on your workflow , Make Route Event Layer GP tool seems like a good fit. You can use this tool in ArcMap and see if it works for you. If it does work, create a script tool in Python or even a GP model that performs this workflow and then share it as a GP service.
Hope this helps