13.07.2015, 08:55
(This post was last modified: 13.07.2015, 08:56 by routeconverter.)
(12.07.2015, 20:11)hvdwolf Wrote: Can I perhaps help improving this? As the current algorithm or setup or whatever it is, is totally inacurrate.
The problem is that GraphHopper doesn't support a tile download like BRouter, i.e. it wants to have the routing data map for a region and then work with it.
Currently, I've solved this by determining the bounding box of the route and then finding the smallest routing data map that covers the bounding box of the route.
Code:
public DownloadFuture downloadRoutingDataFor(List<LongitudeAndLatitude> longitudeAndLatitudes) {
BoundingBox routeBoundingBox = createBoundingBox(longitudeAndLatitudes);
Downloadable downloadableForSmallestBoundingBox = null;
BoundingBox smallestBoundingBox = null;
for (File file : dataSource.getFiles()) {
BoundingBox fileBoundingBox = file.getBoundingBox();
if (fileBoundingBox != null && fileBoundingBox.contains(routeBoundingBox)) {
if (smallestBoundingBox == null || smallestBoundingBox.contains(fileBoundingBox)) {
downloadableForSmallestBoundingBox = file;
smallestBoundingBox = fileBoundingBox;
}
}
}
[..]The resulting downloadableForSmallestBoundingBox is then used to route the complete route. The only improvement I could imagine is to determine the downloadableForSmallestBoundingBox for each pair of coordinates
--
Christian
Christian
