python - osrm最近和osrm匹配服务之间的区别
问题描述
我想将 gps 坐标与 osm 节点匹配。osrm 文档明确指出匹配服务就是为此目的。但我看到他们中的大多数人为此目的使用最近的服务。为什么这样?还有任何匹配服务的例子,这两种服务在匹配操作方面的主要区别是什么。哪个更好?
解决方案
根据OSRM API 文档,
该
neareast
服务是一个查询端点,其中返回最接近捕捉number
的对象(允许单个坐标)。waypoint
coordinates
GET http://{server}/nearest/v1/{profile}/{coordinates}.json?number={number}
另一方面,顾名思义,
match
服务做了一些完全不同的事情,可以说更复杂。它接受多个coordinates
点并以合理的方式将这些点与路由网络匹配。从虚拟和一些操纵的响应中可以看出;matchings
数组定义confidence
(由 OSRM 计算)、geometry
(在参数中提供)、legs
(定义路由详细信息annotations
和overview
参数提供灵活性)和tracepoints
列出waypoints
具有附加属性的数组。GET /match/v1/{profile}/{coordinates}?steps={true|false}&geometries={polyline|polyline6|geojson}&overview={simplified|full|false}&annotations={true|false}
coordinates
: 逗号分隔的 GPS 点steps
:每条路线的路线步骤geometries
:路线几何图形支持 3 种格式。overview
:根据给定值添加概览几何。annotations
: 返回每个坐标的附加元数据。
虚拟Match
服务响应概述,因为它没有很清楚地提供:
{
"code": "Ok",
"matchings": [
{
"confidence": 0.980739,
"geometry": {
"coordinates": [
# coordinates here
],
"type": "LineString"
},
"legs": [
{
"annotation": {
# optional
},
"steps": [
{
"intersections": [
{
"out": 0,
"entry": [
true
],
"bearings": [
12
],
"location": [
28.98672,
41.041189
]
}
],
"driving_side": "right",
"geometry": {
"coordinates": [
# coordinates here
],
"type": "LineString"
},
"mode": "driving",
"duration": 95.6,
"maneuver": {
},
"weight": 95.6,
"distance": 796.3,
"name": "Cumhuriyet Caddesi"
},
],
"distance": 1250.9,
"duration": 150.2,
"summary": "Cumhuriyet Caddesi, Halaskargazi Caddesi",
"weight": 150.2
}
],
"distance": 1250.9,
"duration": 150.2,
"weight_name": "routability",
"weight": 150.2
}
],
"tracepoints": [
{
# waypoint object with additional fields
}
]
}
推荐阅读
- javascript - 如何使用正则表达式提取没有路径参数或查询参数的 url 的相对路径?
- visual-studio-code - VSCode 在 OS 更新后以黑底灰显示代码
- pyspark - 如何将字符串附加到pyspark中列出的数据框列
- python - 无法加载请求的 DLL 找不到指定的模块
- assembly - 反向字符串 MASM
- c++ - 如何在 C++ 中将空格分隔的输入插入数组
- linux - 如果我将浮点数除以零,为什么会引发“浮点异常”?
- python - 如何在matplotlib中向相反方向(向下)添加第三个y轴?
- python - 语音字符到语音
- file - URLDownloadToFile 中的 IBindStatusCallback 未正确返回最终文件大小