0
,我想在我的OpenLayers创建一些多边形3的地图,但得到以下错误:Asse田:断言失败:坐标数组的长度应与步幅
AssertionError: Assertion failed: length of coordinate array should match stride
我使用的代码如下: :
var geometry = new ol.geom.Polygon([
[10.689697265625, -25.0927734375],
[34.595947265625, -20.1708984375],
[38.814697265625, -35.6396484375],
[13.502197265625, -39.1552734375],
[10.689697265625, -25.0927734375]
], "XY");
geometry.transform('EPSG:4326', 'EPSG:3857');
var vectorLayer = new ol.layer.Vector({
map: this.map,
source: new ol.source.Vector({
features: [new ol.Feature({
geometry: geometry
})]
})
});
我在努力寻找解决方案,并在互联网上找不到的错误本身(比的OpenLayers的源代码等)的任何引用。
我已经找到了解决方案,但是我将其发布在这里以供参考,以防将来有人遇到同样的问题。
那么,它到底是什么?