I am setting on map some points which I have in an array coords
var iconFeatures=[];
coords.forEach((elem, ind, arr) => {
coord = elem.split(',')
var iconFeature = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.transform([parseFloat(coord[0]), parseFloat(coord[1])], 'EPSG:4326',
'EPSG:3857')),
name: 'Point' + (ind + 1),
})
iconFeatures.push(iconFeature);
});
var vectorSource = new ol.source.Vector({
features: iconFeatures
});
var iconStyle = new ol.style.Style({
image: new ol.style.Circle({
radius: 6,
stroke: new ol.style.Stroke({
color: '#fff'
}),
fill: new ol.style.Fill({
color: '#3399CC'
})
}),
});
vectorLayer = new ol.layer.Vector({
source: vectorSource,
style: iconStyle
});
map.addLayer(vectorLayer);
I would like to add the Text next to each point, which would be the name of iconFeature
(Point 1, Point 2, ...).
I am not sure where to set this to get info on the map.
Thank you for help in advance.