You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
If only edge based CH is prepared no error should be thrown #1637
When a route is done the 'edge_based' url parameter should not be required. Currently you get:
Caused by: java.lang.IllegalArgumentException: Cannot find CH RoutingAlgorithmFactory for weighting map {weighting=fastest, vehicle=car} in entries: [fastest|car|edge, faste .... The 'edge_based' url parameter is missing or does not fit the weightings. Its value was: 'false'
at com.graphhopper.routing.ch.CHAlgoFactoryDecorator.getPreparation(CHAlgoFactoryDecorator.java:266)
at com.graphhopper.routing.ch.CHAlgoFactoryDecorator.getDecoratedAlgorithmFactory(CHAlgoFactoryDecorator.java:246)
at com.graphhopper.GraphHopper.getAlgorithmFactory(GraphHopper.java:760)
GraphHopper already has a traversalMode field that is used as default for routing requests. I think this is also what it should be called: defaultTraversalMode, so this is what I will call it here. It can be set via setTraversalMode() and is automatically set by setEncodingManager() if the EncodingManager needs turn cost support.
The default can be overwritten on a per-request basis by the edge_based parameter, but also by the traversal_mode parameter (traversal_mode is overwritten by edge_based):
The traversal_mode parameter definitely seems redundant (at least after #1640). Can we remove it ? I did not find documentation for it either.
To me it also seems a bit strange that the default traversalMode is edge-based as soon as encodingManager.needsTurnCostSupport() == true (so as soon as one encoder needs turn cost support).
Would it not be much more obvious to check if the encoder that is selected by the vehicle parameter supports turn costs and if yes use edge-based routing (unless edge_based is given explicitly with the request) ? I mean here:
Instead, at the moment the traversal mode for CH is solely chosen based on the edge_based request parameter (hence the error this issue was opened for). I think this is partly because if we want edge-based and node-based routing we cannot specify graph.flag_encoders=car,car|turn_costs=true, but instead we have to specify graph.flag_encoders=car|turn_costs=true and prepare.ch.edge_based: edge_and_node (because there can not be two flag encoders for car). So determining the traversal mode by FlagEncoder.supports(TurnWeighting.class) as we do for non-CH is not possible in this case.
So regarding the previous suggestions:
always fall back to edge based if there really is only one edge-based CH and no node based CH (for any weighting)
this should work
add a config value that changes the default value of edge_based
considering the complexity that is already there (for such a 'simple' thing as choosing one of two traversal modes) I am a bit hesitant to add another way to do this. Or maybe we use this config value only for CH (routing.ch.edge_based_by_default=false) ?
Activity
easbar commentedon Jun 27, 2019
GraphHopperalready has atraversalModefield that is used as default for routing requests. I think this is also what it should be called:defaultTraversalMode, so this is what I will call it here. It can be set viasetTraversalMode()and is automatically set bysetEncodingManager()if theEncodingManagerneeds turn cost support.The default can be overwritten on a per-request basis by the
edge_basedparameter, but also by thetraversal_modeparameter (traversal_modeis overwritten byedge_based):graphhopper/core/src/main/java/com/graphhopper/GraphHopper.java
Lines 977 to 980 in bf0c7b4
The
traversal_modeparameter definitely seems redundant (at least after #1640). Can we remove it ? I did not find documentation for it either.To me it also seems a bit strange that the default
traversalModeisedge-basedas soon asencodingManager.needsTurnCostSupport() == true(so as soon as one encoder needs turn cost support).Would it not be much more obvious to check if the encoder that is selected by the
vehicleparameter supports turn costs and if yes use edge-based routing (unlessedge_basedis given explicitly with the request) ? I mean here:graphhopper/core/src/main/java/com/graphhopper/GraphHopper.java
Line 982 in bf0c7b4
For CH it is again different because the
tModevariable in the first snippet above is ignored (it is not passed to the hints map here):graphhopper/core/src/main/java/com/graphhopper/GraphHopper.java
Line 1020 in bf0c7b4
Instead, at the moment the traversal mode for CH is solely chosen based on the
edge_basedrequest parameter (hence the error this issue was opened for). I think this is partly because if we want edge-based and node-based routing we cannot specifygraph.flag_encoders=car,car|turn_costs=true, but instead we have to specifygraph.flag_encoders=car|turn_costs=trueandprepare.ch.edge_based: edge_and_node(because there can not be two flag encoders forcar). So determining the traversal mode byFlagEncoder.supports(TurnWeighting.class)as we do for non-CH is not possible in this case.So regarding the previous suggestions:
this should work
considering the complexity that is already there (for such a 'simple' thing as choosing one of two traversal modes) I am a bit hesitant to add another way to do this. Or maybe we use this config value only for CH (
routing.ch.edge_based_by_default=false) ?easbar commentedon Jun 27, 2019
Maybe the situation would be improved with #1023, #493