Prevent snapping to disconnected edges when we use custom models with /route
This issue addresses a similar problem as #2273, but here we need to prevent connection not found errors when we specify the custom model per request. In this case the subnetwork removal we run during the import obviously does not solve the problem. To prevent snapping to disconnected edges when we change the custom model for a single request we need to run a dynamic connection check. A possible solution could be this:
- find all edges around the query point using
locationIndex.query(bbox, visitor). these will be our snapping candidates - for every snapping candidate determine the number of reachable nodes for the given custom weighting, but stop as soon as a configurable maximum number of nodes has been found
- exclude all candidates for which the number of reachable nodes is below some threshold
- snap to the closest remaining candidate. if no candidate is left there will still be a connection not found error, but maybe we need to handle the special case where the target node was already found during the candidate search (both query points are within the same 'island').
Another solution could be to use the current solution of the LocationIndex but pre-explore the returned node and not enough nodes are reached and distance to snapped location is still "not too far away" then mark these nodes as unreachable and do another call to LocationIndex with an adapted EdgeFilter. Similar to our current retry mechanism in case of snap_preventions.