# Avoid areas

The avoid[areas] parameter enables the user to calculate routes that avoid the specified areas.

For performance considerations different algorithms are used for avoiding areas based on the size of these areas. If the area specified is large and the only possible route is through the avoided area, the part of the route inside the avoided area may not be optimal.

Scenarios in which the route may go through an avoided area:

• No alternate route could be calculated from source to destination.
• Origin, destination or intermediate waypoint is within the avoided area.

The following is a request to avoid going through an area in the Tiergarten park:

curl -X GET \
'https://router.hereapi.com/v8/routes?origin=52.522297,13.353296&destination=52.508309,13.355633&transportMode=car&avoid[areas]=bbox:13.37588,52.51061,13.34226,52.51892&apikey={YOUR_API_KEY}'


The resulting route takes a detour in order to avoid the specified area.

## Violate avoided areas

The following requests fails to avoid the specified area, because the destination is inside the area to be avoided.

curl -X GET \
'https://router.hereapi.com/v8/routes?origin=52.514647,13.387549&destination=52.516547,13.379095&transportMode=car&avoid[areas]=bbox:13.382279,52.51441,13.376397,52.518284&apikey={YOUR_API_KEY}'


The response specifies a notice with the code violatedBlockedRoad:

{
"routes": [
{
"id": "a394029a-06c3-4864-b46c-8296acfcf6a1",
"sections": [
{
"id": "7237d4d1-131d-4cf5-ba2f-b95a16e571a2",
"type": "vehicle",
"departure": {
"time": "2021-11-09T17:58:56+01:00",
"place": {
"type": "place",
"location": {
"lat": 52.5146499,
"lng": 13.3875485
},
"originalLocation": {
"lat": 52.5146469,
"lng": 13.3875489
}
}
},
"arrival": {
"time": "2021-11-09T18:02:24+01:00",
"place": {
"type": "place",
"location": {
"lat": 52.5165322,
"lng": 13.3790967
},
"originalLocation": {
"lat": 52.5165469,
"lng": 13.3790949
}
}
},
"notices": [
{
"title": "Violated avoid areas.",
"severity": "critical"
}
],
"transport": {
"mode": "car"
}
}
]
}
]
}