【问题标题】:Difference between osrm nearest and osrm match servicesosrm最近和osrm匹配服务之间的区别
【发布时间】:2020-12-04 15:04:55
【问题描述】:

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

【问题讨论】:

    标签: python python-requests gis openstreetmap osrm


    【解决方案1】:

    根据OSRM API Documentation

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

       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:为每个坐标返回额外的元数据。

    Dummy 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
            }
        ]
    }
    
    
    

    【讨论】:

      猜你喜欢
      • 2017-09-09
      • 2018-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-12
      • 2018-10-29
      • 1970-01-01
      • 2023-01-28
      相关资源
      最近更新 更多