Hi , We have network dataset that will route the over size vehicle with the list of restriction.If for the given Vehicle dimension if there is failure at some point becuase of restriction then what will be the best way to get the route failure details . I know one option is the INetworkQuery to query the source feature using the EID(Edige Id) but don't know how get the list of the Edge Id of the route that we can get without restriction
May I ask why you ultimately need this information? Perhaps there is a better way to achieve your goals.
The reason I ask this is because, unfortunately, the Route solver does not have such information directly available to it to report to the end user, in the event that a valid route cannot be found.
During the search for a path, the solver queries the network dataset to see which edges from a given junction can be accessed. This query will only return valid edges, based on the restrictions being applied. Therefore, the solver has no knowledge of any invalid edges which were filtered by the network dataset, since they were never returned to the solver.
If absolutely necessary, there are several ways you can try and get the information you are needing, each with different tradeoffs:
Enumerate all edges from the network dataset and, based on the current analysis restrictions, maintain a list of which edges are restricted (i.e., which edges return "true" for one or more of your applied restriction attributes). Depending on your network size, however, this may not really be a scalable solution.
Create a restriction attribute with a custom evaluator (based on custom programming logic) to act as a proxy for all of your other restriction attributes. Essentially, this would just be a single evaluator which could "forward" any restriction attribute queries on to the other restriction attributes for a given edge. If any of these forwarded calls return "true" (i.e., to indicate a restricted edge), then the proxy evaluator can simply log this edge's EID information internally. This approach is more complex than the prior approach, but it will result in only those subsets of restricted edges which actually prevented a route from being found.
One other possibility would be to simply turn off your restriction attributes in your analysis layer, and then solve to find a path (which you should be able to, assuming your network is connected). Then, simply iterate over those edges along that path to see which ones are restricted for your intended restriction attributes. I don't know if this is exactly what you are looking for, though.
Hello Michael, Thanks for the reply. There is a requrement in the automated permitting system that when there is no route found for the give vehicle dimension may be the weight is two high for some of the bridges then we need to provide those bridge information that this bridge is not satisfying the vehicle weight or the Height is too high for the underpass clearance.
We can do your suggested approach but if you can suggest in this direction then it will be good: If i solve the routing by turning off the restriction then it will return the route and direction but i don't know how to interate through each and every edge that participate in the result route.
You must solve the route and then access the "traversal result" of the route programmatically. The traversal result is really just a collection of three feature classes: Edges, Junctions, and Turns. These three classes represent the individual edges, junctions, and turns, respectively, that were traversed to produce your current route solution.
Here is a link which provides some of the relevant interfaces for programmatically accessing this information, including some sample code for retrieving and adding the traversal result feature classes as layers in your map:
If you only have (or are only concerned about) restrictions on the edges of your network, then you can simply get the Edges feature class from the traversal result and iterate through this list of edges. To do this, you would need to get a feature cursor from this Edges feature class and iterate through the cursor. Each feature should have the appropriate field values (e.g., EID, FromPosition, and ToPosition) with which you can query the appropriate edge element from INetworkQuery, so that you can test each edge for restrictions as necessary.
Note that the "position" field values, FromPosition and ToPosition, are assigned with respect to the digitized direction of the edge's source feature. You can use this information to infer the direction of the edge. Specifically, if FromPosition < ToPosition, then the edge is traversed in the "Along-Digitized" direction. If FromPosition > ToPosition, then the edge is traversed in the "Against-Digitized" direction.
Instructions for installing and running the Add-in are at the link. Basically, after your route has successfully solved, you click the button for the Add-in and the three in-memory traversal result feature classes (Edges, Junctions, and Turns) are generated and added to the table of contents.