【问题标题】:HERE Api Maps calculated route not following overland roadsHERE Api Maps 计算的路线不遵循陆路
【发布时间】:2020-07-17 08:08:49
【问题描述】:

我正在使用此 REST 调用从 HERE Maps Routing API 获取路线信息:

"https://route.api.here.com/routing/7.2/calculateroute.json?" +
         "waypoint0=34.045535,-118.222708&waypoint1=34.045142,-118.235551" +
         "&mode=fastest;car;traffic:disabled&departure=now&app_id=[appID]&app_code=[appCode]"

调用有效,这是响应:

{
    "response": {
      "metaInfo": {
        "timestamp": "2020-04-05T09:06:42Z",
        "mapVersion": "8.30.107.152",
        "moduleVersion": "7.2.202013-6774",
        "interfaceVersion": "2.6.76",
        "availableMapVersion": [
          "8.30.107.152"
        ]
      },
      "route": [
        {
          "waypoint": [
            {
              "linkId": "-1252788623",
              "mappedPosition": {
                "latitude": 34.0452509,
                "longitude": -118.2226727
              },
              "originalPosition": {
                "latitude": 34.0455349,
                "longitude": -118.222708
              },
              "type": "stopOver",
              "spot": 0.4571429,
              "sideOfStreet": "right",
              "mappedRoadName": "E 3rd St",
              "label": "E 3rd St",
              "shapeIndex": 0,
              "source": "user"
            },
            {
              "linkId": "+23907924",
              "mappedPosition": {
                "latitude": 34.0450604,
                "longitude": -118.2356195
              },
              "originalPosition": {
                "latitude": 34.045142,
                "longitude": -118.235551
              },
              "type": "stopOver",
              "spot": 0.6229508,
              "sideOfStreet": "right",
              "mappedRoadName": "Traction Ave",
              "label": "Traction Ave",
              "shapeIndex": 20,
              "source": "user"
            }
          ],
          "mode": {
            "type": "fastest",
            "transportModes": [
              "car"
            ],
            "trafficMode": "disabled",
            "feature": []
          },
          "leg": [
            {
              "start": {
                "linkId": "-1252788623",
                "mappedPosition": {
                  "latitude": 34.0452509,
                  "longitude": -118.2226727
                },
                "originalPosition": {
                  "latitude": 34.0455349,
                  "longitude": -118.222708
                },
                "type": "stopOver",
                "spot": 0.4571429,
                "sideOfStreet": "right",
                "mappedRoadName": "E 3rd St",
                "label": "E 3rd St",
                "shapeIndex": 0,
                "source": "user"
              },
              "end": {
                "linkId": "+23907924",
                "mappedPosition": {
                  "latitude": 34.0450604,
                  "longitude": -118.2356195
                },
                "originalPosition": {
                  "latitude": 34.045142,
                  "longitude": -118.235551
                },
                "type": "stopOver",
                "spot": 0.6229508,
                "sideOfStreet": "right",
                "mappedRoadName": "Traction Ave",
                "label": "Traction Ave",
                "shapeIndex": 20,
                "source": "user"
              },
              "length": 1743,
              "travelTime": 201,
              "maneuver": [
                {
                  "position": {
                    "latitude": 34.0452509,
                    "longitude": -118.2226727
                  },
                  "instruction": "Head <span class=\"heading\">west</span> on <span class=\"street\">E 3rd St</span>. <span class=\"distance-description\">Go for <span class=\"length\">39 m</span>.</span>",
                  "travelTime": 19,
                  "length": 39,
                  "id": "M1",
                  "_type": "PrivateTransportManeuverType"
                },
                {
                  "position": {
                    "latitude": 34.0452147,
                    "longitude": -118.2231045
                  },
                  "instruction": "Turn <span class=\"direction\">left</span> onto <span class=\"next-street\">S Gless St</span>. <span class=\"distance-description\">Go for <span class=\"length\">258 m</span>.</span>",
                  "travelTime": 46,
                  "length": 258,
                  "id": "M2",
                  "_type": "PrivateTransportManeuverType"
                },
                {
                  "position": {
                    "latitude": 34.0429187,
                    "longitude": -118.2227612
                  },
                  "instruction": "Turn <span class=\"direction\">right</span> onto <span class=\"next-street\">E 4th St</span>. <span class=\"distance-description\">Go for <span class=\"length\">1.1 km</span>.</span>",
                  "travelTime": 84,
                  "length": 1120,
                  "id": "M3",
                  "_type": "PrivateTransportManeuverType"
                },
                {
                  "position": {
                    "latitude": 34.0429831,
                    "longitude": -118.2341015
                  },
                  "instruction": "Turn <span class=\"direction\">right</span> onto <span class=\"next-street\">Merrick St</span>. <span class=\"distance-description\">Go for <span class=\"length\">112 m</span>.</span>",
                  "travelTime": 20,
                  "length": 112,
                  "id": "M4",
                  "_type": "PrivateTransportManeuverType"
                },
                {
                  "position": {
                    "latitude": 34.043895,
                    "longitude": -118.2338119
                  },
                  "instruction": "Continue on <span class=\"next-street\">Traction Ave</span>. <span class=\"distance-description\">Go for <span class=\"length\">214 m</span>.</span>",
                  "travelTime": 32,
                  "length": 214,
                  "id": "M5",
                  "_type": "PrivateTransportManeuverType"
                },
                {
                  "position": {
                    "latitude": 34.0450604,
                    "longitude": -118.2356195
                  },
                  "instruction": "Arrive at <span class=\"street\">Traction Ave</span>. Your destination is on the right.",
                  "travelTime": 0,
                  "length": 0,
                  "id": "M6",
                  "_type": "PrivateTransportManeuverType"
                }
              ]
            }
          ],
          "summary": {
            "distance": 1743,
            "trafficTime": 203,
            "baseTime": 201,
            "flags": [
              "builtUpArea"
            ],
            "text": "The trip takes <span class=\"length\">1.7 km</span> and <span class=\"time\">3 mins</span>.",
            "travelTime": 201,
            "_type": "RouteSummaryType"
          }
        }
      ],
      "language": "en-us"
    }
}

它是有效的,只是它似乎不包括路线的所有链接点。生成的路线的屏幕截图非常不言自明:

API 返回显示红线而不是绿线的链接点,绿线应该是实际的陆路路线。

我是否遗漏了任何可能导致此问题的属性?

【问题讨论】:

    标签: rest routes gps here-api here-maps-rest


    【解决方案1】:

    请尝试考虑交通模式:已启用

    禁用模式:
    未提供出发时间:

    基于静态时间的限制:忽略 实时交通关闭:忽略。 实时车流速度:忽略。 历史流量和预测流量:忽略

    提供出发时间:

    基于静态时间的限制:如果道路将在限制的有效期内穿越,则避免。 实时交通封闭:适用于整个路线。 实时车流速度:忽略。 历史流量和预测流量:忽略

    注意:禁用和启用流量之间的差异仅影响路由的计算。仍将使用与 traffic:enabled 相同的规则为所有路线计算路线的通行时间。

    另请参阅以下汽车路线示例: https://developer.here.com/documentation/examples/rest/routing

    【讨论】:

    • 谢谢指点;最有帮助的。我正在寻找的功能似乎是导航形状。但是,与形状相关的数据非常大。有没有办法修剪响应包以仅返回路线坐标数组?
    猜你喜欢
    • 2014-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多