Can't add WMS Nexrad to Map

4096
7
02-04-2011 08:34 AM
adamestrada
New Contributor
All,

For some reason I can't add the Nexrad layer to my map. The layer I am using supports 90013 but still nothing. What can I possibly be doing wrong?

http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?%20&service=WMS&request=GetCapabilities&version=1.3.0


<esri:WmsLayer ID="Nexrad" Url="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?" Version="1.3.0" 
                           Layers="nexrad-n0r-900913-m05m" SkipGetCapabilities="True" Initialized="WmsLayer_Initialized"  Visible="True" ProxyUrl="http://localhost:1234/proxy.ashx"/>

           
private void WmsLayer_Initialized(object sender, EventArgs e)
        {
            try
            {
                WmsLayer nexradWmsLayer = null;
                nexradWmsLayer = (WmsLayer)Map.Layers["Nexrad"];

                // You can control the visibility of which WMS layers are displayed by adding the
                // sub-LayerID's to the String Array. 
                string[] VisibleWmsLayers = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" };
                nexradWmsLayer.Layers = VisibleWmsLayers;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }


Thanks,
Adam
0 Kudos
7 Replies
JenniferNery
Esri Regular Contributor
It's hard to tell where the problem is just by looking at your code. Could you try to follow the steps here to troubleshoot the WMS layer? http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2009/08/24/Troubleshooting-blank-layers.aspx

You might be able to see which web request failed in Fiddler or maybe subscribe to InitializationFailed event too.
0 Kudos
WilliamDollins
New Contributor II
In this line of code:

string[] VisibleWmsLayers = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" };

the array needs to be populated with the actual layer names, not string representations of the layer ordinals. So you want something like this:

string[] VisibleWmsLayers = { "nexrad-n0r-900913-m05m" };
0 Kudos
adamestrada
New Contributor
Bill,

That did it and it's returning the right response through firebug.

<esri:WmsLayer ID="Nexrad" Url="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?" Version="1.3.0" 
                           Layers="nexrad-n0r-900913-m05m" SkipGetCapabilities="True" Initialized="WmsLayer_Initialized"  Visible="True" />
            


    
           WmsLayer nexradWmsLayer = null;
                nexradWmsLayer = (WmsLayer)Map.Layers["Nexrad"];

                // You can control the visibility of which WMS layers are displayed by adding the
                // sub-LayerID's to the String Array. 
                string[] VisibleWmsLayers = { "nexrad-n0r-900913-m05m" };
                nexradWmsLayer.Layers = VisibleWmsLayers;


EPSG code is 3857 "http://spatialreference.org/ref/sr-org/6864/" and my base map is web mercator. Any suggestions on that one?

Adam
0 Kudos
WilliamDollins
New Contributor II
When I tested it, I used this base map:

http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer

Is your basemap publicly available?
0 Kudos
adamestrada
New Contributor
Young William,

I am using the nexrad WMS. This is what Firebug gives me.

http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?&SERVICE=WMS&REQUEST=GetMap&WIDTH=1364&HEIGHT=223&FORMAT=image/png&LAYERS=nexrad-n0r-900913-m05m&STYLES=&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&VERSION=1.3.0&CRS=EPSG:3857&BBOX=-29349775.7847534,2000000,7349775.78475336,8000000


Note the EPSG code of 3857. I think it needs to be 900913. This is what will make it display over my map but I don't know how to change it.

http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?&SERVICE=WMS&REQUEST=GetMap&WIDTH=1364&HEIGHT=223&FORMAT=image/png&LAYERS=nexrad-n0r-900913-m05m&STYLES=&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&VERSION=1.3.0&CRS=EPSG:900913&BBOX=-29349775.7847534,2000000,7349775.78475336,8000000


Ideas in that one?

Adam
0 Kudos
adamestrada
New Contributor
Fixed it! It has to do with the order of the map layers in the xaml. I first had the WMS rendering before the base map which did not work! Then when swapped the two around everything was golden.


Good-

 <esri:Map x:Name="Map" Loaded="Map_Loaded" Extent="-15000000,2000000,-7000000,8000000">
            
            <esri:ArcGISTiledMapServiceLayer ID="AGOLayer" Visible="True" 
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />

            <esri:WmsLayer ID="Nexrad" Url="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?" Version="1.3.0" 
                          SkipGetCapabilities="True" Initialized="WmsLayer_Initialized"  Visible="True" />

            <esri:GraphicsLayer ID="GeoRSSFeed">
                <esri:GraphicsLayer.MapTip>
                    <Grid Background="LightYellow">
                        <StackPanel Orientation="Vertical" Margin="5" >
                            <TextBlock Text="{Binding [Title]}" />
                            <TextBlock Text="{Binding [Desc]}"/>
                            <TextBlock Text="{Binding [Link]}"/>
                        </StackPanel>
                        <Border BorderBrush="Black" BorderThickness="1" />
                    </Grid>
                </esri:GraphicsLayer.MapTip>
            </esri:GraphicsLayer>
         </esri:Map>


Bad-
 <esri:Map x:Name="Map" Loaded="Map_Loaded" Extent="-15000000,2000000,-7000000,8000000">

            <esri:WmsLayer ID="Nexrad" Url="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?" Version="1.3.0" 
                          SkipGetCapabilities="True" Initialized="WmsLayer_Initialized"  Visible="True" />
            
            <esri:ArcGISTiledMapServiceLayer ID="AGOLayer" Visible="True" 
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />

            <esri:GraphicsLayer ID="GeoRSSFeed">
                <esri:GraphicsLayer.MapTip>
                    <Grid Background="LightYellow">
                        <StackPanel Orientation="Vertical" Margin="5" >
                            <TextBlock Text="{Binding [Title]}" />
                            <TextBlock Text="{Binding [Desc]}"/>
                            <TextBlock Text="{Binding [Link]}"/>
                        </StackPanel>
                        <Border BorderBrush="Black" BorderThickness="1" />
                    </Grid>
                </esri:GraphicsLayer.MapTip>
            </esri:GraphicsLayer>
         </esri:Map>


Go figure...Thanks again for all the feedback!

Adam
0 Kudos
BenKoostra
New Contributor II
As an alternative (to the WMS magic), you can try this AGS service for the current NEXRAD composite image -
http://gis.srh.noaa.gov/ArcGIS/rest/services/RIDGERadar/MapServer
0 Kudos