Working with Openlayer 6, my map is working fine for the 40 layers on initial load. Against search functionality, I am trying to add a new layer on the map using the following code.
const createMarkersLayer = (val)=>{ const coordinates = val.map(r=>this.getResultCentreCoordinates(r)) const coordinatesList = coordinates.flat() const markers = new VectorLayer({ source:new VectorSource(), opacity:1, visible:true, zIndex:100, minZoom:3, minResolution: 0, maxResolution: 100, style: new Style({ image:new Icon({ src: require('@/mapmanagement/static/images/layers/result-marker.png'), opacity: 1, size:[200, 200], anchor: [0.5, 0.5], anchorXUnits: 'fraction', anchorYUnits: 'fraction', scale:1 }) }) }) // this.map.getLayers().insertAt(2, markers) this.map.addLayer(markers) for (let i = 0; i < coordinatesList.length; i++) { const marker = new Feature({ geometry: new Point(coordinatesList[i]) }) markers.getSource().addFeature(marker) }} } Problem:
Markers are not visible on min resolution. This last added layer does become visible on max zoom level of the map.