I'm working with openlayers and I want the map to show me the icons that I bring from my local server, but when I run it, it does not bring me anything. Now when I put in place of image, the property sourse: sourse completes me the places with celestial circles. What am I doing wrong?
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM({
wrapX: false
})
})
],
controls: ol.control.defaults({
attributionOptions: {
collapsible: false
}
}),
target: 'map',
view: new ol.View({
center: ol.proj.transform(
[longitud, latitud], 'EPSG:4326', 'EPSG:3857'),
zoom: 10,
minZoom: 4,
maxZoom: 18
})
});
var source = new ol.source.Vector({
wrapX: false
});
var vector = new ol.layer.VectorRenderType({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5,1],
anchorXUnits: 'fraction',
anchorYUnits: 'fraction',
src: 'img/parabus2.png'
}))
});
map.addLayer(vector);
for (var i=0;i<coord_arr.length;i++){
var data=coord_arr[i].split(',');
var nombre_parada= data[0];
var longi_parada= parseFloat(data[1]);
var lati_parada= parseFloat(data[2]);
var iconoParada = new ol.Feature({
'geometry': new ol.geom.Point(ol.proj.transform(
[longi_parada,lati_parada], 'EPSG:4326', 'EPSG:3857'))
});
source.addFeature(iconoParada);
}