Select to view content in your preferred language

WMS layer in Silverlight app

5680
10
12-07-2010 04:51 AM
JayKappy
Frequent Contributor
I am trying to display a WMS layer being published from a 3rd party source...
                   
I tried this but am getting errors saying that the type cannot be found and that I might be missing an assembly reference???  If missign a reference, how teh heck do I know what reference to add for this?  Is there soem location that explains what references are needed for what?

<esriWMS:WMSMapServiceLayer ID="WMS Layer" Layers="2909_17518_bg" Url="http://aes.gsfc.nasa.gov/cgi-bin/wms" Opacity="0.7"></esriWMS:WMSMapServiceLayer>

Any thoughts or additional info on displaying WMS services?

THANKS
0 Kudos
10 Replies
DominiqueBroux
Esri Frequent Contributor
WMSLayer is defined in ESRI.ArcGIS.Client.Toolkit.Datasource so you need to include it in your project.
0 Kudos
JayKappy
Frequent Contributor
How do you know that?  Is there some place to look that up?.......

THanks
0 Kudos
JayKappy
Frequent Contributor
I went into Add References and Added ESRI.ArcGIS.Client.Toolkit.DataSources reference
I then added this to the User Control
xmlns:esriWMS="clr-namespace:ESRI.ArcGIS.Client.Toolkit.DataSources;assembly=ESRI.ArcGIS.Client.Toolkit.DataSources"

This is the WMS in the Map
<esriWMS:WMSMapServiceLayer ID="AGSWMSLayer" 
Url="http://sampleserver1.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer"   
SkipGetCapabilities="True"
Layers="2" Version="1.3" Opacity="0.7"/>


But then I get a bunch of errors:
1. The type esriWMS:WMSMapServiceLayer was not found, missing assembly reference
2. The TAG WMSMapServiceLayer does not exist in XML namespace "clr-namespace:ESRI.ArcGIS.Client.Toolkit;assembly=ESRI.ArcGIS.Client.Toolkit.DataSource"

Any more thoughts?

Thanks
0 Kudos
JenniferNery
Esri Regular Contributor
Have you looked at this sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#WmsLayerSimple

Notice that in the xaml, the following xaml namespace definition was added.
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">


which allows for the following code to work:
            <esri:WmsLayer .../>


I also tried your code and it works for me. Have you check project references the correct assembly? ESRI.ArcGIS.Client.Toolkit.DataSources.dll?
0 Kudos
JayKappy
Frequent Contributor
This is what I did...errors are gone but nothign is showing up...I am contacting the 3rd party to see if soemthign is messed up on their end...
I thank you for that...I missed the WMS example...I was getting my prior code from another website..

I believe their data is WGS 84, but it shoudl auto project right?

' MAIN PAGE .xaml
<esri:WmsLayer ID="LOGISLAYER" 
 Url="http://gis.logis.org/ArcGIS/services/MG_TEST/MapServer/WMSServer"          
 Initialized="WmsLayer_Initialized2"/>

MAIN PAGE vb.xaml
    Private Sub WmsLayer_Initialized2(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim myWmsLayer As ESRI.ArcGIS.Client.Toolkit.DataSources.WmsLayer
        myWmsLayer = TryCast(MyMap.Layers("LOGISLAYER"), ESRI.ArcGIS.Client.Toolkit.DataSources.WmsLayer)        
        ' You can control the visibility of which WMS layers are displayed by adding the
        ' sub-LayerID's to the String Array. 
        Dim myVisibleWmsLayers() As String = {"0"}
        myWmsLayer.Layers = myVisibleWmsLayers
    End Sub
0 Kudos
FrankKish
Esri Contributor
Are these service set up to be consumed by webapp's?  If I open fiddler and attempt to connect I get errors regarading "/clientaccesspolicy.xml" and "/crossdomain.xml".
0 Kudos
dotMorten_esri
Esri Notable Contributor
It will only be able to autoproject if that service supports the WKID of your map (for instance most non-ArcGIS servers doesn't support 102100 that ArcGIS Server uses for WebMercator)
0 Kudos
JayKappy
Frequent Contributor
I thank you all for your efforts....it turns out there was soemthing wrong with the data...they no have it stright and its showing up....
Thanks...very appreciated
0 Kudos
HuJinHai
New Contributor
I used ESRI.ArcGIS.Client.Toolkit.DataSources to my application. but it is not work.can you tell me how did you get the WMSMapServiceLayer?
0 Kudos