Use highway as little as possible

Sometimes there is no route possible that avoids the highway, for example a route that starts or ends on a highway. In this case, the route will make minimal use of the highway. Furthermore, you need to include a notice (with notice code violatedAvoidControlledAccessHighway) to indicate that the route does not avoid the highway. Hence, if the user gets this notice, it is clear that avoiding the highway is not possible and you can take further actions accordingly.

curl -X GET \
  'https://router.hereapi.com/v8/routes?destination=53.335542,14.522257&origin=53.338226499,14.5058642048&transportMode=scooter&apikey={YOUR_API_KEY}'
{
  "routes": [
    {
      "id": "85a50dee-a7d2-4383-b3c2-14d65ce9dc6a",
      "sections": [
        {
          "id": "dd8b21b1-5e07-4bb5-992b-a0a196ae2fc5",
          "type": "vehicle",
          "departure": {
            "time": "2020-10-23T09:05:35+02:00",
            "place": {
              "type": "place",
              "location": {
                "lat": 53.3382266,
                "lng": 14.5058641
              },
              "originalLocation": {
                "lat": 53.3382264,
                "lng": 14.5058641
              }
            }
          },
          "arrival": {
            "time": "2020-10-23T09:11:35+02:00",
            "place": {
              "type": "place",
              "location": {
                "lat": 53.3354319,
                "lng": 14.5222037
              },
              "originalLocation": {
                "lat": 53.3355419,
                "lng": 14.5222569
              }
            }
          },
          "notices": [
            {
              "title": "Violated avoid controlled-access highway.",
              "code": "violatedAvoidControlledAccessHighway"
            }
          ],
          "transport": {
            "mode": "scooter"
          }
        }
      ]
    }
  ]
}

results matching ""

    No results matching ""