Repository navigation
location lookup based on Weighting additionally to access - #1838
Conversation
| // TODO NOW for CH it will be overwritten by chProfile.getWeighting but now we need it for locationIndex -> #729 | ||
| Weighting weighting = createWeighting(hints, encoder); | ||
|
|
There was a problem hiding this comment.
I think its fine to create the Weighting early here, but should we not better take it from the CHProfile, something like
- request comes in
- if LM/CH: select preparation using request parameters and take Weighting from the preparation/profile
- else: create Weighting from request parameters
instead of
- request comes in
- create Weighting from request parameters (hopefully we managed to re-create the same Weighting that was used for the preparation)
- later: use request parameters to select CHProfile to select CHGraph etc. and overwrite Weighting (?)
Two questions here:
-
Should we support using another CH/LM Weighting for the request than it was used for the preparation ? Normally this is an error, but their might be some (rather special) use-cases for this (@michaz ?). Otherwise I think the first method is better because it automatically uses the right Weighting (or at least the one that is kept by the preparation).
-
How are we supposed to select the CHProfile/Weighting given the request ? I think as soon as we want to use 'real' configurable weightings for CH we need to select the profiles by name (Select CH profiles by name ? #1708) and if we do we need to first select the CHProfile by name and then take the weighting from the profile (first method). Otherwise we would have to send the whole configuration with every request (makes sense for non-speedup algos, because thats the whole point of configurable weightings, but not so much for LM/CH where the idea is rather to create a (custom/configurable) preparation once and then use it for many or at least multiple requests.
There was a problem hiding this comment.
Yes, thanks! Can you have a look into the new commit if this is what you meant?
Should we support using another CH/LM Weighting for the request than it was used for the preparation ?
For LM this works under special conditions (that increase the edge weight). For CH this won't work at the moment but it could be required for "Core CH"?
I think as soon as we want to use 'real' configurable weightings for CH we need to select the profiles by name (#1708)
I think this should be part of a different issue #1776 and the configuration (with which the CH preparation is done) could be picked up via the vehicle and/or weighting parameters (?)
There was a problem hiding this comment.
Yes, thanks! Can you have a look into the new commit if this is what you meant?
Yes this is perfect!
For LM this works under special conditions (that increase the edge weight). For CH this won't work at the moment but it could be required for "Core CH"?
Yes but do we have to support this via the GraphHopper/high-level API here ? Do you (still) need this for the block-core thing @michaz ? Or maybe we can keep going here and add this functionality later (so far this is not really supported either) ?
I think this should be part of a different issue #1776
Do you mean it should be part of #1776 or it should not ? Sure, it should not be part of this (#1838) issue.
and the configuration (with which the CH preparation is done) could be picked up via the vehicle and/or weighting parameters (?)
This is a good/tough question, I'll move this question to #1708.
There was a problem hiding this comment.
Should we support using another CH/LM Weighting for the request than it was used for the preparation
Only perhaps in a very weak sense of 'support':
I need to be able to write code where I pick the Graph I want to use and the Weighting I want to use by myself. Without fighting against anything. So there shouldn't be machinery which actively prevents me from doing so. For example, nothing should try to information-hide a CH-Graph away from me until I can show it the proper Weighting instance, or something like that.
But I don't need to have this as, for example, a config file option. Nor do I ask for special accomodations for such a (very experimental) thing (not even sure if it'll make it in the final TARDUR project branch). Just don't prevent this more than seems natural.
There was a problem hiding this comment.
Ok I'll try to keep in mind that it should be easy enough to use another weighting together with a partially contracted graph.
|
Looks good to me, except the remaining todo:
Currently |
This is a good idea. Especially since this is already wanted from @boldtrn (see TODO comment before checkIfPointsAreInBounds call). Should we do this in another issue (for 1.0) and merge here for now? |
|
Ok. The only problem is that if we specify some query points within the block area the virtual edges will not be blocked ? But is this even such a big deal ? In most cases they won't be reachable anyway, because all the edges leading to the point lying in the blocked area will be blocked as well (?) |
Yes, but with a validation that ensures that query points cannot be inside the blocked areas this won't happen IMO. Which also makes sense as you cannot calculate a route where you block one of the waypoints. Or ... if you mean this shouldn't go into a separate issue, I'll include the check here (introduce your proposed new method). |
Ok, there are cases where waypoints are outside of the block area but some involved virtual edges can still be inside. But when I went through the possibilities I did not find a case where the involved and blocked tower node did not manage the blocking. Ie. an edge Okay there are cases where the virtual edge is inside the blocked area but not A and also not x like |
|
Ah I meant its not a big problem and we can merge and do the validation later. Yes once we do the validation the problem I mentioned does not occur anymore. Ok, like you said the query point might be outside of the blocked area and the validation would not throw an error. But is this really a problem ? It just means the edge won't be blocked, but who wants to block edges that are leading / coming from the query points (the places you want to go / start from) anyway ? |
|
So I think we can:
|
|
Ah I did not think of the case where a single point is blocked (how does that work ?). So far I was thinking of blocked areas. |
The use case could be to block only parts of the road and still make the rest of the road accessible and force a u-turn in those cases. But those issues should be probably fixed within #1324 as currently it does not work anyway. BTW: See this discussion.
It is a LocationIndex lookup, i.e. not really a singular point: https://github.com/graphhopper/graphhopper/blob/master/core/src/main/java/com/graphhopper/storage/GraphEdgeIdFinder.java#L61 |
|
JTS doesn't really support circle as a geometry AFAIK. So we would have to remove this type of blocking functionality or use a polygon as an approximation: |
|
This looks good! And even better now that block area is no longer in |
fixes #729 before #1835
TODOs: