Skip to content

WmsOverlay

Namespace: ThinkGeo.Core

Represents an overlay object that gets map images from the WMS server you specify.

public class WmsOverlay : TileOverlay, System.IDisposable, IWmsEntity

Inheritance Object → Overlay → TileOverlay → WmsOverlay
Implements IDisposable, IWmsEntity

Remarks:

The WmsOverlay gets images from one or more WMS servers that you specify. Usually, you add a WMS server URI to the ServerUris collection and the WmsOverlay will make a request to that WMS server to get its tile images.

You can also add multiple WMS server URIs to the ServerUris collection. The WmsOverlay will randomly send requests to those WMS servers in a concurrent fashion. This means that the tile images can come from different WMS servers, thus greatly enhancing performance. Do not add URIs of differently-configured WMS servers to the ServerUris collection.

Properties

Parameters

Gets a dictionary whose items will be passed to the WMS server as parameters.

public Dictionary<string, string> Parameters { get; }

Property Value

Dictionary<String, String>
A dictionary whose items will be passed to the WMS server as parameters.

IsTransparent

public bool IsTransparent { get; set; }

Property Value

Boolean

Uri

Gets or Set a URI that specifies the location of the WMS server.

public Uri Uri { get; set; }

Property Value

Uri

Version

This property gets the version.

public string Version { get; }

Property Value

String

Exceptions

This property indicates the format in which the client wishes to be notified of service exceptions.

public string Exceptions { get; set; }

Property Value

String

Remarks:

Upon receiving a request that is invalid according to the OGC standard, the server shall issue a service exception report. The service report is meant to describe to the client application or its human user the reason(s) that the request is invalid.

CapabilitiesCacheTimeout

public TimeSpan CapabilitiesCacheTimeout { get; set; }

Property Value

TimeSpan

ActiveLayerNames

This property represents the available layers that can be requested from the client and shown on the map.

public Collection<string> ActiveLayerNames { get; }

Property Value

Collection<String>

Remarks:

When requesting a map, a client may specify the layers to be shown on the map.

ActiveStyleNames

This property represents the available styles that can be requested from the client and shown on the map.

public Collection<string> ActiveStyleNames { get; }

Property Value

Collection<String>

Remarks:

When requesting a map, a client may specify the styles to be shown on the map.

OutputFormat

This property gets or sets the desired output format for the map requested from the WMS.

public string OutputFormat { get; set; }

Property Value

String

Remarks:

When requesting a map, a client may specify the output format in which to show the map. Format are specified as MIME types such as "image/gif" or "image/png".

WebProxy

This property gets or sets the proxy used for requesting a Web Response.

public IWebProxy WebProxy { get; set; }

Property Value

IWebProxy

UserAgent

This property allows you to specify a custom user-agent request header when making requests to a Web Map Service (WMS) server. This header provides information about the client application or device and can be useful for server-side logging and analytics.

public string UserAgent { get; set; }

Property Value

String

TimeoutInSeconds

Gets or sets the length of time, in seconds, before the request times out.

public int TimeoutInSeconds { get; set; }

Property Value

Int32

AxisOrder

This property specifies the order in which the coordinate axes are arranged when making requests to a Web Map Service (WMS) server. It is used to define the spatial reference system for the layer.

public WmsAxisOrder AxisOrder { get; set; }

Property Value

WmsAxisOrder

Projection

Gets or sets a string that will be sent to the WMS server to get the images in the specific projection. This property is the same as Crs.

public string Projection { get; set; }

Property Value

String
A string that represents the projection that the images use.

Credentials

This property gets or sets the base authentication interface for retrieving credentials for Web Client authentication.

public ICredentials Credentials { get; set; }

Property Value

ICredentials

Crs

This property gets or sets the projected or geographic coordinate reference system to be used.

public string Crs { get; set; }

Property Value

String

FastMode

This property gets or sets whether request and parse capabilities.

public bool FastMode { get; set; }

Property Value

Boolean

ImageFormat

Gets and sets drawing format for the tiles.

public GeoImageFormat ImageFormat { get; set; }

Property Value

GeoImageFormat

JpegQuality

Gets or sets the image quality when the TileImageFormat is Jpeg; otherwise this property has no effects. Its default value is 80.

public int JpegQuality { get; set; }

Property Value

Int32

IsCacheOnly

Gets or sets a value indicating whether this instance is cache only.

public bool IsCacheOnly { get; set; }

Property Value

Boolean
true if this instance is cache only; otherwise, false.

Opacity

public double Opacity { get; set; }

Property Value

Double

IsVisible

Gets or sets if this overlay is visible.

public bool IsVisible { get; set; }

Property Value

Boolean

DrawingQuality

public DrawingQuality DrawingQuality { get; set; }

Property Value

DrawingQuality

TileSizeMode

Gets or sets the tile size mode.

public TileSizeMode TileSizeMode { get; set; }

Property Value

TileSizeMode

        The tile size mode.

TileType

Gets and sets the overlay is formed by multiple tiles or single tile.

public TileType TileType { get; set; }

Property Value

TileType

TileWidth

Gets and sets the width of the tile.

public int TileWidth { get; set; }

Property Value

Int32

TileHeight

Gets and sets the height of the tile.

public int TileHeight { get; set; }

Property Value

Int32

TileCache

Gets and sets a tile cache object for saving the tiles.

public RasterTileCache TileCache { get; set; }

Property Value

RasterTileCache

TileSnappingMode

Gets or sets the tileView snapping mode.

public TileSnappingMode TileSnappingMode { get; set; }

Property Value

TileSnappingMode

TileBuffer

This property gets and sets the number of extra rows and colums of tiles on each side which will surround the minimum grid tiles to cover the map.

public int TileBuffer { get; set; }

Property Value

Int32

MaxExtent

This property gets or sets the max extent of matrix to calculate the tiles.

public RectangleShape MaxExtent { get; set; }

Property Value

RectangleShape

Remarks:

By default, MaxExtent is null; the matrix is created depending on the GeographyUnit of current map. When it's DecimalDegree, the matrix' is calculated as (-180, 90, 180, -90) as MaxExtent. While it's not DecimalDegree, the matrix is (-20037508.2314698, 20037508.2314698, 20037508.2314698, -20037508.2314698); It's allowed to modify it to customize the matrix.

WrappingMode

Thie property gets or sets whether allow wrap date line.

public WrappingMode WrappingMode { get; set; }

Property Value

WrappingMode

WrappingExtent

public RectangleShape WrappingExtent { get; set; }

Property Value

RectangleShape

CanRefreshRegion

public bool CanRefreshRegion { get; protected set; }

Property Value

Boolean

IsBase

public bool IsBase { get; set; }

Property Value

Boolean

Name

Gets or sets the name of this overaly.

public string Name { get; set; }

Property Value

String

MapArguments

Gets or sets current map information which will be used for calculating mechanism.

public MapArguments MapArguments { get; set; }

Property Value

MapArguments

OverlayCanvas

Gets or sets the actual canvas which maintains all the visual elements on the overlay.

public Canvas OverlayCanvas { get; set; }

Property Value

Canvas

DrawingExceptionMode

This property gets and sets the DrawingExceptionMode used when an exception occurs during drawing.

public DrawingExceptionMode DrawingExceptionMode { get; set; }

Property Value

DrawingExceptionMode

Attribution

public string Attribution { get; set; }

Property Value

String

IsEmpty

This property gets if this overlay is empty or not.

public bool IsEmpty { get; }

Property Value

Boolean

Remarks:

This property enhances the performance of the overlay while drawing. If is true, we will skip drawing this overlay and continue drawing the next overlay.

AutoRefreshInterval

public TimeSpan AutoRefreshInterval { get; set; }

Property Value

TimeSpan

Constructors

WmsOverlay()

Constructor of WmsOverlay class.

public WmsOverlay()

WmsOverlay(Uri)

Constructor of WmsOverlay class.

public WmsOverlay(Uri uri)

Parameters

uri Uri
This parameter indicates a uri for the Wms server.

WmsOverlay(Uri, String, WmsAxisOrder)

This is the constructor the for the class.

public WmsOverlay(Uri uri, string crs, WmsAxisOrder axisOrder)

Parameters

uri Uri
URI of the WMS server.

crs String
the projected or geographic coordinate reference system to be used.

axisOrder WmsAxisOrder
the axis order of the layer

Remarks:

This constructor initializes a new wms overlay, then downloads and parses the service description. In an ASP.NET application, the service description is automatically cached for 24 hours when it is not specified.

WmsOverlay(Uri, String, WmsAxisOrder, String)

This is the constructor the for the class.

public WmsOverlay(Uri uri, string crs, WmsAxisOrder axisOrder, string version)

Parameters

uri Uri
URI of the WMS server.

crs String
The projected or geographic coordinate reference system to be used.

axisOrder WmsAxisOrder
The axis order of the overlay.

version String
The version of the WMS server.

Remarks:

This constructor initializes a new wms overlay with fast mode, it won't request and parse capabilities.

WmsOverlay(Uri, IWebProxy, String, WmsAxisOrder, String, Boolean)

Constructor of WmsOverlay class.

public WmsOverlay(Uri uri, IWebProxy webProxy, string crs, WmsAxisOrder axisOrder, string version, bool fastMode)

Parameters

uri Uri
URI of the WMS server.

webProxy IWebProxy
This parameter indicates the web proxy of the request

crs String
The projected or geographic coordinate reference system to be used.

axisOrder WmsAxisOrder
The axis order of the layer.

version String
The version of the WMS server, this only works when fastMode is true.

fastMode Boolean
Whether request and parse capabilities

Methods

CloseAsyncCore()

protected Task CloseAsyncCore()

Returns

Task

OpenAsyncCore()

protected Task OpenAsyncCore()

Returns

Task

GetBoundingBoxCore()

protected RectangleShape GetBoundingBoxCore()

Returns

RectangleShape

GetServerLayers()

This method returns all layers at the server side.

public Collection<WmsServerLayer> GetServerLayers()

Returns

Collection<WmsServerLayer>
This method returns all layers at the server side.

Remarks:

None.

GetServerStyleNames()

This method returns the names of all styles at the server side.

public Collection<string> GetServerStyleNames()

Returns

Collection<String>
This method returns the names of all styles at the server side.

Remarks:

None.

GetServerOutputFormats()

This method returns the output format at the server side.

public Collection<string> GetServerOutputFormats()

Returns

Collection<String>
This method returns the output format at the server side.

Remarks:

None.

GetServerCrsCollection()

This method returns the projected or geographic coordinate reference systems to be used.

public Collection<string> GetServerCrsCollection()

Returns

Collection<String>

GetServerExceptionFormats()

This method returns the exception format at the server side.

public Collection<string> GetServerExceptionFormats()

Returns

Collection<String>
This method returns the exception format at the server side.

Remarks:

None.

GetServiceVersion()

This API gets the WMS server version of the service.

public string GetServiceVersion()

Returns

String
Returning a string reflecting the version of the service in WMS.

GetServerFeatureInfoFormats()

This API gets the WMS server FeatureInfo formats of the service.

public Collection<string> GetServerFeatureInfoFormats()

Returns

Collection<String>
This API returns the FeatureInfo formats supported on the server-side.

GetServerCapabilitiesXml()

This API gets the GetCapabilities document of the service.

public string GetServerCapabilitiesXml()

Returns

String
This API returns the GetCapabilities document of the service.

GetServiceBaseUrl()

This API gets the WMS base url of the service.

public string GetServiceBaseUrl()

Returns

String
Returns a string reflecting the WMS base url.

GetTileCore()

This method gets a specific tile object to form an overlay.

protected TileView GetTileCore()

Returns

TileView
A TileView object to form an overlay.

DrawTileAsyncCore(GeoCanvas, TileView)

protected Task DrawTileAsyncCore(GeoCanvas geoCanvas, TileView tile)

Parameters

geoCanvas GeoCanvas

tile TileView

Returns

Task

SaveStateCore()

This method saves overlay state to a byte array.

protected Byte[] SaveStateCore()

Returns

Byte[]
A byte array indicates current overlay state.

LoadStateCore(Byte[])

This method restore the overlay state back from the specified state.

protected void LoadStateCore(Byte[] state)

Parameters

state Byte[]
This parameter indicates the state for restore the overlay.

OnSendingHttpRequestMessage(SendingHttpRequestMessageEventArgs)

protected void OnSendingHttpRequestMessage(SendingHttpRequestMessageEventArgs e)

Parameters

e SendingHttpRequestMessageEventArgs

OnReceivedHttpResponseMessage(ReceivedHttpResponseMessageEventArgs)

protected void OnReceivedHttpResponseMessage(ReceivedHttpResponseMessageEventArgs e)

Parameters

e ReceivedHttpResponseMessageEventArgs

Events

SendingHttpRequest

public event EventHandler<SendingHttpRequestMessageEventArgs> SendingHttpRequest;

ReceivedHttpResponse

public event EventHandler<ReceivedHttpResponseMessageEventArgs> ReceivedHttpResponse;

DrawTilesProgressChanged

This event raises when download progress is changed.

public event EventHandler<DrawTilesProgressChangedTileOverlayEventArgs> DrawTilesProgressChanged;

DrawingTile

This event raises before the tile is drawing.

public event EventHandler<DrawingTileTileOverlayEventArgs> DrawingTile;

DrawnTile

This event raises after the tile is drawn.

public event EventHandler<DrawnTileTileOverlayEventArgs> DrawnTile;

DrawingException

public event EventHandler<DrawingExceptionTileOverlayEventArgs> DrawingException;

DrawnException

public event EventHandler<DrawnExceptionTileOverlayEventArgs> DrawnException;

TileTypeChanged

public event EventHandler<TileTypeChangedTileOverlayEventArgs> TileTypeChanged;

TileTypeChanging

public event EventHandler<TileTypeChangingTileOverlayEventArgs> TileTypeChanging;

Drawing

This event raises before the overlay is drawing.

public event EventHandler<DrawingOverlayEventArgs> Drawing;

Drawn

This event raises after the overlay is drawn.

public event EventHandler<DrawnOverlayEventArgs> Drawn;

DrawingAttribution

public event EventHandler<DrawingAttributionOverlayEventArgs> DrawingAttribution;

DrawnAttribution

public event EventHandler<DrawnAttributionOverlayEventArgs> DrawnAttribution;

ThrowingException

public event EventHandler<ThrowingExceptionOverlayEventArgs> ThrowingException;