I'm trying to upgrade to the latest ol: 5.2. I'm getting an error in Group.js saying layer.getLayerStatesArray is not a function. I put some breakpoints and determined that the layer it's complaining about is an Image layer. I checked the uuid's of the layers to determine this. The line giving me the error is: layer.getLayerStatesArray(states); The app is an angular 5 app, which didn't give me issues in ol 4.6.5, so I'm hoping this is not the issue.
Group.js
LayerGroup.prototype.getLayerStatesArray = function getLayerStatesArray (opt_states) {
var states = opt_states !== undefined ? opt_states : [];
var pos = states.length;
this.getLayers().forEach(function(layer) {
==> layer.getLayerStatesArray(states);
});
This is how I'm constructing the image layer
this.blockLayer = new Image({
name: 'blockLayer',
source: new ImageWMS({
url: this.base,
params: '',
serverType: 'geoserver',
crossOrigin: null
})
});
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
It's not working for me either on OL 5.3.3.
Below there's a codesandbox reproducing the issue, created by copying the basic example at https://openlayers.org/en/latest/doc/tutorials/concepts.html
https://codesandbox.io/s/openlayer-layergetlayerstatesarray-is-not-a-function-dvqej
@mettjus the import in the example is wrong, it must be:
import TileLayer from 'ol/layer/Tile';
instead of:
import TileLayer from 'ol/source/Tile';
I was submitting the PR before finding out you had just made one and getting back here. Thanks! 馃憤
Most helpful comment
@mettjus the import in the example is wrong, it must be:
instead of: