Search Results for

    Show / Hide Table of Contents

    Class WmsProvider

    Web Map Service layer

    Inheritance
    object
    WmsProvider
    Implements
    IProjectingProvider
    IProvider
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Mapsui.Providers.Wms
    Assembly: Mapsui.dll
    Syntax
    public class WmsProvider : 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 necessary 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

    | Edit this page View Source

    WmsProvider(XmlDocument, Func<string, Task<Stream>>?, IUrlPersistentCache?)

    Declaration
    public WmsProvider(XmlDocument capabilities, Func<string, Task<Stream>>? getStreamAsync = null, IUrlPersistentCache? persistentCache = null)
    Parameters
    Type Name Description
    XmlDocument capabilities
    Func<string, Task<Stream>> getStreamAsync
    IUrlPersistentCache persistentCache

    Properties

    | Edit this page View Source

    AxisOrder

    Gets or sets a value indicating the axis order

    Declaration
    public int[] AxisOrder { get; set; }
    Property Value
    Type Description
    int[]
    Remarks

    The axis order is an array of array offsets. It can be either {0, 1} or {1, 0}.

    If not set explictly, CrsAxisOrderRegistry is asked for a value based on SRID.
    | Edit this page View Source

    CRS

    The spatial reference ID (CRS)

    Declaration
    public string? CRS { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    ContinueOnError

    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
    bool
    | Edit this page View Source

    Credentials

    Provides the base authentication interface for retrieving credentials for Web client authentication.

    Declaration
    public ICredentials? Credentials { get; set; }
    Property Value
    Type Description
    ICredentials
    | Edit this page View Source

    DefaultCache

    Declaration
    public static IUrlPersistentCache? DefaultCache { get; set; }
    Property Value
    Type Description
    IUrlPersistentCache
    | Edit this page View Source

    ExtraParams

    Declaration
    public Dictionary<string, string>? ExtraParams { get; set; }
    Property Value
    Type Description
    Dictionary<string, string>
    | Edit this page View Source

    GetFeatureInfoFormats

    Gets the list of available FeatureInfo Output Format

    Declaration
    public Collection<string> GetFeatureInfoFormats { get; }
    Property Value
    Type Description
    Collection<string>
    | Edit this page View Source

    LayerList

    Gets the list of enabled layers

    Declaration
    public Collection<string>? LayerList { get; }
    Property Value
    Type Description
    Collection<string>
    | Edit this page View Source

    OutputFormats

    Gets the list of available formats

    Declaration
    public Collection<string> OutputFormats { get; }
    Property Value
    Type Description
    Collection<string>
    | Edit this page View Source

    RootLayer

    Gets the hierarchical list of available WMS layers from this service

    Declaration
    public Client.WmsServerLayer? RootLayer { get; }
    Property Value
    Type Description
    Client.WmsServerLayer?
    | Edit this page View Source

    ServiceDescription

    Gets the service description from this server

    Declaration
    public Capabilities.WmsServiceDescription? ServiceDescription { get; }
    Property Value
    Type Description
    Capabilities.WmsServiceDescription?
    | Edit this page View Source

    StylesList

    Gets the list of enabled styles

    Declaration
    public Collection<string>? StylesList { get; }
    Property Value
    Type Description
    Collection<string>
    | Edit this page View Source

    TimeOut

    Timeout of web request in milliseconds. Defaults to 10 seconds

    Declaration
    public int TimeOut { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Transparent

    If it should set the Wms Image to Transparent

    Declaration
    public bool? Transparent { get; set; }
    Property Value
    Type Description
    bool?
    | Edit this page View Source

    UserAgent

    Declaration
    public string? UserAgent { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Version

    Gets the WMS Server version of this service

    Declaration
    public string? Version { get; }
    Property Value
    Type Description
    string

    Methods

    | Edit this page View Source

    AddLayer(string)

    Adds a layer to WMS request

    Declaration
    public void AddLayer(string name)
    Parameters
    Type Name Description
    string name

    Name of layer

    Remarks

    Layer names are case sensitive.

    Exceptions
    Type Condition
    ArgumentException

    Throws an exception is an unknown layer is added

    | Edit this page View Source

    AddStyle(string)

    Adds a style to the style collection

    Declaration
    public void AddStyle(string name)
    Parameters
    Type Name Description
    string name

    Name of style

    Exceptions
    Type Condition
    ArgumentException

    Throws an exception is an unknown layer is added

    | Edit this page View Source

    CreateAsync(string, string?, Func<string, Task<Stream>>?, IUrlPersistentCache?, string?)

    Initializes a new layer, and downloads and parses the service description

    Declaration
    public static Task<WmsProvider> CreateAsync(string url, string? wmsVersion = null, Func<string, Task<Stream>>? getStreamAsync = null, IUrlPersistentCache? persistentCache = null, string? userAgent = null)
    Parameters
    Type Name Description
    string url

    Url of WMS server

    string wmsVersion

    Version number of wms leave null to get the default service version

    Func<string, Task<Stream>> getStreamAsync

    Download method, leave null for default

    IUrlPersistentCache persistentCache
    string userAgent

    user Agent

    Returns
    Type Description
    Task<WmsProvider>
    | Edit this page View Source

    GetExtent()

    MRect of data set

    Declaration
    public MRect? GetExtent()
    Returns
    Type Description
    MRect

    BoundingBox

    | Edit this page View Source

    GetFeaturesAsync(FetchInfo)

    Declaration
    public Task<IEnumerable<IFeature>> GetFeaturesAsync(FetchInfo fetchInfo)
    Parameters
    Type Name Description
    FetchInfo fetchInfo
    Returns
    Type Description
    Task<IEnumerable<IFeature>>
    | Edit this page View Source

    GetLayer(string)

    Get a layer from the WMS

    Declaration
    public Client.WmsServerLayer GetLayer(string name)
    Parameters
    Type Name Description
    string name

    Name of layer

    Returns
    Type Description
    Client.WmsServerLayer
    Remarks

    Layer names are case sensitive.

    Exceptions
    Type Condition
    ArgumentException

    Throws an exception if the layer is not found

    | Edit this page View Source

    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<string>

    URL for WMS request

    | Edit this page View Source

    GetLegendsAsync()

    Declaration
    public IAsyncEnumerable<MemoryStream> GetLegendsAsync()
    Returns
    Type Description
    IAsyncEnumerable<MemoryStream>
    | Edit this page View Source

    GetRequestUrl(MRect?, int, int)

    Gets the URL for a map request base on current settings, the image size and BoundingBox

    Declaration
    public string GetRequestUrl(MRect? box, int width, int height)
    Parameters
    Type Name Description
    MRect box
    int width
    int height
    Returns
    Type Description
    string

    URL for WMS request

    | Edit this page View Source

    IsCrsSupported(string)

    Queries whether a provider supports projection to a certain CRS.

    Declaration
    public bool? IsCrsSupported(string crs)
    Parameters
    Type Name Description
    string crs

    The crs to project to

    Returns
    Type Description
    bool?

    True if is does, false if it does not, null if it is unknown

    | Edit this page View Source

    RemoveAllLayers()

    Removes all layers

    Declaration
    public void RemoveAllLayers()
    | Edit this page View Source

    RemoveAllStyles()

    Removes all styles from the list

    Declaration
    public void RemoveAllStyles()
    | Edit this page View Source

    RemoveLayer(string)

    Removes a layer from the layer list

    Declaration
    public void RemoveLayer(string name)
    Parameters
    Type Name Description
    string name

    Name of layer to remove

    | Edit this page View Source

    RemoveLayerAt(int)

    Removes the layer at the specified index

    Declaration
    public void RemoveLayerAt(int index)
    Parameters
    Type Name Description
    int index
    | Edit this page View Source

    RemoveStyle(string)

    Removes a style from the collection

    Declaration
    public void RemoveStyle(string name)
    Parameters
    Type Name Description
    string name

    Name of style

    | Edit this page View Source

    RemoveStyleAt(int)

    Removes a style at specified index

    Declaration
    public void RemoveStyleAt(int index)
    Parameters
    Type Name Description
    int index

    Index

    | Edit this page View Source

    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
    string mimeType

    Mime type of image format

    Remarks

    See the OutputFormats property for a list of available mime types supported by the WMS server

    Exceptions
    Type Condition
    ArgumentException

    Throws an exception if either the mime type isn't offered by the WMS or GDI+ doesn't support this mime type.

    | Edit this page View Source

    TryGetMapAsync(MSection)

    Declaration
    public Task<(bool Success, MRaster?)> TryGetMapAsync(MSection section)
    Parameters
    Type Name Description
    MSection section
    Returns
    Type Description
    Task<(bool Success, MRaster)>

    Implements

    IProjectingProvider
    IProvider
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX