Hi all,
I'm trying to visualize heatmaps on Google maps with the Generic Javascipt Node, but it doesn't work.
It succesfully visualizes the map but no heatmap appears, it seems that there is some trouble with the visualization library .
Here's the code:
require.config({
paths: {
"google": "https://maps.googleapis.com/maps/api/js?key= [not showed here] &libraries=visualization&callback=myMap"
}
});
require(['google'], function() {
var body = document.getElementsByTagName('body')[0];
var html = '<div id="map" style="width:100%;height:500px"></div>';
body.innerHTML = html;
myMap();
function myMap() {
var mapCanvas = document.getElementById("map");
var mapOptions = {
center: new google.maps.LatLng(40.252244, -3.414010),
zoom: 6
}
var map = new google.maps.Map(mapCanvas, mapOptions);
var heatmap = new google.maps.visualization.HeatmapLayer({
data: getPoints(),
map: map
});
}
});
function getPoints() {
var points = []; var lat, lng;
for (i = 0; i < knimeDataTable.getNumRows(); i++) {
lat = knimeDataTable.getRows()[i].data[5];
lng = knimeDataTable.getRows()[i].data[6];
points.push(new google.maps.LatLng(lat, lng));
}
return points;
}
Am I doing something wrong?
Thanks in advance,
Daniele