I am looking for example of how to add markers of different type (different images) using OpenLayers 3.
This is my code:
iconStyle = new ol.style.Style({
image : new ol.style.Icon(({
anchor : [ 0.5, 46 ],
anchorXUnits : 'fraction',
anchorYUnits : 'pixels',
opacity : 0.75,
src : '/icon.png'
}))
});
vectorSource = new ol.source.Vector({
features : []
})
vectorLayer = new ol.layer.Vector({
source : vectorSource,
style : iconStyle
});
map.addLayer(vectorLayer);
I can't seem to have more than one icon. For example if user clicks on map, marker from one source is displayed, and when he enters an address, a marker form another source is displayed.
How this should be managed? Do I nee to create multiple iconStyle, vectorSource and many vectorLayer attached to map?