Mapsui Using Time-Enabled WMS - updating extraParams with DispatcherTimer

87 views Asked by At

I am trying to update the TIME param in my WmsProvider Extraparams every 10 seconds with a dispatch timer.

private async void DispatcherTimer_Tick(object? sender, EventArgs e)
{
    var wmsLayer = mapControl.Map?.Layers[1] as ImageLayer;
    var source = wmsLayer.DataSource as WmsProvider;
    source.ExtraParams["TIME"] = GetFormattedDateTime(1);;
}

However, this does not form a new request to the WMS when the parameter is updated. What is the correct way to update the param and force a new request to update the layer? I am trying to achieve something similar to OpenLayers updateParams as can be seen here.

1

There are 1 answers

0
pauldendulk On BEST ANSWER

Setting the new parameter could be seen as a configuration change. If you want to see the result of that change you have to trigger a data refresh. In your example code you could do this by adding a line like this:

wmsLayer.DataHasChanged()