ArcGIS Runtime SDK for iOS: AGSWMSLayer Class Reference
ArcGIS Runtime SDK for iOS  100.15
AGSWMSLayer Class Reference

Description

Displays data from a WMS service.

The service may be hosted in the cloud on ArcGIS Online, on a third party server, or on-premises with ArcGIS Server.

Web Map Service (WMS) is an Open Geospatial Consortium (OGC) standard for delivering map images from an online service. WMS layer 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 ArcGIS Server.

Functional characteristics A WMS service can contain multiple layers in a hierarchy. A WMS layer can be constructed directly with a URL to a service and the uniquely identifying name of the desired layer. Alternatively, an AGSWMSService 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. WMS layers 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.

WMS layers support identify and time. They do not support selection or query. Note that due to the nature of WMS, it is not possible to retrieve feature geometry from WMS identify results. WMS layers support custom parameters, which can be specified for the service or an individual 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 also
AGSLayer, AGSImageAdjustmentLayer, AGSWMSSublayer, AGSWMSService, Sample: WMS layer (URL)
Since
100.2
Inheritance diagram for AGSWMSLayer:
AGSImageAdjustmentLayer <AGSRemoteResource> <AGSTimeAware> AGSLayer AGSLoadableBase <AGSLayerContent> AGSObject <AGSLoadable>

Instance Methods

(void) - cancelLoad
 
(void) - doCancelLoading
 
(void) - doStartLoading:
 
(id< AGSCancelable >) - fetchLegendInfosWithCompletion:
 
(instancetype) - initWithItem:
 
(instancetype) - initWithLayerInfos:
 
(instancetype) - initWithURL:layerNames:
 
(BOOL) - isEqualToLayer:
 
(BOOL) - isVisibleAtScale:
 
(void) - loadDidFinishWithError:
 
(void) - loadWithCompletion:
 
(void) - onLoadStatusChanged
 
(void) - retryLoadWithCompletion:
 

Class Methods

(instancetype) + WMSLayerWithItem:
 
(instancetype) + WMSLayerWithLayerInfos:
 
(instancetype) + WMSLayerWithURL:layerNames:
 

Properties

NSString * attribution
 
float brightness
 
BOOL canChangeVisibility
 
float contrast
 
AGSCredentialcredential
 
NSDictionary< NSString *, NSString * > * customParameters
 
AGSEnvelopefullExtent
 
AGSTimeExtentfullTimeExtent
 
float gamma
 
BOOL identifyEnabled
 
AGSItemitem
 
NSString * layerDescription
 
NSString * layerID
 
NSMutableArray< AGSWMSLayerInfo * > * layerInfos
 
NSMutableArray< NSString * > * layerNames
 
NSError * loadError
 
AGSLoadStatus loadStatus
 
double maxScale
 
double minScale
 
NSString * name
 
float opacity
 
AGSMapServiceImageFormat preferredImageFormat
 
NSTimeInterval refreshInterval
 
AGSRequestConfigurationrequestConfiguration
 
BOOL showInLegend
 
AGSSpatialReferencespatialReference
 
NSArray< id< AGSLayerContent > > * subLayerContents
 
void(^ subLayerContentsChangedHandler )(void)
 
NSMutableArray< AGSWMSSublayer * > * sublayers
 
BOOL supportsTimeFiltering
 
BOOL timeFilteringEnabled
 
AGSTimeValuetimeInterval
 
AGSTimeValuetimeOffset
 
NSURL * URL
 
AGSWMSVersion version
 
BOOL visible
 

Method Documentation

◆ cancelLoad

- (void) cancelLoad
requiredinherited

Cancels loading if it is in progress, otherwise it does nothing. This should be called carefully because other objects could be waiting for loadWithCompletion: or retryLoadWithCompletion: to complete and this will call them all back with the error of NSUserCancelledError

Since
100

◆ doCancelLoading

- (void) doCancelLoading

Never call this method directly. The framework calls this method on a background thread when cancelLoad (AGSLoadable-p) is called. It is meant to be overriden by subclasses. Subclasses should override this method to cancel loading their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly)) at the end passing in an error representing NSUserCancelledError.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ doStartLoading:

- (void) doStartLoading: (BOOL)  retrying

Never call this method directly. The framework calls this method on a background thread when loadWithCompletion: (AGSLoadable-p) or retryLoadWithCompletion: (AGSLoadable-p) is called. It is meant to be overriden by subclasses. Subclasses should override this method to load their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly)) upon completion, passing in the error if any.

Parameters
retryingflag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p).
Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ fetchLegendInfosWithCompletion:

- (id<AGSCancelable>) fetchLegendInfosWithCompletion: (void(^)(NSArray< AGSLegendInfo * > *__nullable legendInfos, NSError *__nullable error))  completion

Fetches the array of legend infos (AGSLegendInfo) for this layer.

Since
100

◆ initWithItem:

- (instancetype) initWithItem: (AGSItem *)  item

Initialize the layer with an item representing a WMS service. The item's type should be AGSPortalItemTypeWMS.

Parameters
itemrepresenting a WMS service
Returns
Initialized layer
Since
100.2

◆ initWithLayerInfos:

- (instancetype) initWithLayerInfos: (NSArray< AGSWMSLayerInfo * > *)  layerInfos

Initialize the layer with a collection of layers to render in the WMS service.

Parameters
layerInfosrepresenting the layers to display
Returns
Initialized layer
Since
100.2

◆ initWithURL:layerNames:

- (instancetype) initWithURL: (NSURL *)  URL
layerNames: (NSArray< NSString * > *)  layerNames 

Initialize the layer with a URL to a WMS service. The URL can be the GetCapabilities URL for the service, for example - https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WMSServer?request=GetCapabilities&service=WMS , or it could be a URL that just points to the service endpoint where the GetCapabilities request can be issued, such as - https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WMSServer.

Runtime supports WMS versions 1.3.0, 1.1.1, and 1.1.0. The latest supported WMS version is set as the default. To specify a preferred WMS version, set the VERSION parameter in the GetCapabilities URL for the service.

Parameters
URLto WMS layer
layerNameslist of layers in the service to display
Returns
Initialized layer
Since
100.2

◆ isEqualToLayer:

- (BOOL) isEqualToLayer: (AGSLayer *)  other

◆ isVisibleAtScale:

- (BOOL) isVisibleAtScale: (double)  scale

Check whether this layer is visible at a given scale.

Since
100

◆ loadDidFinishWithError:

- (void) loadDidFinishWithError: (nullable NSError *)  error

Only subclasses should call this method in doStartLoading: (AGSLoadableBase(ForSubclassEyesOnly)) and doCancelLoading (AGSLoadableBase(ForSubclassEyesOnly)) when done loading or failed to load.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ loadWithCompletion:

- (void) loadWithCompletion: (nullable void(^)(NSError *__nullable error))  completion
requiredinherited

Loads data for the object asynchronously. The completion block is invoked upon completion.

You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.

Parameters
completionblock that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load.
Note
The completion block is always invoked on the main thread.
Since
100
See also
- cancelLoad to cancel loading
- retryLoadWithCompletion: to force reload

◆ onLoadStatusChanged

- (void) onLoadStatusChanged

Never call this method directly. The framework calls this method on a background thread when AGSLoadable::loadStatus changes is called. Subclasses can optionally implement this to know when their loading status has changed.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ retryLoadWithCompletion:

- (void) retryLoadWithCompletion: (nullable void(^)(NSError *__nullable error))  completion
requiredinherited

Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:

  1. you didn't have network connectivity earlier when it failed and you want to retry now that you have connectivity
  2. the server was down earlier when it failed and you want to retry
  3. the request is taking too long and you want to cancel it and retry, in which case you will first call cancelLoad and then this method

If the data hasn't started loading, it will start loading. If it is already loading, it will just continue to load. If it has already loaded successfully, calls back right away. If it has already failed to load, tries again. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.

Parameters
completionblock that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load.
Note
The completion block is always invoked on the main thread.
Since
100

◆ WMSLayerWithItem:

+ (instancetype) WMSLayerWithItem: (AGSItem *)  item

Initialize the layer with an item representing a WMS service. The item's type should be AGSPortalItemTypeWMS.

Parameters
itemrepresenting a WMS service
Returns
Initialized layer
Since
100.2

◆ WMSLayerWithLayerInfos:

+ (instancetype) WMSLayerWithLayerInfos: (NSArray< AGSWMSLayerInfo * > *)  layerInfos

Initialize the layer with a collection of layers to render in the WMS service.

Parameters
layerInfosrepresenting the layers to display
Returns
Initialized layer
Since
100.2

◆ WMSLayerWithURL:layerNames:

+ (instancetype) WMSLayerWithURL: (NSURL *)  URL
layerNames: (NSArray< NSString * > *)  layerNames 

Initialize the layer with a URL to a WMS service. The URL can be the GetCapabilities URL for the service, for example - https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WMSServer?request=GetCapabilities&service=WMS , or it could be a URL that just points to the service endpoint where the GetCapabilities request can be issued, such as - https://sampleserver6.arcgisonline.com/arcgis/services/SampleWorldCities/MapServer/WMSServer.

Runtime supports WMS versions 1.3.0, 1.1.1, and 1.1.0. The latest supported WMS version is set as the default. To specify a preferred WMS version, set the VERSION parameter in the GetCapabilities URL for the service.

Parameters
URLto WMS layer
layerNameslist of layers in the service to display
Returns
Initialized layer
Since
100.2

Property Documentation

◆ attribution

- (NSString*) attribution
readnonatomiccopyinherited

Attribution information of the layer.

Since
100

◆ brightness

- (float) brightness
readwritenonatomicassigninherited

The brightness of the layer's map image. Default value is 0. Values in the range -100.0 to 100.0 are valid. Values outside that range are ignored.

Since
100

◆ canChangeVisibility

- (BOOL) canChangeVisibility
readrequirednonatomicassigninherited

Denotes whether the layer can change visibility or not.

Since
100

◆ contrast

- (float) contrast
readwritenonatomicassigninherited

The contrast of the layer's map image. Default value is 0. Values in the range -100.0 to 100.0 are valid. Values outside that range are ignored.

Since
100

◆ credential

- (AGSCredential*) credential
readwritenonatomicstronginherited

Security credentials to access the remote resource. Only applicable if the resource is secured.

Since
100

◆ customParameters

- (NSDictionary<NSString*,NSString*>*) customParameters
readwritenonatomiccopy

These parameters are appended to GetMap and GetFeatureInfo requests issued to the WMS service. If a parameter with the same name is defined in the service's custom parameters, then layer-specific values take precedence over service-wide values.

Since
100.3

◆ fullExtent

- (AGSEnvelope*) fullExtent
readnonatomicstronginherited

Full extent of the layer.

Since
100

◆ fullTimeExtent

- (AGSTimeExtent*) fullTimeExtent
readnonatomicstronginherited

The full time extent of the layer 100.2

◆ gamma

- (float) gamma
readwritenonatomicassigninherited

The gamma of the layer's map image. Default value is 0. Values in the range -100.0 to 100.0 are valid. Values outside that range are ignored.

Since
100

◆ identifyEnabled

- (BOOL) identifyEnabled
readnonatomicassigninherited

Specifies whether the layer supports identify.

Since
100

◆ item

- (AGSItem*) item
readnonatomicstronginherited

The item the layer has been created from.

Since
100

◆ layerDescription

- (NSString*) layerDescription
readwritenonatomiccopyinherited

The layer's description.

Since
100

◆ layerID

- (NSString*) layerID
readwritenonatomiccopyinherited

The layer's ID specified in the web map item of ArcGIS Online or an on-premises portal.

Since
100

◆ layerInfos

- (NSMutableArray<AGSWMSLayerInfo*>*) layerInfos
readnonatomicstrong

A collection of layer info objects representing the layers in the WMS service

Since
100.2

◆ layerNames

- (NSMutableArray<NSString*>*) layerNames
readnonatomicstrong

Names of layers in the WMS service

Since
100.2

◆ loadError

- (NSError*) loadError
readnonatomicstronginherited

The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.

Since
100

◆ loadStatus

- (AGSLoadStatus) loadStatus
readrequirednonatomicassigninherited

Status of the load operation.

Since
100

◆ maxScale

- (double) maxScale
readwritenonatomicassigninherited

The maximum scale at which this layer is visible. If the map or scene is zoomed in beyond this scale, the layer will not be visible. A value of 0 means there is no maximum scale threshold and the layer will be visible at the smallest scale available for the map or scene.

Since
100

◆ minScale

- (double) minScale
readwritenonatomicassigninherited

The minimum scale at which this layer is visible. If the map or scene is zoomed out. beyond this scale, the layer will not be visible. A value of 0 means there is no minimum scale threshold and the layer will be visible at the largest scale available for the map or scene.

Since
100

◆ name

- (NSString*) name
readwritenonatomiccopyinherited

The name of the layer.

Since
100

◆ opacity

- (float) opacity
readwritenonatomicassigninherited

The opacity of this layer as a value between 0 (fully transparent) and 1 (fully opaque). Default value is 1.

Since
100

◆ preferredImageFormat

- (AGSMapServiceImageFormat) preferredImageFormat
readwritenonatomicassign

The preferred image format for rendering the layer

Since
100.2

◆ refreshInterval

- (NSTimeInterval) refreshInterval
readwritenonatomicassign

Time interval (in seconds) specifying how often the layer should auto-refresh its contents. If 0 or less is specified, the layer will not auto-refresh.

Since
100.2

◆ requestConfiguration

- (AGSRequestConfiguration*) requestConfiguration
readwritenonatomicstronginherited

The AGSRequestConfiguration object which defines the behavior and policies to use when accessing the remote resource. The default will be nil. If it is nil the [AGSRequestConfiguration globalConfiguration] will be used.

Since
100

◆ showInLegend

- (BOOL) showInLegend
readwritenonatomicassigninherited

Indicates whether to show legend information.

Since
100

◆ spatialReference

- (AGSSpatialReference*) spatialReference
readnonatomicstronginherited

The spatial reference of the layer.

Since
100

◆ subLayerContents

- (NSArray<id<AGSLayerContent> >*) subLayerContents
readnonatomiccopyinherited

This layer's sub-layers.

Since
100

◆ subLayerContentsChangedHandler

- (void(^ subLayerContentsChangedHandler) (void))
readwritenonatomiccopyinherited

Block that is invoked when the sub layer contents changes.

Note
The block will be invoked on the same thread on which the event occurred, which could be any arbitrary thread. You need to dispatch any UI related work to the main thread.
Since
100

◆ sublayers

- (NSMutableArray<AGSWMSSublayer*>*) sublayers
readnonatomicstrong

A collection of sublayers, one for each layer in the WMS service that is represented in layerInfos.

Since
100.2

◆ supportsTimeFiltering

- (BOOL) supportsTimeFiltering
readnonatomicassigninherited

Indicates whether the layer supports filtering its contents by a time range 100.2

◆ timeFilteringEnabled

- (BOOL) timeFilteringEnabled
readwritenonatomicassigninherited

Indicates whether the layer must use the time extent defined on the owning AGSGeoView::timeExtent and filter its content. Only applicable if the layer supports time filtering (see supportsTimeFiltering) 100.2

◆ timeInterval

- (AGSTimeValue*) timeInterval
readnonatomicstronginherited

Returns the suggested time slider step size for this time aware layer. Can be nil if no time interval is suggested for this time aware object.

100.2

◆ timeOffset

- (AGSTimeValue*) timeOffset
readwritenonatomicstronginherited

A time offset for this layer. This is useful when data from different layers belong to different time periods and must be displayed together. The offset it applied on-the-fly, it does not change the actual data of the layer. The time offset is subtracted from the time extent set on the owning AGSGeoView::timeExtent before the extent is used to filter content from the layer. 100.2

◆ URL

- (NSURL*) URL
readrequirednonatomicstronginherited

The URL of the remote resource.

Since
100

◆ version

- (AGSWMSVersion) version
readnonatomicassign

The version of the WMS layer. Runtime supports WMS versions 1.3.0, 1.1.1, and 1.1.0. The latest supported WMS version is set as the default. To specify a preferred WMS version, set the VERSION parameter in the GetCapabilities URL for the service.

Since
100.2.1

◆ visible

- (BOOL) visible
readwritenonatomicassigninherited

Denotes whether the layer is visible or not. The visibility changes can be monitored using Key-Value Observing (KVO).

Since
100