WMS Issue/Debug

817
6
10-13-2017 05:41 AM
EdwardJakubowski
New Contributor

Hello,  I'm trying to figure out why a particular WMS Layer/Service will not show up on the MapView.  I've tested the same WMS URL with other map tools(IE, WorldWind), which seem to support it.  However, when I try to use it in ArcGIS 10.2.7 I can't seem to get it to display anything and it doesn't report and noticeable logs or errors.  How can I debug the WmsLayer and figure out what's going on?  Below is an example, the WMS server I'm trying to get working is internal.  I do know the code can work with other WMS sites, it's just not working on the one I need it to work with. Any ideas why?  Would it have issues dealing with self-signed certs?

public partial class MainWindow : Window
{
public MainWindow()
{
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; //ignore bad ssl
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));
}
private void addWMSBtn_Click(object sender, RoutedEventArgs e)
{
//String wmsURL = "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi";
String wmsURL = "https://wserver/wms?TYPE=population";
var wl = new Esri.ArcGISRuntime.Layers.WmsLayer(new Uri(wmsURL));
MyMapView.Map.Layers.Add(wl);
wl.IsVisible = true;
}
}

0 Kudos
6 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

You appear to be ignoring the server certificate validation so the self-signed certificate should not be the issue here. 

Any errors should be reported through the LayerLoaded event. Once the Layer has loaded, what is the value of the WmsLayer.Status property?

Cheers

Mike

0 Kudos
EdwardJakubowski
New Contributor

OK, I just wanted to be sure the certificate validation wasn't an issue.  I don't see any errors in the LayerLoaded event either.  The WMSLayer status just always says "Initialized".  The WMS layer doesn't show up on the map.  Any other events or logging or debugging I can add?  Thanks.

0 Kudos
dotMorten_esri
Esri Frequent Contributor

Does the WMS Layer support the spatial reference of the map? To verify if that's what it is, try and see if it will work if it is the only layer you add to the map (and don't force a spatial reference on the map on creation)

0 Kudos
EdwardJakubowski
New Contributor

This is the only WMS Layer or Layer and the only thing I'm adding to the map.  Not sure I understand what you want me to do with the spatial reference, I'm pretty new to ArcGIS's map. I would hope that if there is an unsupported spacial format that it would produce some kind of error message or log somewhere?  The WMS service works fine in worldwind so I'm just trying to figure out what is or isn't supported in the ArcGIS map.  Thanks.

0 Kudos
EdwardJakubowski
New Contributor

Not sure if this helps.  But when I look at the server logs I can see that it made a request to get capabilities of the WMS service.  However I don't see any requests to pull down map images afterwards.  Am I missing something here? 

0 Kudos
EdwardJakubowski
New Contributor

OK, I think I figured out what the bug or issue is.  Apparently it counts the basemap layer as a layer, and once that spatial reference is set in the map it won't use the WMS Layer's spatial reference.  Is there a way to force it to use more than one layer with different spatial references?  Currently I was able to get it working by creating a new map with the correct spatial reference...

MyMapView.Map = new Map()
{
  SpatialReference = new SpatialReference(4326)
};

MyMapView.Map.Layers.Add(wl);

0 Kudos