[GraphHopper] Bounding box not working as expected
mythex3cutioner .
mizantropy at gmail.com
Sun Jan 12 12:43:13 UTC 2014
I've managed to create a bbox but there's one big problem that I just don't
get.
Screenshot1: https://www.dropbox.com/s/7f7mb88rl5qdlqa/Screenshot1.png
Screenshot2: https://www.dropbox.com/s/kherjlhbyg3chgt/Screenshot2.png
Screenshot3: https://www.dropbox.com/s/bqrwimadgyq8w5w/Screenshot3.png
Screenshot4: https://www.dropbox.com/s/poeq7uixw1m956l/Screenshot4.png
Screenshot1:
Red flags on intersections represent points that I've used for my BBox.
Green flag is point from and another red flag is point to (marked).
I'm running Dijkstra. In Screenshot1 you can see that it finds the shortest
path. (as you would expect since it's in a bbox)
Though in second screenshot you can see that it doesn't though it should
still fit inside the bbox if I understand correctly..
So, sometimes it finds it, sometimes it doesn't.
It gets even weirder when you zoom in. I've zoomed on approximate "to"
illustrated in Screenshot2.
As you can see, Screenshot3 - path founded. Go few meters other direction -
no path (Screenshot4)
My bbox implementation as it is:
EdgeFilter edgFilt = new EdgeFilter()
{
@Override
public boolean accept( EdgeIteratorState edgeIterState )
{
baseLat =
graph.getLatitude(fromRes.getClosestNode()); //point "from"
baseLon =
graph.getLongitude(fromRes.getClosestNode());
adjLat = graph.getLatitude(toRes.getClosestNode());
//point "to"
adjLon =
graph.getLongitude(toRes.getClosestNode());
BBox bbox = new BBox(25.176716, 25.270786,
54.688702, 54.747895); //Screenshot1 - BBox top & BBox bottom
return bbox.contains(baseLat, baseLon) ||
bbox.contains(adjLat, adjLon);
}
};
Dijkstra dijkstra = null;
AlgorithmPreparation prepd = prepareGraph(graph, encoder, weighting);
//graph encoder, weighting - everything as in Graphhopper.java
dijkstra = (Dijkstra) prepd.createAlgo();
dijkstra.setEdgeFilter(edgFilt);
Any help would be really appreciated.
Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20140112/e7722893/attachment.html>
More information about the GraphHopper
mailing list