我正在将代码从OpenLayers 3移动到OpenLayers 4 (typescript)
我有这段代码,它可以扩展我的范围,这样当地图加载时,我绘制的所有矢量形状都将可见。
angular.forEach(webMapValues.vectorFieldLayer, function (Field, key)
{
webMapValues.mapObj.addLayer(Field);
webMapValues.extent = Field.getSource().getExtent();
webMapValues.totalExtent = ol.extent.extend(webMapValues.extent,
webMapValues.totalExtent);
})在上面的"ol.extent.extend“中为我表演了魔法,而在OpenLayers 4 (typescript)中,我还找不到等同的东西吗?
任何帮助都是非常感谢的!
发布于 2019-03-14 19:36:32
我相信函数仍然存在,只是语法发生了变化:
import {extend} from 'ol/extent';
const largeExtent = extend(extent1, extent2);发布于 2020-07-29 18:12:25
我正在使用React,typescript和OL4,我发现这对我很有效
import extent from 'ol/extent';
const combinedExtent = extent.extend(<layer1>,<layer2>);https://stackoverflow.com/questions/55150645
复制相似问题