-2

I'm starting with the HERE APIs, but in the first example my code is not working. I've reviewed and refacted it, but when I update my browser, nothing appears. Can you help me please?

<!DOCTYPE html>
<html>

<head>
  <meta name="viewport" content="initial-scale=1.0, width=device-width" />
  <script src="http://js.api.here.com/v3/3.0/mapsjs-core.js" type="text/javascript" charset="utf-8"></script>
  <script src="http://js.api.here.com/v3/3.0/mapsjs-service.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
  <div style="width: 640px; height: 480px" id="mapContainer">
    <script>
      // Initialize the platform object:
      var platform = new H.service.Platform({
        'app_id': '{xxx}',
        'app_code': '{xxx}'
        // I have a valid ID and a CODE.
      });

      // Obtain the default map types from the platform object
      var maptypes = platform.createDefaultLayers();

      // Instantiate (and display) a map object:
      var map = new H.Map(
        document.getElementById('mapContainer'),
        maptypes.normal.map, {
          zoom: 10,
          center: {
            lng: 13.4,
            lat: 52.51
          }
        });
    </script>
  </div>
</body>

</html>
Barmar
  • 741,623
  • 53
  • 500
  • 612

2 Answers2

1

Please check in your browser developer tools (network and console tab) for any type of errors you get. It will help you understand more about the issue you are facing. If your issue is similar to something like below then try this solution:

Security Error: If your browser complains about the Javascripts you have included try using there https version like below

<script type="text/javascript" src="https://js.api.here.com/v3/3.0/mapsjs-core.js"></script>
<script type="text/javascript" src="https://js.api.here.com/v3/3.0/mapsjs-service.js"></script>

If you are seeing some other error then paste the error for us to help you better.

0

Is there any error on the console?. I pasted your code inside of my editor and it work normally. One thing that you might be doing it wrong could be that you are placing the '{yourkey}' with the {} instead of 'yourkey'. You don't need the { }. Other than that, I can't seem to see what the problem would be.

Renan Cidale
  • 842
  • 2
  • 10
  • 23