I am currently using GraphHopper within an application that detects whether a customer's route goes past a specific point of interest (PoI). One PoI has one or more roads through which a customer can pass it (predefined for each PoI).
The fastest way to do this, I think, is to find each customer route, and see whether the edges within a route include any edges that pass a PoI. The following code finds all of the edges closest to the points stored within a GHResponse object (called 'route' in the code below).
QueryResult qr;
HashMap<String, EdgeIteratorState> routeEdges= new HashMap<String, EdgeIteratorState>();
for(GHPoint p:route.getPoints()){
qr = index.findClosest(p.getLat(), p.getLon(), EdgeFilter.ALL_EDGES );
routeEdges.put(qr.getClosestEdge().toString(), qr.getClosestEdge());
}
This uses end-points of each road and searches for the closest edge, which I might return any of the edges at that node. I'd much prefer a list of edgeID's within the route, so I could compare them to the edges for each PoI instead.
Any advice would be much appreciated. Cheers!