In an openlayers 3 app, I am able to retrieve the bounding extent and fit the view. However I now want to create a feature/polygon by using the bounding extent.
let boundingExtent = ol.extent.boundingExtent([[left, bottom], [right, top]]);
//??/let polygon = ol.geom.Polygon.fromExtent(boundingExtent);
var view = this.map.getView();
view.fit(boundingExtent, null);
//let source = this.vectorSource.getSource();
//source.clear();
//feature.setStyle(this.VectorAltStyles);
//source.addFeatures(feature);
Using ol.geom.Polygon.fromExtent and adding the result to the vector source doesn't seem to work. Please can someone shed some light on how to accomplish this?