首页 > 解决方案 > osrm最近和osrm匹配服务之间的区别

问题描述

我想将 gps 坐标与 osm 节点匹配。osrm 文档明确指出匹配服务就是为此目的。但我看到他们中的大多数人为此目的使用最近的服务。为什么这样?还有任何匹配服​​务的例子,这两种服务在匹配操作方面的主要区别是什么。哪个更好?

标签: pythonpython-requestsgisopenstreetmaposrm

解决方案


根据OSRM API 文档

  1. neareast服务是一个查询端点,其中返回最接近捕捉number的对象(允许单个坐标)。waypointcoordinates

     GET http://{server}/nearest/v1/{profile}/{coordinates}.json?number={number}
    
  2. 另一方面,顾名思义,match服务做了一些完全不同的事情,可以说更复杂。它接受多个coordinates点并以合理的方式将这些点与路由网络匹配。从虚拟和一些操纵的响应中可以看出;matchings数组定义confidence(由 OSRM 计算)、geometry(在参数中提供)、legs(定义路由详细信息annotationsoverview参数提供灵活性)和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
        }
    ]
}



推荐阅读