在 openlayers 3 应用程序中,我能够检索边界范围并适合视图。但是我现在想通过使用边界范围来创建一个特征/多边形。
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);
使用 ol.geom.Polygon.fromExtent 并将结果添加到矢量源似乎不起作用。请有人能说明如何做到这一点?