在graphhopper路由中阻塞节点/边缘 - 错误的边缘被阻止

时间:2023-01-30 18:03:38

I'm trying to block edges in my graphhopper routing, following the example described in the docs (https://github.com/graphhopper/graphhopper/blob/master/docs/core/weighting.md). I try to find the edges which have to get blocked with

我正在尝试阻止我的graphhopper路由中的边缘,遵循文档中描述的示例(https://github.com/graphhopper/graphhopper/blob/master/docs/core/weighting.md)。我试图找到必须被阻挡的边缘

EdgeIteratorState edge = hopper.getLocationIndex().findClosest(lat, lon, EdgeFilter.ALL_EDGES ).getClosestEdge();

But when running my App, it shows up that some completely different edges are blocked, not the ones I tried to block. What am I doing wrong, do you have any hints? I got stuck with this problem since four days now, no ideas left.

但是在运行我的应用程序时,它会显示一些完全不同的边缘被阻挡,而不是我试图阻止的边缘。我做错了什么,你有什么提示吗?我从四天开始就遇到了这个问题,没有任何想法。

1 个解决方案

#1


Don't know yet, if this is elegant, but I think I found a workaround: in the config.properties of the graphhopper.sh I added

不知道,如果这很优雅,但我想我找到了一个解决方法:在graphhopper.sh的config.properties中我添加了

prepare.chWeighting=no

and while loading the graph, I set

在加载图表时,我设置了

tmpHopp.setCHEnable(false);

To block an edge afterwards, I simply set the speed for this edge to 0

要在之后阻止边缘,我只需将此边缘的速度设置为0

FlagEncoder footEncoder =    TempAppData.getInstance().getHopper().getEncodingManager().getEncoder("foot");
                edge.setFlags(footEncoder.setSpeed(edge.getFlags(), 0));

#1


Don't know yet, if this is elegant, but I think I found a workaround: in the config.properties of the graphhopper.sh I added

不知道,如果这很优雅,但我想我找到了一个解决方法:在graphhopper.sh的config.properties中我添加了

prepare.chWeighting=no

and while loading the graph, I set

在加载图表时,我设置了

tmpHopp.setCHEnable(false);

To block an edge afterwards, I simply set the speed for this edge to 0

要在之后阻止边缘,我只需将此边缘的速度设置为0

FlagEncoder footEncoder =    TempAppData.getInstance().getHopper().getEncodingManager().getEncoder("foot");
                edge.setFlags(footEncoder.setSpeed(edge.getFlags(), 0));