WMS Layer

Download Samples Repository

Description

This sample demonstrates displaying an WMSLayer draped over an ArcGISTiledMapServiceLayer. The WMSLayer allows users to display Open GIS Consortium (OGC) WMS layers.

"Desktop" "Store" "Phone" Available for Desktop, Store, Phone

Sample Code

<UserControl x:Class="ArcGISRuntime.Samples.Desktop.DynamicLayers.WMSLayer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013">
    <Grid>
		<esri:MapView WrapAround="False" LayerLoaded="MyMapView_LayerLoaded">
			<esri:Map InitialViewpoint="-15000000,2000000,-7000000,8000000" >
                <esri:ArcGISTiledMapServiceLayer 
                    ServiceUri="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
                <esri:WmsLayer ID="OtherWMSLayer"
                    ServiceUri="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi"
                    Layers="nexrad-n0r" Opacity="0.7" />
            </esri:Map>
        </esri:MapView>
    </Grid>
</UserControl>
using Esri.ArcGISRuntime.Controls;
using System.Diagnostics;
using System.Windows.Controls;

namespace ArcGISRuntime.Samples.Desktop.DynamicLayers
{
    /// <summary>
    /// This sample demonstrates displaying an WMSLayer draped over an ArcGISTiledMapServiceLayer. The WMSLayer allows users to display Open GIS Consortium (OGC) WMS layers.
    /// </summary>
    /// <title>WMS Layer</title>
	/// <category>Layers</category>
	/// <subcategory>Dynamic Service Layers</subcategory>
	public partial class WMSLayer : UserControl
    {
        public WMSLayer()
        {
            InitializeComponent();
        }

		private void MyMapView_LayerLoaded(object sender, LayerLoadedEventArgs e)
		{
			if (e.LoadError == null)
				return;

			Debug.WriteLine(string.Format("Error while loading layer : {0} - {1}", e.Layer.ID, e.LoadError.Message));
		}
    }
}
Feedback on this topic?