See default ol.style of ol.layer.Vector
Stroke needs some shape of feature such as circle, polygon, etc,. simple ol.geom.point doesn’t have a shape. that’s why nothing appears when you set style only with stroke
If you change your style like below, it will work as you expect:
var style = new ol.style.Style({
image: new ol.style.Circle({ // add this
stroke: new ol.style.Stroke({
color: 'red'
}),
radius: 5
}),
});
How to add marker to user defined image how to add markers with OpenLayers 3
How to get the current viewport of the map
https://openlayers.org/workshop/en/vectortile/map.html
https://gis.stackexchange.com/questions/251491/adding-a-feature-to-openlayers-vector-source
In openlayers 4, I am able to get the layer of each selected feature like this: (Im not sure if this works in OL3)
var infoClicker = map.on('click', function(evt) {
map.forEachFeatureAtPixel(evt.pixel,
function(feature, layer) {
var idLayer = layer.get('myLayerID');