Skip To Content ArcGIS for Developers Sign In Dashboard

WmsLayer Class

class Esri::ArcGISRuntime::WmsLayer

Defines an Open Geospatial Consortium (OGC) Web Map Service (WMS) layer. More...

Header: #include <WmsLayer>
Since: Esri::ArcGISRuntime 100.2
Inherits: Esri::ArcGISRuntime::ImageAdjustmentLayer, Esri::ArcGISRuntime::RemoteResource, and Esri::ArcGISRuntime::TimeAware

This class was introduced in Esri::ArcGISRuntime 100.2.

Public Functions

WmsLayer(Esri::ArcGISRuntime::Item *item, QObject *parent = nullptr)
WmsLayer(const QList<Esri::ArcGISRuntime::WmsLayerInfo> &layerInfos, QObject *parent = nullptr)
WmsLayer(const QUrl &url, const QStringList &layerNames, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
WmsLayer(const QUrl &url, const QStringList &layerNames, QObject *parent = nullptr)
virtual ~WmsLayer() override
QMap<QString, QString> customParameters() const
QList<Esri::ArcGISRuntime::WmsLayerInfo> layerInfos() const
QStringList layerNames() const
Esri::ArcGISRuntime::MapServiceImageFormat preferredImageFormat() const
quint64 refreshInterval() const
void setCustomParameters(const QMap<QString, QString> &customParameters)
void setPreferredImageFormat(Esri::ArcGISRuntime::MapServiceImageFormat preferredImageFormat)
void setRefreshInterval(quint64 milliseconds)
QList<Esri::ArcGISRuntime::WmsSublayer *> subLayers() const
Esri::ArcGISRuntime::WmsVersion version() const

Reimplemented Public Functions

virtual Esri::ArcGISRuntime::Credential *credential() const override
virtual Esri::ArcGISRuntime::TimeExtent fullTimeExtent() const override
virtual bool isSupportsTimeFiltering() const override
virtual bool isTimeFilteringEnabled() const override
virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override
virtual void setTimeFilteringEnabled(bool timeFilteringEnabled) override
virtual void setTimeOffset(const Esri::ArcGISRuntime::TimeValue &timeOffset) override
virtual Esri::ArcGISRuntime::TimeValue timeInterval() const override
virtual Esri::ArcGISRuntime::TimeValue timeOffset() const override
virtual QUrl url() const override

Signals

Detailed Description

An instance of this class allows you to display data from a WMS service.

Web Map Service (WMS) is an Open Geospatial Consortium (OGC) standard for delivering map images from an online service. WmsLayer displays data from a web service that provides maps in the form of server-rendered images. ArcGIS Runtime supports WMS versions 1.1.0, 1.1.1, and 1.3.0. The service may be hosted in the cloud on ArcGIS Online, on a third party server, or on-premises with ArcGIS Server.

Functional characteristics

A WMS service can contain multiple layers in a hierarchy. WmsLayer can be constructed directly with a URL to a service and the uniquely identifying name of the desired layer. Alternatively, a WmsService can be used to programmatically explore the available layers and allow the user to choose layers at run time.

The maps provided by a WMS service use predefined symbology defined by the server. As a result, it is not possible to apply custom renderers or to visualize feature selection. A WmsLayer can have multiple style options. Your app can choose from the available styles.

Some layers can be marked as opaque, which means that they cover most of the map area and are good candidates for use as a basemap.

WmsLayer supports identify and time, but not selection or query. Note that due to the nature of WMS, it is not possible to retrieve feature geometry from WMS identify results. WmsLayer supports custom parameters, which can be specified for the service or an individual layer.

WmsLayer adopts the loadable pattern, and many of its properties are initialized asynchronously. The layer is loaded when displayed in a MapView or a SceneView. If using the layer without a MapView or a SceneView, call the load method to load it before use. Use the layer doneLoading signal to determine when the layer is ready, and check the loadStatus before using the layer.

Performance characteristics

WMS servers render map images on demand, which can require more server resources than a similar tiled service. WMS requires a service connection at all times.

See sample: WMS layer (URL)

See also Layer, WmsService, WmsServiceInfo, WmsLayerInfo, WmsSublayer, ImageAdjustmentLayer, and Loadable.

Member Function Documentation

WmsLayer::WmsLayer(Esri::ArcGISRuntime::Item *item, QObject *parent = nullptr)

Constructs a WmsLayer with the given WMS layer item (item) and an optional parent.

WmsLayer::WmsLayer(const QList<Esri::ArcGISRuntime::WmsLayerInfo> &layerInfos, QObject *parent = nullptr)

Constructor that accepts a list of layerInfos and an optional parent object.

  • layerInfos - A list of WmsLayerInfo objects obtained after loading a WmsService.
  • parent - The parent object for this WmsLayer (optional).

WmsLayer::WmsLayer(const QUrl &url, const QStringList &layerNames, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

Constructor that accepts a URL, a list of layer names, a credential, and an optional parent object.

  • url - The URL of the WMS service - see WmsService::url
  • layerNames - List of WMS layer names to display
  • credential - The Credential used to access this layer
  • parent - The parent object for this WmsLayer (optional)

ArcGIS Runtime supports WMS versions 1.3.0, 1.1.1, and 1.1.0. The latest supported WMS version is set as the default.

WmsLayer::WmsLayer(const QUrl &url, const QStringList &layerNames, QObject *parent = nullptr)

Constructor that accepts a URL, a list of layer names, and an optional parent object.

  • url - The URL of the WMS service - see WmsService::url
  • layerNames - List of WMS layer names to display
  • parent - The parent object for this WmsLayer (optional)

[signal] void WmsLayer::fullTimeExtentChanged()

Signal emitted when the fullTimeExtent changes.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also TimeAware.

[override virtual] WmsLayer::~WmsLayer()

Destructor.

[override virtual] Esri::ArcGISRuntime::Credential *WmsLayer::credential() const

Reimplements: RemoteResource::credential() const.

Returns the Credential to be used by the network resource in the event of an authentication challenge.

The default credential is a nullptr.

QMap<QString, QString> WmsLayer::customParameters() const

Returns the custom parameters that are applied to WMS requests related to this layer.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also setCustomParameters().

[override virtual] Esri::ArcGISRuntime::TimeExtent WmsLayer::fullTimeExtent() const

Reimplements: TimeAware::fullTimeExtent() const.

Returns the full time extent of the layer.

This function was introduced in Esri::ArcGISRuntime 100.3.

[override virtual] bool WmsLayer::isSupportsTimeFiltering() const

Reimplements: TimeAware::isSupportsTimeFiltering() const.

Returns whether the layer supports filtering its contents by time values.

This function was introduced in Esri::ArcGISRuntime 100.3.

[override virtual] bool WmsLayer::isTimeFilteringEnabled() const

Reimplements: TimeAware::isTimeFilteringEnabled() const.

Returns whether the layer participates in filtering based on the time extent of its GeoView.

This function was introduced in Esri::ArcGISRuntime 100.3.

QList<Esri::ArcGISRuntime::WmsLayerInfo> WmsLayer::layerInfos() const

Returns a list of WmsLayerInfo objects describing the selected WMS sublayers.

If the WmsLayer was initialized with url and layerNames, then the layerInfos will be empty until the layer has been loaded.

QStringList WmsLayer::layerNames() const

Returns a list of names of visible WMS layers.

Esri::ArcGISRuntime::MapServiceImageFormat WmsLayer::preferredImageFormat() const

Returns the preferred image format of this WMS layer.

If a preferred format is not specified prior to loading, then Png32 is used.

See also setPreferredImageFormat().

quint64 WmsLayer::refreshInterval() const

Returns the refresh interval used by the layer, in milliseconds.

Layers request data from the service each time this interval elapses. A value of 0 means to never refresh.

See also setRefreshInterval().

[override virtual] Esri::ArcGISRuntime::RequestConfiguration WmsLayer::requestConfiguration() const

Reimplements: RemoteResource::requestConfiguration() const.

Returns the RequestConfiguration in use by this layer.

See also setRequestConfiguration().

void WmsLayer::setCustomParameters(const QMap<QString, QString> &customParameters)

Sets the custom parameters that are applied to WMS requests related to this layer to customParameters.

customParameters is a map of strings where the key is the parameter's name and the value is the parameter's value.

When making a WMS request, only parameters required by the service are included by default. Setting custom parameters will allow you to specify any additional parameters, such as API keys or user credentials, to the service. These parameters will be appended to GetMap and GetFeatureInfo requests.

When used together with a WmsService, if a parameter with the same name is defined in the service's custom parameters, then layer-specific values will take precedence over service-wide parameter values.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also customParameters().

void WmsLayer::setPreferredImageFormat(Esri::ArcGISRuntime::MapServiceImageFormat preferredImageFormat)

Sets the preferred image format of this WMS layer to preferredImageFormat.

If a preferred format is not specified prior to loading, then Png32 is used.

This function was introduced in Esri::ArcGISRuntime 100.2.

See also preferredImageFormat().

void WmsLayer::setRefreshInterval(quint64 milliseconds)

Sets the refresh interval used by the layer to milliseconds.

Layers request data from the service each time this interval elapses. A value of 0 means to never refresh.

See also refreshInterval().

[override virtual] void WmsLayer::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration)

Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).

Sets requestConfiguration used for network requests sent by this layer.

See also requestConfiguration().

[override virtual] void WmsLayer::setTimeFilteringEnabled(bool timeFilteringEnabled)

Reimplements: TimeAware::setTimeFilteringEnabled(bool timeFilteringEnabled).

Sets whether the layer uses the time range defined on the GeoView to timeFilteringEnabled.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also isTimeFilteringEnabled().

[override virtual] void WmsLayer::setTimeOffset(const Esri::ArcGISRuntime::TimeValue &timeOffset)

Reimplements: TimeAware::setTimeOffset(const Esri::ArcGISRuntime::TimeValue &timeOffset).

Sets the time offset of the layer to timeOffset.

The time offset is subtracted from the time extent set on the layer's GeoView. This can be used to overlay data from different periods of time for comparison.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also timeOffset().

QList<Esri::ArcGISRuntime::WmsSublayer *> WmsLayer::subLayers() const

Returns a list of sublayers for this WMS layer.

[override virtual] Esri::ArcGISRuntime::TimeValue WmsLayer::timeInterval() const

Reimplements: TimeAware::timeInterval() const.

Returns a time interval that represents the suggested step size for use when manipulating the time extent.

This information can be used to set the step size for a time slider control.

This function was introduced in Esri::ArcGISRuntime 100.3.

[override virtual] Esri::ArcGISRuntime::TimeValue WmsLayer::timeOffset() const

Reimplements: TimeAware::timeOffset() const.

Returns the applied time offset.

This function was introduced in Esri::ArcGISRuntime 100.3.

See also setTimeOffset().

[override virtual] QUrl WmsLayer::url() const

Reimplements: RemoteResource::url() const.

Returns the URL of the WMS layer.

Esri::ArcGISRuntime::WmsVersion WmsLayer::version() const

Returns the version of this WMS layer.


Feedback on this topic?