Hi, I’m trying to use a WMS with the time parameter. However, when I move the timeline, there doesn’t seem to be any requests to the WMS server to update the layer, which changes based on time. I can’t figure out why.
If it’s possible to reproduce a minimal example of what you’re seeing in a sandcastle, that would help me investigate your issue.
But given what you said, I would want to know how you expect the timeline change to trigger requests to your server. Have you set up some sort of callback on the timeline changing?
Are you seeing requests send from the client and not reach the server? Or are no requests sent at all?
Best,
Matt
Thanks, Matt, for your reply.
I don’t see the calls in the network tab.
Basically, if I scroll the timeline, I don’t see any calls; if I pan or zoom, I see the calls to the server. I configured the intervals as reported in the Dimension field of the layer obtained from GetCapabilities. To be fair, I saw it work once; it made requests every 5 minutes because PT5M was in the interval. But many times it doesn’t work for me, and I don’t understand why.
Regards,
Benito
Let’s back up - when you say “scroll the timeline”, are you referring to this Cesium UI widget:
Are you following some guide or documentation for this? I’m not sure why we would expect any server calls to be made when scrolling the timeline, unless you registered a callback or something to do so (I’m just speculating, I’m not actually sure if we expose a hook to register a callback).
It would really help if you could provide a minimal reproduction of your setup (even a code sample with a dummy WMS URL, just so I can see what you’re doing); I’m having a hard time understanding what Cesium constructs you’re using and how. (Like, are you using Cesium.WebMapServiceImageryProvider?)
Thanks,
Matt
Thanks, Matt, for your support.
I’m using the widget you mentioned.
I tried following some examples I found online.
Here’s an excerpt of the method we’re implementing to add WMS layers to an application.
private addWmsLayer(layer: ILayer): Cesium.ImageryLayer | undefined {
…
…
let cesiumLayer: Cesium.ImageryLayer | undefined = undefined;
const times = Cesium.TimeIntervalCollection.fromIso8601({
iso8601: “1995-01-01/2025-12-31/PT5M”,
leadingInterval: true,
trailingInterval: true,
isStopIncluded: true, // We want stop time to be part of the trailing interval
dataCallback: function dataCallback(interval, index) {
return { Time: Cesium.JulianDate.toIso8601(interval.start) }
}
});
const start = Cesium.JulianDate.fromIso8601(“1995-01-01”);
const stop = Cesium.JulianDate.fromIso8601(“2025-12-31”);
viewer.clock.currentTime = start;
viewer.clock.startTime = start;
viewer.clock.stopTime = stop;
viewer.timeline.zoomTo(start, stop);
const provider = new Cesium.WebMapServiceImageryProvider({
url: “https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi”,
layers: “nexrad-n0r-wmst”,
parameters: parameters,
getFeatureInfoParameters: {
service_id: layer2.service_id
},
enablePickFeatures: true,
clock:viewer.clock,
times: times
});
cesiumLayer = new Cesium.ImageryLayer(provider, {
show: show
})
viewer.imageryLayers.add(cesiumLayer);
…
…
}
What I expected was that once connected, a call would be made to the server every 5 minutes to update the layer, which may vary between these intervals. If the behavior is different, perhaps I’m misunderstanding the use of the time dimension in the WMS service.
Thanks in advance.
Best regards
Benito
Strangely, I put this on the WMTS Time sandcastle example and everything works.
I really don’t understand.
const times = Cesium.TimeIntervalCollection.fromIso8601({
iso8601: "1995-01-01/2025-12-31/PT5M",
leadingInterval: true,
trailingInterval: true,
isStopIncluded: true, // We want stop time to be part of the trailing interval
dataCallback: function dataCallback(interval, index) {
return { Time: Cesium.JulianDate.toIso8601(interval.start) }
}
});
// Add a WMTS imagery layer.
// This comes from NASA’s GIBS API.
// See Earthdata Login
const provider = new Cesium.WebMapServiceImageryProvider({
url: " https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi ",
layers: "nexrad-n0r-wmst",
enablePickFeatures: true,
clock: viewer.clock,
times: times
});
const layer = new Cesium.ImageryLayer(provider);
// Make the weather layer semi-transparent to see the underlying geography.
layer.alpha = 0.5;
viewer.imageryLayers.add(layer);
const start = Cesium.JulianDate.fromIso8601("1995-01-01");
const stop = Cesium.JulianDate.fromIso8601("2025-12-31");
viewer.clock.currentTime = start;
viewer.clock.startTime = start;
viewer.clock.stopTime = stop;
viewer.timeline.zoomTo(start, stop);
const clock = viewer.clock;
clock.startTime = start;
clock.stopTime = stop;
clock.currentTime = start;
clock.clockRange = Cesium.ClockRange.LOOP_STOP;
clock.multiplier = 60;
I may have found the problem.
My procedure is declared async;
when I enable the visualization, Cesium hasn’t completed building the layer; if I disable the visualization and re-enable it after a few seconds, it seems to work.
I need to implement the call synchronously.
I’ll update you after this change.
Benito
