I have gone through a few different examples on this and nothing ever seems to work. I am trying to simply draw a point on the map using GeoJSON as the source. Here is what I currently have:
var staticGeo = new ol.source.GeoJSON(({
object: {
type: 'Feature Collection',
crs: {
type: 'name',
properties: {name: 'EPSG:4326'}
},
features: [{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [0,0]
}
}]
},
projection: 'EPSG:3857'
}));
var vectorSource = new ol.source.Vector({
source: staticGeo
});
var vectorLayer = new ol.layer.Vector({
source: vectorSource,
style: new ol.style.Style({
fill: new ol.style.Fill({
color: 'rgba(255,255,255,0.2)'
}),
stroke: new ol.style.Stroke({
color: 'blue',
width: 1
})
})
})
this.map.addLayer(vectorLayer);
this.map refers to the ol.Map object that is working. This overall seems like a lot of code to do something that should be seemingly trivial (maybe I am doing something wrong?).