I want lay mark on google maps with a few hundred points.

I want to display a few hundred points on google map with “generic javascript view” node

For more details, see attachment.

I adopted heat map workflow that someone replied. (google maps with heat map)

Blockquote
require.config({
paths: {
“google”: “https://maps.googleapis.com/maps/api/js?key=$${Sapi-key}$$&libraries=visualization&callback=myMap
}
});
require([‘google’], function() {});

Blockquote
window.myMap = function() {
var body = document.getElementsByTagName(‘body’)[0];
var html = ‘

’;
body.innerHTML = html;
var mapCanvas = document.getElementById(“map”);
var mapOptions = {
center: new google.maps.LatLng(36.347371, 127.383371),
zoom: 15
}
var map = new google.maps.Map(mapCanvas, mapOptions);
setMarkers(map, BuildingPoints);
}

Blockquote
function setMarkers(map, locations){
var globalPin = ‘/pin.png’;
for (i = 0; i < locations.length; i++) {
var building = locations[i]
var myLatLng = new google.maps.LatLng(building[0], building[1]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map
});
}
}

Blockquote
function getPoints() {
var BuildingPoints = ; var lat, lng;
for (i = 0; i < knimeDataTable.getNumRows(); i++) {
lat = knimeDataTable.getRows()[i].data[0];
lng = knimeDataTable.getRows()[i].data[1];
BuildingPoints.push(new google.maps.LatLng(lat, lng));
}
return BuildingPoints;
}

GoogleMapMarker.knwf (10.0 KB)

Hey Alex,

I attached a slightly modified version of your workflow. This one should work (make sure, that you input a valid map-api-key). The problem was, that you did not call your function getPoints() and referred to the variable BuildingPoints which is not globally visible.

Greetings
DanielGoogleMapMarker.knwf (10.1 KB)

3 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.