• JavaScript
  • HTML

<!DOCTYPE html>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes">
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    <title>Map with the truck routes and road restrictions</title>
    <link rel="stylesheet" type="text/css" href="https://js.api.here.com/v3/3.1/mapsjs-ui.css" />
    <link rel="stylesheet" type="text/css" href="demo.css" />
    <link rel="stylesheet" type="text/css" href="styles.css" />
    <link rel="stylesheet" type="text/css" href="../template.css" />
    <script type="text/javascript" src='../test-credentials.js'></script>
    <script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-core.js"></script>
    <script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-service.js"></script>
    <script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-ui.js"></script>
    <script type="text/javascript" src="https://js.api.here.com/v3/3.1/mapsjs-mapevents.js"></script>
  <script>window.ENV_VARIABLE = 'developer.here.com'</script><script src='../iframeheight.js'></script></head>
  <body id="markers-on-the-map">

    <div class="page-header">
        <h1>Map with the truck routes and road restrictions</h1>
        <p>Show a truck routes with the truck related road restrictions highlighted on the map</p>
    <p>This example calculates and displays 3 different truck routes with the same start and end positions,
      but various truck attributes.
    The start position is in <b>Manhattan</b> and the end position on the opposite bank in <b>Newport</b>.
        <li>The blue route is a simple truck route (without specifying any truck attributes).</li>
        <li>The green route shows that a truck must use <b>Lincoln Tunnel</b> instead of <b>Holland Tunnel</b>
        when it has four axles (uses the <code>truck[axleCount]</code> parameter of the Routing API).</li>
        <li>The violet route shows that a truck with the four acles transporting flammable goods should take a much longer detour
          (uses the <code>truck[shippedHazardousGoods]</code> parameter of the Routing API).</li>
    <p>More information about above mentioned routing request parameters can be found <a href="https://www.here.com/docs/bundle/routing-api-v8-api-reference/page/index.html#tag/Routing/operation/calculateRoutes" target="_blank">here</a>.</p>
      The truck restrictions layer is set as a base map.
    <div id="map"></div>
    <div id="panel"></div>
    <p>Access to the routing service is obtained from the <code>H.service.Platform</code> by calling
      <code>getRoutingService(null, 8)</code>. The <code>calculateRoute()</code> method is used to calculate the fastest
      truck route by passing in the relevant parameters as defined in
      <a href="https://www.here.com/docs/bundle/routing-api-v8-api-reference/page/index.html#tag/Routing/operation/calculateRoutes" target="_blank">Routing API</a>.
      The styling and display of the response is under the control of the developer.</p>
    <script type="text/javascript" src='demo.js'></script>