如何使用OSRM的匹配服务

时间:2018-06-05 11:17:05

标签: osrm

如标题所述:我如何使用匹配电话?
我试过了

http://router.project-osrm.org/match/v1/driving/8.610048,46.99917;8.530232,47.051?overview=full&radiuses=49;49

我不确定,radiuses列表是否正确。 我无法让它发挥作用。我还尝试了[49;49]{49;49}该命令适用于route

http://router.project-osrm.org/route/v1/driving/8.610048,46.99917;8.530232,47.051?overview=full

对于背景,请参阅here

修改:如果您查看示例here,似乎不需要timestamps /match/v1/{profile}/{coordinates}?steps={true|false}&geometries={polyline|polyline6|geojson}&overview={simplified|full|false}&annotations={true|false}

1 个答案:

答案 0 :(得分:1)

来自docs

  

如果无法找到完整的匹配,时间戳(> 60秒)或不可能的转换中的大跳转会导致跟踪分裂。

我认为这是您的请求的问题。两个给定点超过60s appart和OSRM无法成功匹配。正确指定了radiuses

以下查询适用于我:

http://router.project-osrm.org/match/v1/driving/8.610048,46.99917;8.620048,46.99917?overview=full&radiuses=49;49

返回:

{"tracepoints":[{"location":[8.610971,46.998963],"name":"Alte Kantonstrasse","hint":"GKUFgJEhBwAAAAAAHQAAAAAAAAC5AAAAAAAAAB0AAAAAAAAAuQAAAPsCAACbZIMAsyXNAgBhgwCCJs0CAAAPABki8hY=","matchings_index":0,"waypoint_index":0,"alternatives_count":0},{"location":[8.620295,46.999681],"name":"Schönenbuchstrasse","hint":"nIEFAJ7IFIA3AAAAZAAAAAAAAADYAAAANwAAAGQAAAAAAAAA2AAAAPsCAAAHiYMAgSjNAhCIgwCCJs0CAAAPABki8hY=","matchings_index":0,"waypoint_index":1,"alternatives_count":5}],"matchings":[{"distance":922.3,"duration":114.1,"weight":114.1,"weight_name":"routability","geometry":"onz}Gqyps@Wg@S_@aCaFMUYo@c@w@OKOCWmAWs@aBiDsAsCMYH[HY\\_@h@ObBW^w@BQAUKu@ASF[ZaABOFYpAyIf@mD","confidence":0.000982,"legs":[{"distance":922.3,"duration":114.1,"weight":114.1,"summary":"","steps":[]}]}],"code":"Ok"}

因此,两个给定的输入点8.610048,46.999178.620048,46.999178.610971,46.9989638.620295,46.999681匹配。

据我所知,如果你想实现像that这样的东西,你需要给OSRM提供更多的输入点,这些输入点的间隔小于60秒。

另请参阅here,了解有关routematch服务之间差异的说明。