Hello all,
I'd like to display a specific part of a routing result in a different color than the others. I thought this would be easy, but it seems that it's not.
I'm using the Directions Widget of the JS API, and the standard config allows me to define a symbol for the whole route or for the selected segment (which is a direction segment, not the whole part from one stop to the next). So I could look for the "esriDMTDepart" direction where my part starts, decode all the compressedGeometries until the next "esriDMTStop" and draw them manually on the map over the route that is being drawn anyway. This is a bit ugly, so I'm going one level deeper to the NAServer REST API.
The routing service is able to give back a Polyline route geometry (return routes = true), but as far as I can see, it is always one line for the whole route. It won't mark where the stops are or separate the route geometry into parts between the stops. Scott Sandusky, Matt Crowder: To my opinion, this is a missed chance, because the Polyline JSON object is an array of several line objects.
There is no way to quickly tell where the stops are located on the line that comes back, because the coordinates of polyline points and stop point don't match exactly. Manual search shows that they may match up to the 5th decimal digit or so, but not to the end.
I could try to develop an approximation method to determine where the stops are located on the route line, but I'm not sure if this would produce reliable results.. or send an extra HTTP call for the part of the route that I want to draw differently, but that's of course costly and redundant.
Am I missing something? Does anyone have a good idea what to do?
Thanks
Nik