Avoidance

The route can be calculated to avoid specific map features and/or areas.

Map features can be specified by providing a feature category. For example, a route that avoids toll roads can be calculated by specifying avoid[features]=tollRoad when requesting a route. A route that avoids environmental zones can be calculated by specifying avoid[zoneCategories]=environmental.

Specific features of the map can also be avoided by providing an identifier of the feature to be avoided. For example, a route that avoids a specific segment, a part of Invalidenstrasse in Berlin, can be calculated by specifying avoid[segments]=here:cm:segment:207551710. A route that avoids one specific environmental zone ("Berlin Umweltzone") can be calculated by specifying avoid[zoneIdentifiers]=here:cm:envzone:2.

To avoid a whole area, a user specified bounding box can be provided. For example, a route that avoids the Berlin area can be calculated by providing avoid[areas]=bbox:13.082,52.416,13.628,52.626.

Sometimes no route is possible that avoids the feature, for example specifying avoid[features]=ferry to an otherwise inaccessible island. In this case, a route can be returned that makes minimal use of the feature. However, there is no guarantee that a route is returned, if it is only possible by violating avoid.

If a route is returned that violates the avoid request a notice is included to indicate that the route does not avoid the feature.

Example that Avoids the Avoid Option

curl -X GET \
  'https://router.hereapi.com/v8/routes?destination=47.168076,11.861380&origin=47.257410,11.351458&transportMode=car&avoid[features]=tollRoad'
{
  "routes": [
    {
      "id": "428d7f71-f92b-484f-a4b5-d491b35f6210",
      "sections": [
        {
          "arrival": {
            "place": {
              "location": {
                "lat": 47.168049830943349,
                "lng": 11.861283313483
              },
              "type": "place"
            },
            "time": "2019-12-09T16:06:36+01:00"
          },
          "departure": {
            "place": {
              "location": {
                "lat": 47.25743193179369,
                "lng": 11.35145296342671
              },
              "type": "place"
            },
            "time": "2019-12-09T14:23:59+01:00"
          },
          "id": "ccba0c50-76f7-4d55-a8da-ce5c3ee629a9",
          "transport": {
            "mode": "car"
          },
          "type": "vehicle"
        }
      ]
    }
  ]
}

Example that Violates the Avoid Option

curl -X GET \
  'https://router.hereapi.com/v8/routes?destination=53.863531,14.284817&origin=53.859552,14.271760&transportMode=car&avoid[features]=ferry'

Note the included notice with the code violatedAvoidFerry in the response.

{
  "routes": [
    {
      "id": "7616d85b-da9a-46bd-9b9f-e8dafe34213a",
      "sections": [
        {
          "arrival": {
            "place": {
              "location": {
                "lat": 53.86060992255807,
                "lng": 14.277769988402725
              },
              "type": "place"
            },
            "time": "2019-12-09T14:31:28+01:00"
          },
          "departure": {
            "place": {
              "location": {
                "lat": 53.859547432512048,
                "lng": 14.271750692278147
              },
              "type": "place"
            },
            "time": "2019-12-09T14:08:34+01:00"
          },
          "id": "217649dd-5584-4162-b235-f625f5b25185",
          "transport": {
            "mode": "car"
          },
          "type": "vehicle"
        },
        {
          "arrival": {
            "place": {
              "location": {
                "lat": 53.862169962376359,
                "lng": 14.28596992045641
              },
              "type": "place"
            },
            "time": "2019-12-09T14:42:28+01:00"
          },
          "departure": {
            "place": {
              "location": {
                "lat": 53.86060992255807,
                "lng": 14.277769988402725
              },
              "type": "place"
            },
            "time": "2019-12-09T14:31:28+01:00"
          },
          "id": "e955e9cf-7783-4c77-a9ee-8ba1b409b612",
          "notices": [
            {
              "code": "violatedAvoidFerry",
              "title": "Violated avoid ferry"
            }
          ],
          "transport": {
            "mode": "ferry"
          },
          "type": "vehicle"
        },
        {
          "arrival": {
            "place": {
              "location": {
                "lat": 53.86353185400367,
                "lng": 14.284817911684513
              },
              "type": "place"
            },
            "time": "2019-12-09T14:44:22+01:00"
          },
          "departure": {
            "place": {
              "location": {
                "lat": 53.862169962376359,
                "lng": 14.28596992045641
              },
              "type": "place"
            },
            "time": "2019-12-09T14:42:28+01:00"
          },
          "id": "3a8fe2c0-269a-45f1-a5bb-aab060d78c7c",
          "transport": {
            "mode": "car"
          },
          "type": "vehicle"
        }
      ]
    }
  ]
}

Example that Fails with Avoid Options

curl -X GET 'https://router.hereapi.com/v8/routes?origin=52.531106,13.384915&transportMode=car&destination=55.954408,-3.194735&avoid[features]=ferry,carShuttleTrain&return=summary'
{
  "notices": [
    {
      "title": "Route calculation failed: Couldn't find a route.",
      "code": "noRouteFound"
    }
  ],
  "routes": []
}

results matching ""

    No results matching ""