I've got a WMS Layer which contains many different images at different times. I'm able to display in Openlayers the images from a single time period if I specify a "time" parameter in params. I've seen it's possible to change the wms time automatically if you have a list of time values but was wondering if it was possible to take the time steps from the wms.
The time steps are all displayed in a WMS GetCapabilities request as well if that helps. Below is the javascript I have so far used in the OpenLayers call:
import Map from 'ol/Map.js';
import View from 'ol/View.js';
import TileLayer from 'ol/layer/Tile.js';
import ImageLayer from 'ol/layer/Image.js';
import OSM from 'ol/source/OSM.js';
import TileWMS from 'ol/source/TileWMS.js';
import ImageWMS from 'ol/source/ImageWMS.js';
var base_layer = new TileLayer({
source: new OSM()
});
var dc_wms = new TileLayer({
source: new TileWMS({
url: 'http://localhost:5000/',
params: {
'LAYERS': '10DayIndices',
'STYLE': 'ndvi',
time: '2019-06-20'
}
})
});
var map = new Map({
layers: [base_layer, dc_wms],
target: 'map',
view: new View({
projection: 'EPSG:4326',
center: [102.376126,48.031532],
zoom: 6
})
});
I can also provide more info on the GetCapabilities request (the time is in format ISO:8601) if that would help.