Search code examples
javascripthere-api

Exclude specific road from route HERE maps


Is it possible to avoid specific roads which is preset by some coordinates in HERE maps if I'm using JavaScript?


Solution

  • It's not clear from your question if you want to avoid certain road types or certain road links. Both is possible using the JavaScript API. Check out the example below on how to construct routing parameters which avoid both toll roads in general and two specific road links.

    You can find the details on avoiding links and areas and avoiding road types in the documentation.

    var routingParameters = {
      // The routing mode, strict exclusion of tollroads
      'mode': 'fastest;car;tollroad:-3',
      // The start point of the route:
      'waypoint0': 'geo!52.5160,13.3779',
      // The end point of the route:
      'waypoint1': 'geo!52.5206,13.3862',
      // avoid two specific road links
      'avoidlinks': '+799574071,+781539155'
    };