Adding WMSLayer to basemap

2511
7
07-07-2010 02:19 PM
NeelMallepally
New Contributor
I tried to use the WMSLayer class ion v 2.0 for adding a WMS layer. The layer showed perfectly on the ESRI' sworld street map. But when I switched ESRI's base map with a base map at my organization the WMS layer is not appearing over the base map.

Does base map needs to use particular spatial reference? Base map at my organization uses 4269 spatial reference.

any help please..
0 Kudos
7 Replies
dotMorten_esri
Esri Notable Contributor
Does your WMS service support that spatial reference? What does Fiddler say about the request when the wms image is requested by the map?
0 Kudos
DanielWalton
Occasional Contributor
If you append '&request=GetCapabilities' to your WMS service URL and put it in a browser, you should get an XML response containing all the service metadata. Among the metadata, look for the <layer> tags, and inside them, the CRS tags that tell you which spatial references are supported: <CRS>EPSG:4326</CRS> for instance. If 4629 is not among them, the WMS service will reject your GetMap requests, since you specify the CRS along with the bounding box, etc.
0 Kudos
NeelMallepally
New Contributor
If you append '&request=GetCapabilities' to your WMS service URL and put it in a browser, you should get an XML response containing all the service metadata. Among the metadata, look for the <layer> tags, and inside them, the CRS tags that tell you which spatial references are supported: <CRS>EPSG:4326</CRS> for instance. If 4629 is not among them, the WMS service will reject your GetMap requests, since you specify the CRS along with the bounding box, etc.


No, it does not has 4269 in CRS list. I was able to display this WMS layer on a base map using Jvascript API. Is there any explanation why Silverlight is not accepting to display the WMS layer?

Thanks.
0 Kudos
DanielWalton
Occasional Contributor
No, it does not has 4269 in CRS list. I was able to display this WMS layer on a base map using Jvascript API. Is there any explanation why Silverlight is not accepting to display the WMS layer?

Thanks.


I'm not sure why it works with the Javascript API, but the way that the WMS class works in Silverlight is that it uses your map control's spatial reference to generate GetMap requests to the WMS. One thing you can do is download the sample WMS layer code here and modify the GetUrl() method to force the spatial reference to EPSG: 4326, then use this class instead of the 2.0 API WMS class.
0 Kudos
NeelMallepally
New Contributor
I'm not sure why it works with the Javascript API, but the way that the WMS class works in Silverlight is that it uses your map control's spatial reference to generate GetMap requests to the WMS. One thing you can do is download the sample WMS layer code here and modify the GetUrl() method to force the spatial reference to EPSG: 4326, then use this class instead of the 2.0 API WMS class.


Thanks for the quick reply.

Yes, I have modified GetUrl method to force the spatial reference to 4326. The layer did not appear but there was a message at the bottom left corner of the browser window -" Transferring from <so and so server name>".

Also there are couple of questions regarding the example code (custom WMSLayer class exmaple) that you suggested to download:
Q1:  Why there are two similar ProxyHandler.ashx pages, one in web application and other in WMS project? Which one does the application use?

Q2: Do I need to register the handler somewhere (web.config/IIS) to use it in the application, because the WMS layer was appeared only when I used SkipGetCapabilities="True". And when I set SkipGetCapabilites="False"  ProxyHandler="../ProxyHandler.ashx" WMS layer did not appear.

Thanks a lot for the help.
0 Kudos
NeelMallepally
New Contributor
Thanks for the quick reply.

Yes, I have modified GetUrl method to force the spatial reference to 4326. The layer did not appear but there was a message at the bottom left corner of the browser window -" Transferring from <so and so server name>".


Sorry, I was wrong. I changed WKID at different place.
WMS layer did appear on the base map.

Thanks for the tip.
0 Kudos
dotMorten_esri
Esri Notable Contributor
I'm not sure why it works with the Javascript API, but the way that the WMS class works in Silverlight is that it uses your map control's spatial reference to generate GetMap requests to the WMS. One thing you can do is download the sample WMS layer code here and modify the GetUrl() method to force the spatial reference to EPSG: 4326, then use this class instead of the 2.0 API WMS class.


I would highly discourage that, since the two layers will not properly align (error could easily be >1000feet)

The correct approach is to make all your services use and support the same spatial reference, instead of mixing oranges and apples.
0 Kudos