I am working on modify function for an Openlayers project. I define a vector layer for modify objects. (line, polygon etc.) But then I take an error like below while adding vector layer to map object. Why am i getting this?
Error
Uncaught TypeError: layer.getLayerStatesArray is not a function
at ol-debug.js:17395
at ol.Collection.forEach (ol-debug.js:8289)
at ol.layer.Group.getLayerStatesArray (ol-debug.js:17394)
at ol.Map.ol.PluggableMap.renderFrame_ (ol-debug.js:18670)
at ol.Map.<anonymous> (ol-debug.js:17624)
Source Code (core)
init: function (Map) {
var self = this;
self.Map = Map;
self.VectorSource = new ol.source.Vector({ wrapX: false });
self.Map.olMap.addLayer(self.VectorSource);
self.initialized = true;
},
Source Code (UI)
var geo = (new ol.format.GeoJSON()).readFeatures(e, { featureProjection: 'EPSG:3857' })[0];
Max.Map.Draw.VectorSource.addFeature(geo);