Find QueryResult at a specified angle

Is it possible to find a closest QueryResult at a specified angle from the given lat, lon pair? Any ideas on where I should look?

You should be able to implement this with a custom EdgeFilter and return true only if in a specific angle. Did you already had a look into the heading parameter?

Do you mean the favoured heading parameter in the GHRequest?
Tried it, but no luck. I have a lat lon for which I need to find the closest ghpoint which is at a specified angle.

I really am confused as to when does the edgefilter actually gets called. The edge filter seems to get called while generating the path and also while calculating the closest points. Am I correct?

Do you have a GraphHopper Maps example?

the edge filter seems to get called while generating the path

The EdgeFilter for the closest point is the one you need to customize. I.e. the third parameter in the QueryGraph.lookup method

I was trying to debug to see how many times does the edge filter gets called if I had a single waypoint apart from start and end. It gets called many times, not understanding what exactly is happening here :frowning:

Can you please give a brief overview on the difference between queryGraph.lookup and routingTemplate.lookup?

I did not get which class you are talking about?

Yes, this is how the EdgeFilter works. Have a look at it’s documentation.

You check the angle (or any other property) for every edge. Return true if you would want to match it. This requires you to implement your own EdgeFilter.


I figured it out, how would I apply this edge filter to not just the waypoint finding time, but also while calculating the route?

Route calculation doesn’t work that way, have a look at the Weighting.

BTW: both steps will be unified later. I.e. the QueryGraph filter will get a Weighting too. See this issue: