I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs.
var coords = [[60.1697768639186, 24.82923586371288],
[60.170497332447866, 24.828592133548653 ],
[60.17093227431904, 24.827707004572943 ], ..........
https://developer.here.com/documentation/maps/3.1.22.1/dev_guide/topics/marker-objects.html
The documentation outlines that this is the way to add single markers
var parisMarker = new H.map.Marker({lat:48.8567, lng:2.3508});
map.addObject(parisMarker);
var romeMarker = new H.map.Marker({lat:41.9, lng: 12.5});
map.addObject(romeMarker);
var berlinMarker = new H.map.Marker({lat:52.5166, lng:13.3833});
map.addObject(berlinMarker);
So I ultimately want to loop through each element of my coordinate list and add a marker for each pair.
How can I doam trying this?..
// chargepoints = 2 if the chargepoints flask route is completed
if (chargepoints = 2) {
// ADD THE CHARGEPOINTS TO THE MAP
for (var i=0; i<coords.length; i++) {
var chargemarker = new H.map.Marker({lat:coords[i][1], lng: coords[i][0]});map.addObject(chargemarker);
map.addObject(chargemarker);
}
}
However the markers are not appearing. When I insert some consolg.log("hello"); into different stages in the loop, they appear in the console however.