Passing in a TIME parameter to a Time aware WMS Provider using Mapsui

59 views Asked by At

I'm trying to add additional params when creating the WmsProivder using Mapsui. I read in the documentation that at the moment Mapsui doesn't automatically fetch the ServiceDescription, so you have to add the additional parameters to the URL. However when I try that I always get a "Service tag not found" error.

 private static async Task<WmsProvider> CreateWmsProviderAsync()
 {
     var wmsUrl = "https://mapservices.weather.noaa.gov/eventdriven/services/radar/radar_base_reflectivity_time/ImageServer/WMSServer?SERVICE=WMS&TIME=";
     wmsUrl = wmsUrl + DateTime.Now.AddHours(-12).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
     var provider = await WmsProvider.CreateAsync(wmsUrl);
     provider.ContinueOnError = true;
     provider.TimeOut = 20000;   
     provider.CRS = "EPSG:3857";
     provider.AddLayer("0");
     provider.SetImageFormat(provider.OutputFormats[1]);
     return provider;
 }

What is the proper way to achieve this?

The link to the WMS GetCapabilities document is here.

1

There are 1 answers

5
pauldendulk On BEST ANSWER

The WmsProvider has an ExtraParams field, which is a dictionary, the key/value pairs will be added as extra parameters to the request.

The url you specify is the root of the WMS service which should not be changed to add parameters.