【问题标题】:Is it possible to add a Waypoint-ID to the via Waypoints using HERE Routing?是否可以使用 HERE Routing 将 Waypoint-ID 添加到 via Waypoints?
【发布时间】:2021-02-17 07:53:12
【问题描述】:

我必须计算一些路线,以便将一辆较大的汽车(小巴)中的 8 个人带到工作场所并在下午将他们带回家。是否可以在坐标中添加 ID 属性?这将帮助我评估我的 Java 代码中的响应,而不是检查坐标(“originalLocation”与“location”)。

例如最后的 ID 4711 并用分号分隔

  • &via=47.774945410,12.103053452;4711
  • &destination=47.7720259654,12.09511552052;4712

类似于 Routing V7 API 中的 UserLabel:[API V7 Waypoint description] (https://developer.here.com/documentation/routing/dev_guide/topics/resource-param-type-waypoint.html#resource-param-type-waypoint__navigation-waypoint-link-positions)。那里的描述说:V8中的航点:string, {lat},{lng}[;name={name}]

我正在使用或试验 HERE Routing API V8。或者我可以在主页上看到的多个 HERE Telematics API 中的某个地方有更多选项?

我尝试了迁移指南 (https://developer.here.com/documentation/routing-api/8.20.1/migration_guide/index.html) 中描述的一些方法,但没有奏效

  1. (a) &via=47.7747679928991,12.322371484945947;name=3333
    • 返回:Invalid place option .... Unexpected input at end of place option at 'name=3333'
  2. (b) &via=47.82695713017682,12.295106144134037!name=3333
    • 返回:Invalid waypoint option
  3. (c) &via=47.82695713017682,12.295106144134037;4711
    • 返回:Place or waypoint option specification '4711' is invalid
    • ...Invalid value for parameter 'via'

顺便说一句:我知道两者的API是有区别的

  • "PlaceOptions" 遵循以分号分隔的坐标/";"和
  • “WaypointOptions”,以感叹号“!”分隔。

PlaceOptions 似乎是固定的指定参数,如 course、sideOfStreetHint、stopDuration 等,因此我认为 WaypointOptions 应该是要走的路。但仍然没有运气。

【问题讨论】:

    标签: routes here-api


    【解决方案1】:

    您是对的,似乎 name 选项已被删除,而迁移指南并未反映这一点。期待获得 HERE 开发人员支持的回复,也许有一个未记录的选项来标记航点。

    根据最新的API documentation(v8.20.1),这些是via参数的所有可用选项:

        A location defining a via waypoint.
    
        A via waypoint is a location between origin and destination. The route will do a stop
        at the via waypoint.
    
        Multiple waypoints can also be specified using multiple via parameters like
        `via=...&via=...`, in which case the route will traverse these waypoints sequentially in
        the order specified in the request.
    
        ## Format
    
        Format: `Place[WaypointOptions]`
    
        * Place: `{lat},{lng}[PlaceOptions]`
        * PlaceOptions: `;option1=value1;option2=value2...`
        * WaypointOptions: `!option1=value1!option2=value2...`
    
        A waypoint consists of:
    
        * Exactly one place
        * Optional settings for the place
        * Optional settings for the waypoint itself
    
        Supported place options:
    
        * `course`: int, degrees clock-wise from north. Indicating desired direction at the place.
          E.g. `90` indicating `east`. Often combined with `radius` and/or `minCourseDistance`
        * `sideOfStreetHint`: `{lat},{lng}`. Indicating the side of the street that should be
          used. E.g. if the location is to the left of the street, the router will prefer using
          that side in case the street has dividers. E.g.
          `52.511496,13.304140;sideOfStreetHint=52.512149,13.304076` indicates that the `north`
          side of the street should be preferred. This option is required, if `matchSideOfStreet`
          is set to `always`.
        * `matchSideOfStreet`: enum `[always, onlyIfDivided]`. Specifies how the location set by
          `sideOfStreetHint` should be handled. Requires `sideOfStreetHint` to be specified as
          well.
          + `always` : Always prefer the given side of street.
          + `onlyIfDivided`: Only prefer using side of street set by `sideOfStreetHint` in case
            the street has dividers. This is the default behavior.
        * `nameHint`: string. Causes the router to look for the place with the most similar name.
          This can e.g. include things like: `North` being used to differentiate between
          interstates `I66 North` and `I66 South`, `Downtown Avenue` being used to correctly
          select a residental street.
        * `radius`: int, meters. Asks the router to consider all places within the given radius as
          potential candidates for route calculation. This can be either because it is not
          important which place is used, or because it is unknown. Radius more than 200meter are
          not supported.
        * `minCourseDistance`: int, meters. Asks the routing service to try find a route that avoids actions for
          the indicated distance. E.g. if the origin is determined by a moving vehicle, the user
          might not have time to react to early actions.
    
        Supported waypoint options:
        * `stopDuration`: desired duration for the stop, in seconds.
        * `passThrough`: boolean. Asks the router to avoid the following during route calculation:
          + Introducing a stop at the waypoint.
          + Splitting the route into sections.
          + Changing the direction of travel.
    
          Following scenarios are not supported for `passThrough` parameter:
          + Setting both `stopDuration` to a value greater than 0 and `passThrough=true`.
          + Setting `passThrough=true` for `origin` or `destination` of a route.
          The default value is `false`.
    
        Notes:
    
        * Non-structural reserved characters in options' values need to be properly percent-encoded.
          Please refer to the developers' guide for more details.
    

    也就是说,我想您拥有标签的唯一方法是在 Java 代码中以某种方式为每个航路点分配一个标签。

    【讨论】:

    • 感谢您的回答。我担心这会是这种情况/解决方案。是的,我也希望 V.8 中有一些我们不知道但 HERE 开发人员知道的未记录选项。 :-)
    猜你喜欢
    • 1970-01-01
    • 2015-08-04
    • 1970-01-01
    • 2021-05-06
    • 1970-01-01
    • 2016-08-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多