Routing API Developer's Guide

Requesting a Route Avoiding an Area

To calculate directions between two coordinates without traveling through a specified area, use the CalculateRouteRequest service specifying the start (waypoint0), endpoint (waypoint1) and area to avoid (avoidareas as a rectangular area, defining the top left and bottom right corners). The string geo! indicates that you are specifying each point using latitude and longitude. Note that you also have to specify an app_id and app_code (see Acquiring Credentials), type of route calculation and whether to take traffic into account.

The following example calculates a route from the Westin Grand hotel (52.516858379, 13.3884717) at Unter den Linden in Berlin to the Staatsoper in Berlin (52.51733824, 13.394678415) avoiding passing the Deutsche Guggenheim (52.51704771, 13.39131492) by specifying a rectangle that contains it (top left 52.517100760,13.3905424488 and bottom right 52.5169701849,13.391808451), and also the fastest route for a car without taking traffic conditions into account.

https://route.cit.api.here.com/routing/7.2/calculateroute.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&waypoint0=geo!52.516858379,13.3884717
&waypoint1=geo!52.51733824,13.394678415
&mode=fastest;car;traffic:disabled
&avoidareas=52.517100760,13.3905424488;52.5169701849,13.391808451
Figure 1. Example of route avoiding an area.
In the following example multiple rectangular areas are specified. The query results in a route avoiding all specified areas.
Note: Multiple avoid areas have to be specified using character "!" as separator.
https://route.cit.api.here.com/routing/7.2/calculateroute.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&waypoint0=geo!52.5184443440238,13.383906494396967
&waypoint1=geo!52.51435421904425,13.396947378094524
&mode=fastest;car;traffic:disabled
&avoidareas=52.517100760,13.3905424488;52.5169701849,13.391808451!
52.51623131288022,13.389888672738778;52.51335487996589,13.395274548440511!
52.52006148651319,13.385160024545286;52.517760038213815,13.389707563495335
Figure 2. Example of route avoiding multiple areas.

In the following example an area is specified in a way, that it cannot be avoided. Note that routeattributes request parameter is used to obtain notes.

https://route.cit.api.here.com/routing/7.2/calculateroute.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&waypoint0=geo!52.51698477564798,13.390274028311126
&waypoint1=geo!52.51708923597271,13.392055015097014
&mode=fastest;car;traffic:disabled
&routeattributes=sh,no
&avoidareas=52.517100760,13.3905424488;52.5169701849,13.391808451

In such case resulting route passes through specified area and JSON output contains a "violation" note.

note : [ <1 elem>
  0 : {
    type : "violation"
    code : "routingOptionViolated"
    text : "blockedRoad"
  }
]
Figure 3. Example of route not possible to avoid specified area.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.