如何设置路线配置文件'foot'?使用默认的配置文件'car‘,我无法计算任何位置(在森林中)和附近的人行道之间的距离。
我得到的错误消息是:
> Encoding does not match: Graphhopper config:
> foot|speed_factor=1.0|speed_bits=4|turn_costs=false|version=5 Graph:
> car|speed_factor=5.0|speed_bits=5|turn_costs=false|version=2 Change
> configuration to match the graph or delete ...
> gelederland-latest.osm-gh/我的代码是:
graphHopper = new GraphHopper().forMobile();
EncodingManager encodingManager = EncodingManager.create( FlagEncoderFactory.FOOT);
graphHopper.setEncodingManager(encodingManager);
graphHopper.setProfiles(Arrays.asList( new ProfileConfig("my_foot").setVehicle("foot").setWeighting("fastest")));
graphHopper.load(getRoutingDataFolder());我使用的路由数据?首先,我通过http://download.geofabrik.de/europe/netherlands/gelderland.html检索原始的OSM文件。之后,我通过以下命令准备了Graphhopper路由数据:
./graphhopper.sh -a import -i gelderland-latest.osm.pbf更新:这样就足够了吗?我正在尝试:
./graphhopper.sh -a import -p foot,bike,car -i netherlands-latest.osm.pbf 发布于 2020-04-15 23:47:22
问题是Graph (即graphhopper生成的路由文件)与应用程序中的配置设置不一致。
在下面的回答中,我想要有一个同时适用于步行、自行车和汽车的路由设施。当然,只有一种“车辆”类型的路由是可能的。我还测试了路由配置文件'foot‘。
为了获得这种对齐方式,我首先在graphhopper project的克隆中编辑了config.yml文件。在配置文件中,我更改了:
graph.flag_encoders: foot,bike,car和:
profiles:
- name: foot
vehicle: foot
weighting: fastest和
profiles_ch:
- profile: foot我使用以下命令生成了Graph数据:
./graphhopper.sh -a import -p foot,bike,car -i netherlands-latest.osm.pbf 然后,使用相同的配置文件配置您的应用程序是很重要的。因此,即使只在你的应用程序中使用“foot”配置文件,也会导致不匹配--正如错误消息所暗示的那样。
该应用程序包含以下代码,用于测量任何点到路径的距离:
graphHopper = new GraphHopper().forMobile();
EncodingManager encodingManager = EncodingManager.create( FlagEncoderFactory.FOOT + "," + FlagEncoderFactory.BIKE + "," + FlagEncoderFactory.CAR);
graphHopper.setEncodingManager(encodingManager);
graphHopper.setProfiles(Arrays.asList(
new ProfileConfig("my_foot").setVehicle("foot").setWeighting("fastest"),
new ProfileConfig("my_bike").setVehicle("bike").setWeighting("fastest"),
new ProfileConfig("my_car").setVehicle("car").setWeighting("fastest")));
graphHopper.load(routingDataFolder);https://stackoverflow.com/questions/61230460
复制相似问题