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的源代碼等)的任何引用。
我已經找到了解決方案,但是我將其發佈在這裏以供參考,以防將來有人遇到同樣的問題。
那麼,它到底是什麼?