I am updating from OpenLayers 3.15.0 to 6.3.1. When I call map.addLayer, I get the following error:
Uncaught TypeError: Cannot read property 'ol_uid' of undefined @
ecb://web/java/ol.js:1:23754
Here is the context of where it is called:
function getMinZoom() {
var width = map.clientWidth;
return Math.ceil(Math.LOG2E * Math.log(width / 256));
}
//create wms layer
function addWMSLayer(url, attTxt, attHref, layer, format, server, res1, res2, res3, res4) {
initializeMap();
//tile source for load wms layers
var newRes1 = Number(getCalcResolutionSrv(res1));
var newRes2 = Number(getCalcResolutionSrv(res2));
var newRes3 = Number(getCalcResolutionSrv(res3));
var newRes4 = Number(getCalcResolutionSrv(res4));
var newWMSSource = new ol.source.TileWMS({
url: url,
params: {
'LAYERS': layer,
'FORMAT': format,
},
serverType: 'mapserver',
projection: projection
});
var minZoom = getMinZoom();
var newWmsLayer = new ol.layer.Tile({
extent: extent,
source: newWMSSource,
minResolution: newRes4,
maxResolution: newRes1,
zIndex: 0,
minZoom: minZoom
});
wmsResolution.push(Number(newRes1 - 0.00100));
wmsResolution.push(newRes2);
wmsResolution.push(newRes3);
wmsResolution.push(Number(newRes4 + 0.00100));
map.addLayer(newWmsLayer);
ECBJS.addNewWMSLayer(url, layer, newRes1, newRes2, newRes3, newRes4);
};
The function is identical from the one used to call addLayer with 3.15.0 except the properties zIndex and minZoom. In 3.15.0 it was working.
What could be the problem?
Update
I created a MinimalExample solution based on the MinimalExample of CefSharp. You need Visual Studio or Rider to open it. https://github.com/tbremeyer/CefSharp.MinimalExample.git
Currently the call to EvaluateScriptAsync in the function CallWebSite in MainWindows.xaml.cs returns with
Message = "Uncaught TypeError: Cannot read property 'ol_uid' of
undefined @ ecb://web/java/ol.js:1:23754"
Success = false
I would expect it to return with
Message = ""
Success = true