2

I am trying to build a custom map widget in Thingsboard using Here Maps API for JavaScript, as a base map for IoT device reporting on an interactive map. The code comes back as no error, but it does not load.

I am new to JavaScript and APIs. So I'm obviously missing something.

I have exhausted the HERE Maps API examples and have tried with no luck to find an answer on any forum.

function loadMap() {
var platform = new H.service.Platform({
    'apikey': 'APIKEY_HERE'
});

var defaultLayers = platform.createDefaultLayers();

var map = new H.Map(
    document.getElementById('mapContainer'),
    defaultLayers.vector.normal.map, {
        zoom: 14,
        center: {
            lat: 13.72,
            lng: 100.56
        }
    });

}

function addCircleToMap(map) {
    map.addObject(new H.map.Circle(
    // The center or the circle will be on
    // latitude 13.72 longitude 100.56
    [13.7230949, 100.5699041],
    // The radius of the circle in meters
    200,
{
  pen: {
    strokeColor: '#4287f5', // Color of the perimeter
    lineWidth: 2
  },
  brush: {
    color: '#42ddf5' // Color of the circle
      }
    }
  ));
}

No error messages, just a widget that never loads, spinning orange circle as a result.

  • So if you create a standalone HTML page for map display over the JS API with your credential it is working? But not within the Thingsboard Widget? –  Sep 18 '19 at 09:53
  • Would you please confirm , if your credentials are correctly working for normal HTML- JS application map rendering ? –  Sep 23 '19 at 05:36
  • Managed to solve this Stephen? – DarkCygnus Mar 12 '21 at 17:58

0 Answers0