Connect to a WMS service and show the available layers and sublayers.

Use case
WMS services often contain many layers and sublayers. Presenting the layers and sublayers in a UI allows you to explore what is available in the service and add individual layers to a map.
How to use the sample
- Open the sample.
- Tap “Layer Visibility” to see a hierarchical list of layers and sublayers.
- Select a layer to enable it for display. If the layer has any children, the children will also be selected.
How it works
- A
WMSServiceis created and loaded. WMSServicehas aserviceInfoproperty, which is aWMSServiceInfo.WMSServicehas aWMSLayerInfoobject for each layer (excluding sublayers) in thelayerInfoscollection.- Models are recursively created for each sublayer.
- The model has an
isVisibleproperty which sets the visibility for the associated sublayer.
- The model has an
- Once the layer selection has been updated, a
WMSLayerwith the selected sublayers is created and added to the operational layers of the map.
Relevant API
- WMSLayer
- WMSLayerInfo
- WMSService
- WMSServiceInfo
About the data
This sample shows Weather Radar Base Reflectivity Mosaics produced by the US NOAA National Weather Service. The service provides weather radar data from the NWS & OAR Multi-Radar/Multi-Sensor (MRMS) System.
Tags
catalog, OGC, web map service, WMS