public class

WMSLayer

extends DynamicLayer
java.lang.Object
   ↳ com.esri.android.map.Layer
     ↳ com.esri.android.map.DynamicLayer
       ↳ com.esri.android.map.ogc.WMSLayer

Class Overview

A layer for OGC Web Map Services (WMS). This class searches for its default spatial reference and extent from root to bottom in its layer hierarchy. It allows users to specify the default spatial references in the constructor too if users want to do that.

Summary

[Expand]
Inherited Fields
From class com.esri.android.map.DynamicLayer
From class com.esri.android.map.Layer
Public Constructors
WMSLayer(String url)
This constructor is used if you're instantiating the WMSLayer using a URL.
WMSLayer(String url, String[] visibleLayers)
This constructor is used if you're instantiating the WMSLayer using a URL and visible layer names.
WMSLayer(String url, SpatialReference sr)
This constructor is used if you're instantiating the WMSLayer using a URL and default spatial reference.
WMSLayer(String url, boolean checkSupportedSRs)
This constructor is used if you're instantiating the WMSLayer using a URL and checkSupportedSRs flag.
WMSLayer(String url, SpatialReference sr, boolean checkSupportedSRs, String[] visibleLayers, UserCredentials credentials, boolean initLayer)
This constructor is used if you're instantiating the WMSLayer using a URL, default spatial reference, checkSupportedSRs flag, visible layer names, user credential and initLayer flag.
Public Methods
String getImageFormat()
Returns the image format.
WMSLayerInfo[] getLayers()
Gets all layer information available in the service.
String[] getSupportedImageFormats()
Gets the supported image formats.
SpatialReference[] getSupportedSpatialReferences()
Gets supported spatial references.
String getVersion()
Gets the WMS service's version.
String[] getVisibleLayers()
Gets visible layer names.
boolean isTransparent()
True if the image background is transparent.
void setImageFormat(String format)
Sets the image format as a string('image/png', etc.).
void setTransparent(boolean transparent)
Sets the image background to be transparent or not.
void setVisibleLayer(String[] layerNames)
Sets visible layers by specifying the layer names.
Protected Methods
byte[] getImage(int width, int height, Envelope extent)
void initLayer()
Initializes the layer.
void updateSpatialReferenceStatus(int SRStatus)
The callback method is invoked when the layer is added to map.
[Expand]
Inherited Methods
From class com.esri.android.map.DynamicLayer
From class com.esri.android.map.Layer
From class java.lang.Object
From interface com.esri.android.map.popup.PopupLayer

Public Constructors

public WMSLayer (String url)

This constructor is used if you're instantiating the WMSLayer using a URL.

Parameters
url URL string to the WMS layer.

public WMSLayer (String url, String[] visibleLayers)

This constructor is used if you're instantiating the WMSLayer using a URL and visible layer names.

Parameters
url URL string to the WMS layer.
visibleLayers names of sub-layers to be included in the image rendered(EPSG:3857, etc.).

public WMSLayer (String url, SpatialReference sr)

This constructor is used if you're instantiating the WMSLayer using a URL and default spatial reference. A WMSLayer may support several spatial references. Users can specify a default spatial reference instead of asking WMSLayer to choose one automatically.

Parameters
url URL string to the WMS layer.
sr default spatial reference of the layer.

public WMSLayer (String url, boolean checkSupportedSRs)

This constructor is used if you're instantiating the WMSLayer using a URL and checkSupportedSRs flag. If checkSupportedSRs is false, it assumes that WMS layer can be projected to any spatial reference and it will not check if map's spatial reference is in the supported spatial reference list of the WMS layer. Users can set this flag to false if some spatial reference is supported by WMS service but not declared in its capability response.

Parameters
url URL string to the WMS layer.
checkSupportedSRs a flag which indicate to check if map's spatial reference is in the WMSLayer's supported spatial reference list or not.

public WMSLayer (String url, SpatialReference sr, boolean checkSupportedSRs, String[] visibleLayers, UserCredentials credentials, boolean initLayer)

This constructor is used if you're instantiating the WMSLayer using a URL, default spatial reference, checkSupportedSRs flag, visible layer names, user credential and initLayer flag.

Parameters
url URL string to the WMS layer.
sr default spatial reference.
checkSupportedSRs true if map's spatial reference is checked against spatial reference list supported by the WMS service when layer is added into map.
visibleLayers names of sub-layers to be included in the image rendered.
credentials user credential
initLayer true if layer initialization happens immediately.

Public Methods

public String getImageFormat ()

Returns the image format. Default is 'image/png'.

Returns
  • image format in String.

public WMSLayerInfo[] getLayers ()

Gets all layer information available in the service.

Returns
  • an array of WMSLayerInfo objects.

public String[] getSupportedImageFormats ()

Gets the supported image formats.

Returns
  • supported image formats in String array.

public SpatialReference[] getSupportedSpatialReferences ()

Gets supported spatial references.

Returns
  • spatial references in array.

public String getVersion ()

Gets the WMS service's version.

Returns
  • WMS service version in String.

public String[] getVisibleLayers ()

Gets visible layer names. If not set, all the layers are visible and a null is returned.

Returns
  • visible layer name array.

public boolean isTransparent ()

True if the image background is transparent. Please ensure that the WMS service supports this property. Default is true.

Returns
  • true if image background is transparent.

public void setImageFormat (String format)

Sets the image format as a string('image/png', etc.). Please ensure that the WMS service supports the requested image format.

Parameters
format image format in string.

public void setTransparent (boolean transparent)

Sets the image background to be transparent or not. Please ensure that the WMS service supports this property.

Parameters
transparent true if image background is set to transparent.

public void setVisibleLayer (String[] layerNames)

Sets visible layers by specifying the layer names.

Parameters
layerNames visible ayer name array.

Protected Methods

protected byte[] getImage (int width, int height, Envelope extent)

Throws
Exception

protected void initLayer ()

Initializes the layer. The implementation should submit the OnStatusChangedListener.STATUS event accordingly.

protected void updateSpatialReferenceStatus (int SRStatus)

The callback method is invoked when the layer is added to map. 0 - Spatial Reference Invalid 1 - Spatial Reference NotNeeded 2 - Spatial Reference Projected 3 - Spatial Reference Good

Parameters
SRStatus an integer indicating the spatial reference status of layer