I have a vectorlayer in my map and would like to change the style of features when the zoom level changes. Is this possible?
var vlayer = new ol.layer.VectorTile({
renderMode: 'vector',
preload: Infinity,
source: new ol.source.VectorTile({
attributions: '© <a href="https://www.openstreetmap.org/copyright">' + 'OpenStreetMap contributors</a>',
format: new ol.format.MVT(),
tileGrid: new ol.tilegrid.TileGrid({
extent: ol.proj.get('EPSG:3857').getExtent(),
resolutions: resolutions
}),
tilePixelRatio: 16,
tileUrlFunction: tileUrlFunction,
projection: 'EPSG:3857'
})
, style: stylefunction()
});
var map = new ol.Map({
target: 'map',
layers: [
vlayer
],
view: new ol.View({
center: [0,0],
zoom: 15
})
});