Select to view content in your preferred language

WmsLayer extract getMap request URL

1284
3
Jump to solution
02-09-2012 08:04 AM
ZachPride
Emerging Contributor
Hello everyone,

I'm using the WmsLayer to quite a nice result. I use a getCapabilities request to get a list of available layer IDs and present them to the user then add those selected (via a ListBox or some such GUI) to the Layers property for my WmsLayer. I've been letting the class determine version numbers and all the other usual parameters. The thing I'd like to accomplish is at some point get the full getMap URL the WmsLayer is presumably using to get these images back from the server and plot them. I'd like to record this and print this to sections of the UI and log files.

Is it possible to get this URL?
0 Kudos
1 Solution

Accepted Solutions
JenniferNery
Esri Regular Contributor
I think you can use the following code: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#WmsLayerSimple
   var l = MyMap.Layers["OtherWMSLayer"] as WmsLayer;    l.GetUrl(MyMap.Extent, (int)MyMap.ActualWidth,(int) MyMap.ActualHeight, (a, b, c, d) =>     {      var url = a;     });

View solution in original post

0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
I think you can use the following code: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#WmsLayerSimple
   var l = MyMap.Layers["OtherWMSLayer"] as WmsLayer;    l.GetUrl(MyMap.Extent, (int)MyMap.ActualWidth,(int) MyMap.ActualHeight, (a, b, c, d) =>     {      var url = a;     });
0 Kudos
ZachPride
Emerging Contributor
Ah, those delegate params contain a lot of useful data! Thanks for showing me how that works!

I have a problem however. When I debug wherein I do some simple assignments to variables I get a unhandled exception. It's under the ManagedRuntimeError category, as a XmlException: Data at the root level is invalid. Are there any ideas why this comes up? My skills in lambda expressions aren't so hot so I may be implementing something incorrectly.
0 Kudos
ZachPride
Emerging Contributor
Here is what I'm attempting to use to get at the onComplete params:

newWmsLayer.GetUrl(MyMap.Extent, (int)MyMap.ActualWidth, (int)MyMap.ActualHeight, (a, b, c, d) => { onGetUrlComplete(a, b, c, d); });

...

private void onGetUrlComplete(string url, int x, int y, ESRI.ArcGIS.Client.Geometry.Envelope env)
        {
            MessageBox.Show(url);
        }


Obviously I'm going to do some more useful functions rather than show a MessageBox, that's just for a quick test.
0 Kudos