Direct Link to WMS Sub Layer

783
1
Jump to solution
08-29-2012 12:01 PM
ErnieSalazar
New Contributor III
HI Guys.

I would like to use a WMS in my SL app.  I am use to working with REST so WMS is a little new to me.  The url is this:

http://njwebmap.state.nj.us/njimagery?

I am able to connect to it with this bit of code which is what the Initialized event of WMSLayer is pointed at:

        public void AddWMSMapLayer(string sURL, string sMapID, string sProxyURL)         {             WmsLayer WMSLayer = new WmsLayer() { Url = sURL };             WMSLayer.Initialized += new EventHandler<EventArgs>(WMSLayer_Initialized);             WMSLayer.Initialize();         }         void WMSLayer_Initialized(object sender, EventArgs e)         {             WmsLayer WMSLayer = (WmsLayer)sender;             WMSLayer.Layers = new string[] { "Natural2007" };             mapLayers.Insert(0, WMSLayer);         }


What I would like to do is somehow embed the URL so I dont have to specify the "Natural2007" sublayer name in the Layers property. So something like "http://njwebmap.state.nj.us/njimagery?Sublayer=Natural2007".

is that possible with WMS?

Thanks
Ernie
0 Kudos
1 Solution

Accepted Solutions
ErnieSalazar
New Contributor III
Nevermind.  Had to add "LAYERS=Natural2007" to the url string AND i had to also set not on the URL property of the WMSLayer but also the MapURL property.

Ernie

View solution in original post

0 Kudos
1 Reply
ErnieSalazar
New Contributor III
Nevermind.  Had to add "LAYERS=Natural2007" to the url string AND i had to also set not on the URL property of the WMSLayer but also the MapURL property.

Ernie
0 Kudos