GraphHopper.com | Forum | GitHub | Maps | Blog

Find QueryResult at a specified angle


#1

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?


#2

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?


#3

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.


#4

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?


#5

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


#6

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:


#7

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?


#8

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.

Cheers,
Robin


#9

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


#10

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


#11

BTW: both steps will be unified later. I.e. the QueryGraph filter will get a Weighting too. See this issue: https://github.com/graphhopper/graphhopper/issues/729