Class WmsProvider
Web Map Service layer
Inheritance
Namespace: Mapsui.Desktop.Wms
Assembly: Mapsui.Desktop.dll
Syntax
public class WmsProvider : object, IProjectingProvider, IProvider
Remarks
The WmsLayer is currently very basic and doesn't support automatic fetching of the WMS Service Description. Instead you would have to add the nessesary parameters to the URL, and the WmsLayer will set the remaining BoundingBox property and proper requests that changes between the requests. See the example below.
Constructors
| Improve this Doc View SourceWmsProvider(String, String, Func<String, Task<Stream>>)
Initializes a new layer, and downloads and parses the service description
Declaration
public WmsProvider(string url, string wmsVersion = null, Func<string, Task<Stream>> getStreamAsync = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | Url of WMS server |
System.String | wmsVersion | Version number of wms leave null to get the default service version |
Func<System.String, Task<Stream>> | getStreamAsync | Download method, leave null for default |
WmsProvider(XmlDocument, Func<String, Task<Stream>>)
Declaration
public WmsProvider(XmlDocument capabilities, Func<string, Task<Stream>> getStreamAsync = null)
Parameters
Type | Name | Description |
---|---|---|
XmlDocument | capabilities | |
Func<System.String, Task<Stream>> | getStreamAsync |
Properties
| Improve this Doc View SourceContinueOnError
Specifies whether to throw an exception if the Wms request failed, or to just skip rendering the layer
Declaration
public bool ContinueOnError { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Credentials
Provides the base authentication interface for retrieving credentials for Web client authentication.
Declaration
public ICredentials Credentials { get; set; }
Property Value
Type | Description |
---|---|
ICredentials |
CRS
Declaration
public string CRS { get; set; }
Property Value
Type | Description |
---|---|
System.String |
ExtraParams
Declaration
public Dictionary<string, string> ExtraParams { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<System.String, System.String> |
GetFeatureInfoFormats
Gets the list of available FeatureInfo Output Format
Declaration
public Collection<string> GetFeatureInfoFormats { get; }
Property Value
Type | Description |
---|---|
Collection<System.String> |
LayerList
Gets the list of enabled layers
Declaration
public Collection<string> LayerList { get; }
Property Value
Type | Description |
---|---|
Collection<System.String> |
OutputFormats
Gets the list of available formats
Declaration
public Collection<string> OutputFormats { get; }
Property Value
Type | Description |
---|---|
Collection<System.String> |
RootLayer
Gets the hiarchial list of available WMS layers from this service
Declaration
public Client.WmsServerLayer RootLayer { get; }
Property Value
Type | Description |
---|---|
Client.WmsServerLayer |
ServiceDescription
Gets the service description from this server
Declaration
public Capabilities.WmsServiceDescription ServiceDescription { get; }
Property Value
Type | Description |
---|---|
Capabilities.WmsServiceDescription |
StylesList
Gets the list of enabled styles
Declaration
public Collection<string> StylesList { get; }
Property Value
Type | Description |
---|---|
Collection<System.String> |
TimeOut
Timeout of webrequest in milliseconds. Defaults to 10 seconds
Declaration
public int TimeOut { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Version
Gets the WMS Server version of this service
Declaration
public string Version { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceAddLayer(String)
Adds a layer to WMS request
Declaration
public void AddLayer(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of layer |
Remarks
Layer names are case sensitive.
AddStyle(String)
Adds a style to the style collection
Declaration
public void AddStyle(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of style |
Dispose()
Declaration
public void Dispose()
GetExtents()
Declaration
public BoundingBox GetExtents()
Returns
Type | Description |
---|---|
BoundingBox |
GetFeaturesInView(BoundingBox, Double)
Declaration
public IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | |
System.Double | resolution |
Returns
Type | Description |
---|---|
IEnumerable<IFeature> |
GetLayer(String)
Get a layer from the WMS
Declaration
public Client.WmsServerLayer GetLayer(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of layer |
Returns
Type | Description |
---|---|
Client.WmsServerLayer |
Remarks
Layer names are case sensitive.
GetLegendRequestUrls()
Gets the URL for a map request base on current settings, the image size and boundingbox
Declaration
public IEnumerable<string> GetLegendRequestUrls()
Returns
Type | Description |
---|---|
IEnumerable<System.String> | URL for WMS request |
GetLegends()
Declaration
public IEnumerable<MemoryStream> GetLegends()
Returns
Type | Description |
---|---|
IEnumerable<MemoryStream> |
GetRequestUrl(BoundingBox, Int32, Int32)
Gets the URL for a map request base on current settings, the image size and boundingbox
Declaration
public string GetRequestUrl(BoundingBox box, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
BoundingBox | box | |
System.Int32 | width | |
System.Int32 | height |
Returns
Type | Description |
---|---|
System.String | URL for WMS request |
IsCrsSupported(String)
Declaration
public bool? IsCrsSupported(string crs)
Parameters
Type | Name | Description |
---|---|---|
System.String | crs |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> |
RemoveAllLayers()
Removes all layers
Declaration
public void RemoveAllLayers()
RemoveAllStyles()
Removes all styles from the list
Declaration
public void RemoveAllStyles()
RemoveLayer(String)
Removes a layer from the layer list
Declaration
public void RemoveLayer(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of layer to remove |
RemoveLayerAt(Int32)
Removes the layer at the specified index
Declaration
public void RemoveLayerAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
RemoveStyle(String)
Removes a style from the collection
Declaration
public void RemoveStyle(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of style |
RemoveStyleAt(Int32)
Removes a style at specified index
Declaration
public void RemoveStyleAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index |
SetImageFormat(String)
Sets the image type to use when requesting images from the WMS server
Declaration
public void SetImageFormat(string mimeType)
Parameters
Type | Name | Description |
---|---|---|
System.String | mimeType | Mime type of image format |
Remarks
See the OutputFormats property for a list of available mime types supported by the WMS server
TryGetMap(IViewport, ref IRaster)
Declaration
public bool TryGetMap(IViewport viewport, ref IRaster raster)
Parameters
Type | Name | Description |
---|---|---|
IViewport | viewport | |
IRaster | raster |
Returns
Type | Description |
---|---|
System.Boolean |