Graphhopper:使用 OSM id 为边缘添加权重

Graphhopper: Adding weight to edges using OSM id

我有一个大芝加哥地区的 pbf 文件,并且能够使用 graphhopper 网络查看器加载该文件。

我想使用我拥有的路段(每个路段都由一个 OSM id 标识)的额外使用数据来改进自行车路线。

从这个 SO 回答 how-to-quickstart-graphhopper-with-my-own-multimodal-graph,我了解到我需要将我拥有的使用数据提供给 GraphHopperStorage。关于这样做的几个问题:

1) 我的使用数据引用了 OSM id。如何将 pbf 文件中的边引用到 OSM id?我还有每个段的 head/tail 的 lat/lon 坐标——根据我的 read,我相信我必须将这些用于我的映射?

2) 创建 MyGraphHopperStorage 后,我是否可以坚持添加权重,这样我就不必在每个 运行 时都执行此操作?

谢谢

汤姆

My usage data references OSM ids. How do I reference edges in my pbf file to an OSM id?

您需要在导入时保留一个 (Hash)Map,以便在内部 ID 和 OSM ID(边缘或节点)之间进行转换。要在导入后继续使用 osm id,请参阅 this example project

can I persist the addition of the weighting so that I do not have to perform this at every run?

你可以将它存储到标志中并调用 graph.flush,查看我最近的 traffic data post