Web Map Service Provider
Web Map Services (WMS) allow you to receive geographical data images from a map server.
Follow the steps below to provide data from a web map service to a Map control.
- Create an ImageLayer and add it to the MapControl.Layers collection. See Layers for more information.
Assign a WmsDataProvider class instance to the ImageLayer.DataProvider property.
Note
To display multiple WMS layers, you should create separate ImageLayer and WmsDataProvider instances for each of the WMS layers.
To connect to the required web server, use the WmsDataProvider.ServerUri property to define the server URI path.
Assign the name of the layer you want to display to the WmsDataProvider.ActiveLayerName property.
If a layer name is unknown, you can handle the WmsDataProvider.ResponseCapabilities event. CapabilitiesRespondedEventArgs provides the CapabilitiesRespondedEventArgs.Layers collection that contains available layers with the WmsLayer.Name, WmsLayer.Children, and WmsLayer.Title parameters. Refer to the How to: Obtain Data from a Web Map Service example for information on how to obtain layer information in the event handler.
For information on how to receive a collection of available layers, see the How to: Obtain a Collection of Available Layers in the ResponseCapabilities Event Handler example.